Hi Paul,
On the other hand, if the render order number is *also* the same...
Thanks for going over the basics again for me, I knew all that but for
some reason had completely forgotten about the render order number
(_renderOrderNum)...
So yeah, the RenderStages are ordered in order of _renderOrder
(PRE_RENDER before NESTED_RENDER before POST_RENDER), if 2 cameras have
the same _renderOrder they are ordered by _renderOrderNum, and if they
have the same _renderOrder AND _renderOrderNum they are ordered in the
order they were traversed by the CullVisitor (their order in the graph).
That explains both why the shadow pass renders before the main pass in
StandardShadowMap::ViewData::cull(), and why I was getting the results I
was getting for the shadows in the refraction, as Wojtek said:
cullShadowReceivingScene() (main pass camera is POST_RENDER #0)
.. eventually goes into OceanScene::traverse()
.. eventually culls refraction camera (PRE_RENDER #0)
cullShadowCastingScene() (shadow pass camera is PRE_RENDER #0)
So the order of rendering of the cameras (or RenderStages to be more
correct) was:
refraction (PRE_RENDER #0 traversed before shadow pass camera)
shadow pass (PRE_RENDER #0 traversed after refraction camera)
main pass (POST_RENDER #0)
which explains why the refraction was using the shadow map from the
previous frame, the shadow map for this frame wasn't rendered yet.
I knew the error was ordering of the passes, I just didn't know why the
order was wrong. So I'm explaining this as much for myself as for others.
Now I've set the refraction pass _renderOrderNum to 1 (it could be any
number > 0 so it occurs after the shadow pass) and everything is fine.
Thanks Wojtek and Paul for reminding me of lots of little things, and
filling in gaps in my knowledge, thanks to you I was able to fix this
bug and my users are happy once again :-)
J-S
--
______________________________________________________
Jean-Sebastien Guay [email protected]
http://www.cm-labs.com/
http://whitestar02.dyndns-web.com/
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org