Hi Antiro,> 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?

If you're using multiple passes the first pass needs to clear the buffer and all consecutive passes need to simply blend into it. Did you enable blending in the camera state set?


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
So you're not doing deferred lighting? Usually one does blend all the lighting contributions to one texture by rendering all lights as boxes, spheres etc to limit the area in the lighting texture the light can contribute to using viewspace-calculations. There are tons of papers and blogs on how to do this.

Each light therefore is rendered in the same camera adding its contribution by simply rendering its hull-volume and carrying the light information in a bunch of uniforms per light. Since you have the depth-buffer (and therefore the viewspace/worldspace geometry coordiantes per fragment) you can calculate the light-geometry distance per fragment and therefore the light contribution.


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!

Again: Try to create a minimal example! It's rather tedious to pull information out of someone's head in order to get the possible problems.

Cheers
Sebastian


Thank you!

Cheers,
antiro[/code]

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





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

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

Reply via email to