I’m trying to access the auto shader text created in Panda3D. I have different models with the shader effects coded on model as I showed here: discourse.panda3d.org/viewtopic … t=cookbook
self.model.getState() doesn’t necessarily return the render state of self.model; it just returns the render attribs applied directly to that particular node. The full render state is actually the composition of all render attribs applied from the root of the scene graph down to each particular Geom within self.model.
Most of the actual state that you see on a renderable model is actually stored on each particular Geom, but for the record, you can get the complete state for each Geom with something like this:
for gnode in self.model.findAllMatches("**/+GeomNode"):
# Net state from render to gnode
nstate = gnode.getNetState()
for gstate in gnode.node().getGeomStates():
# Net state to geom x
state = nstate.compose(gstate)
print state
shader = sg.synthesizeShader(state).getShader()
text = shader.getText()
print text
Uh, oh. I don’t think it is possible in 1.7.0, besides through the use of the “dump-generated-shaders” config variable.
It’s because the fundamental design of the Shader Generator has changed. It no longer generates a shader for every render state, but for every combination of graphics state guardian and render state. This is to allow for example shadow mapping.