Per display region camera states?

Currently, it’s possible to associate multiple display regions (rendering to different buffers) with one camera. This saves some cull-traversal processing. But is it possible to associate a different camera state with each display region?

In my specific application, I would like to do a Z-pre-pass. To do this, I create a parasite buffer with a negative sort and associate the p-buffer’s display region with base.cam. (base.cam is also responsible for regular rendering into base.win with per-object shaders.) However, to perform the pre-pass, I need do turn off all of the per-object shaders with something like

tempnode = NodePath("temp node")
if self.booDX:
    tempnode.setShader( self.shaderDxDepthEncoder, 999 )
else:
    tempnode.setShaderOff(999)
base.cam.node().setInitialState( tempnode.getState() )

Setting an initial state like this however, will prevent base.cam from rendering the main display region corretly.

So is there a way set per display region render states or alternativelly allow two cameras to share the same cull-traversal?

Zhao

No, this is not possible. Since one of the most important tasks that the cull traversal performs is the association of each Geom with its RenderState, it follows that if you share the cull traversal for two different buffers, then both buffers must have exactly the same state. If you want to have a different state, you must have a different cull traversal.

David