Page 1 of 1

Getting colors to appear realistically

Posted: Thu Apr 27, 2023 9:16 am
by laukejas
Hi,

I know that appearances are not SWs main focus, nor something it is really good at, but I'm in a situation where I need to test various color combinations for a project I'm designing (most parts will be printed from PLA plastic, and I have RGB color sheet of the colors that are available), so I want to set up some appearances in SW and find the best looking combination.

Thing is, with default scene and lightning (3-point faded scene), the colors applied to a model seem way off, even when compared to the SW color palette preview. Also, they look different depending on the angle at which you look to the model.

I went into the lightning settings, disable everything except for the Ambient light. However, I am unsure where to set the Ambient setting at. At 1.00, the scene is way too bright, but the colors do seem to match more closely to the palette preview. At more realistic levels (0.70-0.80), the colors become much too dark.

I also went into the color settings, made sure I remove any textures (setting everything to use color.p2m file), and set reflectivity to 0, which seemed to help a bit.

But still, I am not sure what settings I should use overall to get these colors to appear as realistically as possible. Please note that I am not aiming to get an actual photo-realistic visualization - I only need to check the colors.

Can anyone advise on what are the best settings to achieve this?

Re: Getting colors to appear realistically

Posted: Thu Apr 27, 2023 9:25 am
by DanPihlaja
This uses Photoview 360, but maybe it will help?


Re: Getting colors to appear realistically

Posted: Thu Apr 27, 2023 10:27 am
by laukejas
DanPihlaja wrote: Thu Apr 27, 2023 9:25 am This uses Photoview 360, but maybe it will help?
Thanks, I am aware of Photoview 360 (as we as Visualize), but they do complex renderings that have to be tuned just right to produce photorealistic or otherwise quality pics. I am not after that, I just want the basic colors to show up correctly in SW model view.

Re: Getting colors to appear realistically

Posted: Thu Apr 27, 2023 11:00 am
by JSculley
Turn off the directional lights, set the Scene to 'Plain White' and set the Ambient light 'Ambient' value to 1. If you do that, what's on the screen will match the RGB values of the appearance:
image.png

Re: Getting colors to appear realistically

Posted: Thu Apr 27, 2023 1:55 pm
by Frederick_Law
laukejas wrote: Thu Apr 27, 2023 10:27 am basic colors to show up correctly in SW model view.
How do you know the color was "incorrect"?
What are you seeing that looks, incorrect?

Color you see on the screen depends on the monitor, setting on the monitor: contrast, brightness, hue, color temperature.
If monitor is set to warm. Everything will be yellowish. Cold, blueish.
Next Windows setting that adjust all the above.
Next lights in the room you're in.

You'll need to calibrate the screen somehow.

Re: Getting colors to appear realistically

Posted: Fri Apr 28, 2023 7:18 am
by laukejas
Frederick_Law wrote: Thu Apr 27, 2023 1:55 pm How do you know the color was "incorrect"?
What are you seeing that looks, incorrect?

Color you see on the screen depends on the monitor, setting on the monitor: contrast, brightness, hue, color temperature.
If monitor is set to warm. Everything will be yellowish. Cold, blueish.
Next Windows setting that adjust all the above.
Next lights in the room you're in.

You'll need to calibrate the screen somehow.
Yes, you're right, but in my case I don't need to go that far (calibrating monitor), I was just seeking to get the colors on the part to appear the exact same as they appear in SW color palette in the appearances editing menu.
JSculley wrote: Thu Apr 27, 2023 11:00 am Turn off the directional lights, set the Scene to 'Plain White' and set the Ambient light 'Ambient' value to 1. If you do that, what's on the screen will match the RGB values of the appearance:
image.png
This helped. Apparently I had to change the Scene, there was probably something in the background of the default scene that was messing up my colors, even though the lightning was set up as you said. Changing the scene fixed it, and now the colors are appearing correctly. Thank you very much!

Re: Getting colors to appear realistically

Posted: Thu Jul 13, 2023 12:55 pm
by ryan-feeley
Be aware that while yes, using only ambient light does make colors of faces match the color palette, if your goal is to "to set up some appearances in SW and find the best looking combination.", that may not be what you want to be doing.

Ambient light is a computationally cheap and somewhat believable way of faking indirect (diffuse) lighting. It adds a constant amount of light to every object from all directions, which gives uniform shading. That is why the face colors uniformly match the color palette.

But our eyes use differences in shading across the surface of an object to determine depth, so any object illuminated using only ambient light will not appear 3D. Imagine something outside on a very overcast day. The object has no depth and is pretty boring. So if you use ambient-only lighting in Solidworks, this will make it difficult for your on-screen display to truly be predictive of "best looking" or for "colors to appear as realistically as possible".

In my templates, I use mostly direct lighting, supported by a little ambient to fill in the gaps. Three direct lights are arranged more or less you would do a three-point lighting setup for product photography, with some adjustments that tailor the setup more towards part modeling than a photoshoot. I can share a scene file if you're interested.

This doesn't address any of the monitor color calibration issues discussed above, but it gets a little closer to a realistic appearance. In the physical world, most objects don't generate light. They just modify and reflect the color and magnitude of the environmental lighting back to your eyes. Solidworks can approximate this a bit. Generally more lights are better than fewer. Of the scenes included with Solidworks, only Studio Room 2 makes any sense at all. It has a soft background and three direct lights that remain fixed so you can rotate with the model within them to illuminate different aspects as you develop it.

Re: Getting colors to appear realistically

Posted: Thu Jul 13, 2023 1:54 pm
by AlexB
I've actually put together a macro to help with this on some of our files. It boosts the default settings of the scene. For those interested, the code is below.

Code: Select all

' Macro to delete all scene lights, and replace 3 directional and 1 ambient 
' with higher lighting values to produce colors closer to SW color palette
Option Explicit

Sub main()
    Dim swApp           As SldWorks.SldWorks
    Dim swModel         As SldWorks.ModelDoc2
    Dim i               As Integer
    Dim nLightCount     As Integer
    
    Set swApp = Application.SldWorks
    Set swModel = swApp.ActiveDoc
    
    If swModel Is Nothing Then
        MsgBox "A file must be open"
        Exit Sub
    ElseIf swModel.GetType = swDocDRAWING Then
        MsgBox "Macro can only be run on SLDPRT and SLDASM files"
        Exit Sub
    End If
    
    swModel.Extension.StartRecordingUndoObject
    
    nLightCount = swModel.GetLightSourceCount
    
    For i = nLightCount - 1 To 0 Step -1
        swModel.DeleteLightSource (i)
    Next i
    
    swModel.AddLightSource "Directional-1", 4, "Directional1"
    swModel.AddLightSource "Directional-2", 4, "Directional2"
    swModel.AddLightSource "Directional-3", 4, "Directional3"
    
    'Ambient Light
    swModel.SetLightSourcePropertyValuesVB "Ambient", 1, 0, 16777215, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.45, 0, 0, False
    swModel.LockLightToModel 0, True
    
    'Direction1 Light
    swModel.SetLightSourcePropertyValuesVB "Directional-1", 4, 0.4, 16777215, 1, -0.0415, 0.0436, 0.0135, 0, 0, 0, 0, 0, 0, 0, 0.1, 0.3, 0, False
    swModel.LockLightToModel 1, True
    
    'Direction2 Light
    swModel.SetLightSourcePropertyValuesVB "Directional-2", 4, 0.3, 16777215, 1, -0.0211, 0.0378, -0.044, 0, 0, 0, 0, 0, 0, 0, 0.1, 0.3, 0, False
    swModel.LockLightToModel 2, True
    
    'Direction3 Light
    swModel.SetLightSourcePropertyValuesVB "Directional-3", 4, 0.3, 16777215, 1, 7.1, 7.1, 4.35E-16, 0, 0, 0, 0, 0, 0, 0, 0.1, 0.3, 0, False
    swModel.LockLightToModel 3, True
        
    swModel.Extension.FinishRecordingUndoObject2 "Update Scene Lights", False
    
    swModel.GraphicsRedraw
    swModel.ForceRebuild3 True

End Sub
Edit: Credit to Deepak from quite a while ago

Re: Getting colors to appear realistically

Posted: Fri Aug 25, 2023 1:11 pm
by Mike Gera
JSculley wrote: Thu Apr 27, 2023 11:00 am Turn off the directional lights, set the Scene to 'Plain White' and set the Ambient light 'Ambient' value to 1. If you do that, what's on the screen will match the RGB values of the appearance:

image.png
That improves the color match, but then there's almost nothing left in the way of contrast. Everything in the part or assembly melts together.

Re: Getting colors to appear realistically

Posted: Fri Aug 25, 2023 1:46 pm
by SPerman
After reading this, I followed JSculley's recommendation, but I have the Ambient set to .75. I find that to be a nice balance.

Re: Getting colors to appear realistically

Posted: Fri Aug 25, 2023 2:48 pm
by Mike Gera
SPerman wrote: Fri Aug 25, 2023 1:46 pm After reading this, I followed JSculley's recommendation, but I have the Ambient set to .75. I find that to be a nice balance.
I tried ambient = 0.75, but everything still looks washed out.