Material's setTwoside method not working with directx?


Materials have two other methods that have not been covered yet, setLocal(bool) and setTwoside(bool). The former controls whether to use camera-relative specular highlights or orthogonal specular highlights. This should be set to True unless an orthogonal projection camera is in use. The latter controls if lighting should appear on both sides of a polygon. Both these methods have equivalent get methods.

Using NodePath’s setTwoSided in conjunction with Material’s setTwoside works correctly when rendering with opengl, however, when using directx, setting the material with setTwoside does not seem to work. Any ideas? Is this a bug or am I missing something?

It is indeed not implemented. I also don’t see a way to enable this in the Direct3D9 documentation:

It may be that this is not supported in the fixed-function pipeline in D3D9. (If there is a way, I am happy to add it.) You could enable the shader generator instead.

Thanks, do you mind expanding on this a little? I’m not sure exactly what you mean here.

Information on the shader generator can be found here.

The TL;DR is add this to your ShowBase init:

1 Like