Hi, I'm currently having a problem in understanding, when the PreDrawCallback and PostDrawCallback of a camera are called. I'm working on a project where Virtual Texturing and Depth Peeling is used.
For Virtual Texturing the following steps are necessary: 1. Render whole scene with special texture id shader to a texture 2. Call PostDrawCallback that reads this texture and creates a list of all necessary texture ids 3. Call PreDrawCallback that loads all necessary textures 4. Render scene with virtual texturing shader Depth Peeling is done in the following way: 1. Render opaque geometry to textures(color and depth buffer) 2. Render transparent geometry to textures(color and depth buffer), discard fragments that have a higher depth, than the opaque geometry 3. Render transparent geometry to textures(color and depth buffer), discard fragments that have a higher depth, than the opaque geometry, or a lower depth, than the last transparent pass 4. repeat 3 for each peeling pass 5. Combine opaque and transparent layers by rendering full screen quads with alpha blending turned on The virtual texturing works perfectly fine if depth peeling is turned off. But if I use depth peeling, the Pre- and PostDrawCallbacks are only called once for the last peeling pass. So I only get the necessary textures for the last peeled layer. What I want to do is that these callbacks are called for each peeling pass. The scene graph for virtual texturing looks like this: osg::Group ->osg::Camera (prepass for determination of necessary textures) -->osg::Group (the scene with geometry etc.) ->osg::Group (same scene as above, this time to draw it on screen) And the scene Graph for the depth peeling looks like this: osg::Group ->osg::Camera (opaque pass) -->osg::Group (the virtual texturing scene graph) ->osg::Camera (first transparent pass) -->osg::Group (the virtual texturing scene graph again) ... ->osg::Camera (last transparent pass) -->osg::Group (the virtual texturing scene graph again) ->osg::Camera (combination pass) -->osg::Geode (quad for oqaque pass) -->osg::Geode (quad for last transparent pass) ... -->osg::Geode (quad for first transparent pass) I'm reusing the virtual texturing scene graph without copying it, when adding it to the depth peeling cameras. When stepping through the code I see the following behavior: The virtual texturing scene graph gets culled several times as expected(one time for each peeling pass), but the draw callbacks are only called once. Is there a mechanism in osg that prevents a camera to be drawn more than once per frame, as some sort of optimization? Or is this a bug? A workaround seems to be to deep copy the virtual texturing scene graph, but thats not really what I want to do, because it wastes a lot of memory. Is there some other solution? I would be glad if you could help me. Thank you! Cheers, Marcel ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=54106#54106 _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

