I am loading geometry to be rendered using render-to-texture, and applying a CG shader to it. The geometry does have transparent alpha in both the vertex color and the texture, but I am using them for another purpose in the shader, it is not supposed to render transparent. There are a few other objects in the render-to-texture scene that do not have a shader applied.
Now the problem: pstats reports that the majority of the render time for the render-to-texture is being spent on rendering transparent objects. I discovered the problem when i tried to add some particles to the scene and they had some bad transparency issues such as often the geometry behind the particle would not render. Note that the pstats results were before adding any particles, they are not the cause.
The shader explicitly sets the output color to be opaque:
o_color = float4(p_lit.rgb, 1.0);
This is basically how I’m loading it:
node = NodePath('new render')
node.setAntialias(AntialiasAttrib.MNone)
model = loader.loadModel(modelpath)
shader = Shader.load(shaderpath)
model.setShader(shader)
model.reparentTo(node)
I also tried:
model.setDepthWrite(True)
model.clearTransparency()
I must be missing something here, any ideas?