I’m struggling to override the shader state of a leaf node, it seems it keeps using the shader set on the parent node even with an explicit configuration.
I have a root node path on which a custom shader is configured using
root_np.setShader(my_custom_shader)
but without any geometry
Attached to this root node I have several children node with the actual geometry, using the shader set on the parent, so far so good.
But, for debugging purpose, I need to add another node under the root node that does not use the configured shader but instead the fixed pipeline, or the autogenerated shader, it’s only to render the debug geom with a flat color.
If I try to use RenderState.make()
to override the shader used, it won’t work and still uses the parent’s shader :
sa = ShaderAttrib.make()
sa.set_shader_auto(True, 10000)
state = RenderState.make(ColorAttrib.make_flat(LColor(0, 1.0, 0, 1.0)), sa)
np.node().set_state(state)
On the other hand, if I simple use np.set_shader_auto(True)
it just works, what does set_shader_auto() do more ?