[osg-users] Problem blending multiple render passes

antiro black antiro42 at gmail.com
Sat Sep 9 04:43:20 PDT 2017


Hi Sebastian,

So I screwed up on both the color clearing and the depth writing, I tried to disable both is follows.
On the cameras:

Code:

//Disable depth buffer writing
osg::ref_ptr<osg::Depth> depth = new osg::Depth(osg::Depth::LESS,0,1,false);
camera->getOrCreateStateSet()->setAttribute(depth);

//Disable writing to color buffer
GLbitfield mask = 0;
camera->setClearMask(mask);



The result was that (as expected) the geometry became extremely bright within a few frames (as I had forgotten to clear the output texture in between frames), but unexpectedly still from only a single light source. After I had fixed the texture clearing in between frames the result was the same as before: Only the result of a single lighting pass is visible.
I verified that this is the LAST pass, so it seems like the results of previous passes are overwritten instead of blended?

The reason I am using multiple passes is because I want to support an arbitrary (run time determined) number of light sources. Hence I can not just load a bunch of light sources into the uniforms of a single shader.

If you have any other ideas of why my problems persist (or if I messed up with disabling color clearing/depth writing) please let me know!


Thank you!

Cheers,
antiro[/code]

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=71681#71681







More information about the osg-users mailing list