DisplayMaterial.SetBitmapTexture() and "advanced GPU lighting"

When a Rhino.Display.DisplayMaterial has a bitmap texture (via .SetBitmapTexture()), its display behavior depends on whether advanced GPU lighting is enabled.

The behavior on the left (where GPU lighting is OFF and the material behaves as an emitter) is what I want all the time. Is there a way to enforce this in RhinoCommon?

Hi @sarg,

I can’t check this as I’m away from the computer but how about using the bitmap as the emissive input of the DisplayMaterial and then feeding a Black color into the Diffuse?

SetBitmapTexture() is called on the DisplayMaterial itself. As far as I can tell, there is no way to specify which propert(ies) the texture ought to apply to. The Emission property is settable, but it’s merely a Color. Ideally one would have SetDiffuseTexture() and SetEmissionTexture() methods, to disambiguate.

As an alternative, I’d take being able to toggle “advanced GPU lighting” programmatically. But that’s decidedly less polite, and I don’t see a RhinoCommon hook for it either…

Oh my apologies my brain wanted to see something that wasn’t there :upside_down_face:

https://developer.rhino3d.com/api/rhinocommon/rhino.display.displaymaterial/displaymaterial#(color,color,color,color,double,double)

I somehow thought I saw bitmap for those arguments but yes you appear to be correct.

And yea I can’t find anything for setting the GPU lighting either.

Hmm, I certainly would like to know, hopefully someone else comes along to help

I had the same problem.

In Rhino.DocObjects.Material there is a property DisableLighting. This works for me.
Apparently this corresponds to the ‘Self Illumination’ button in the Materials panel.

Then you will have to construct the DisplayMaterial from this Material.

2 Likes

Nice find @i-Shape! This solved it for me as well.