On 5/19/2011 2:07 PM, Wojciech Lewandowski wrote:
[..] So the main pass is done (culled) before the shadow pass. I can
understand that the bounds calculation needs to cull the shadow receiving
scene first, or else we won't know where the shadow map should lie. However, I
wonder how this even works.

Culling order does not need to be the same as Rendering order. Rendering order
is defined by PRE_RENDER / POST_RENDER / NESTED_RENDER camera flag. Cull visitor
on the other hand simply traverses the scene tree in first encountered/first
processed order.

If you have multiple sibling Cameras with the same render order, their draw order is determined by their order in the scene graph (or by the CullVisitor, in other words).

The CullVisitor is assembling a graph of RenderBins. RenderStage derives from RenderBin. Each Camera keeps a cache of RenderStages indexed by CullVisitor address. Every time the CullVisitor encounters a Camera node (and the order isn't NESTED_RENDER), it inserts the Camera's RenderStage for that CullVisitor into the render graph.

Your Viewer object and/or SceneView has an implicit root Camera, and its corresponding RenderStage is the root node of the render graph. If that root Camera has two PRE_RENDER Camera children, child 0 and child 1, then the child 0 Camera RenderStage gets added to the root Camera RenderStage's list of pre-render stages first, and the child 1 Camera RenderStage goes into that list second. During draw, RenderStage::draw() is called on the list of pre-render stages in the order they appear in the list -- in this case, the same order they were encountered by the CullVisitor.

All of the root Camera RenderStage's pre-render children are drawn before ::draw() gets called on the root Camera RenderStage.

I hope that helps.
   -Paul

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to