How to get object display color on default layer?

Dear openNurbs expert,

I posted similar post on Rhino forum asking why default layer color does not render on face.

I got the answer that it might be a trick of Rhino.
So I wonder if it is possible that openNurbs SDK tells me the true RGB value of object on default layer.
Currently, I get RGB0,0,0 for object on default layer, while they look gray.
Can openNurbs SDK return the gray RGB instead?

Thank you,
Ping

I think that it has to do with the Material assigned to a layer. In Rendered display mode, the color of the layer is not used, but the material is used to create a rendering.

By default, all layers have a “white” material assigned to them that only looks gray because the emission color in the material definition is black.

If I understand correct, you launch Rhino and you draw some kind of surface on the “Default” layer (whose layer color is black). Then you Shade one of the viewports and now the surface appears gray, not black. Is this correct?

You might be surprised, but this is by design.

In order to make Shaded mode a better working mode for users, we clamp color ranges. For example, you cannot set a layer’s color to white and have objects show up as all white.

What happens when you shade colors at upper and lower ends of the spectrum is that faces blend together, making Shaded display mode not so useful when modeling.

If you want to see exact colors, then assign a color to layer’s material and then set a viewport to Rendered.

Also, objects can get their color from the layer they reside on. Or, the object can override the layer’s color and have it’s own own color. In the SDK, this is referred to as an object’s color source.

If you are using openNURBS and want to get an object’s color, use ONX_Model::WireframeColor.

If you are using openNURBS and want to get an object’s render color, use ONX_Model::GetRenderMaterial. Once you have the material, you can get the diffuse color.

Does this help?

3 Likes

Dale,

Thank you for excellent explanations.
Your understand about this topic is correct.

With your explanation, I could understand that:

  1. This behavior only happens in shade mode, not in render mode.
  2. In shade mode, you cannot see black even you set object color to black.

Since you clamp color ranges, is it possible you tell me that the value I get from toolkit was not used?
Or you just let me know the gray color RGB I see in Rhino.
All these requests are to meet WYSIWYG in our application.

Thank you for your quickly response and detailed explanations.

Ping

Just curious, why do you need this? What problem are you trying to solve?

@jeff, can you chime in here?

There is really no other clamping of colors going on other than what Dale mentions here… In Shaded mode, Rhino will convert pure black (RGB(0,0,0)) to white (RGB(255,255,255)) because the default behavior for Shaded mode is to also display the isocurves. Showing black isocurves on black shaded surfaces was a problem/complaint made over a decade ago (almost 2)…so the surface color is modified in order to see the isocurves.

However, if you actually set the color of your object to something that’s close to black (RGB(1,1,1)), then you will essentially get black shaded surfaces with black isocurves. So basically Rhino flips the shaded color if it’s pure black simply because the default behavior made it hard to see certain features… There is no other color modifications or clamping going on with any other colors in Rhino.

HTH
-Jeff