> Also, Do you setup a blendfunction and activate it for the stateset?

No I didn't. The thing is, I made some other shaders for a volume light, and 
there I just enabled blending and it worked as I expected. And to clarify what 
I mean with that: I thought that normal 'standard' blending involved mixing the 
colors something like this:

mix(source.rgb, dest.rgb, dest.a). so in other words, it would use the rgb in 
the framebuffer and mix the color of the new pixels based on the alpha of the 
new pixel (ignoring the alpha value from the source pixel).


> I don't understand what you mean? Can you point to the blendfunction here?
> There is no simple way to blend onyl gl_FragData[0] without touching the 
> other buffers. 


I guess, now I looked at the blend functions of opengl better (sorry I'm kinda 
new with opengl), that I would like a glBlendFunc(GL_ONE_MINUS_DST_ALPHA, 
GL_DST_ALPHA);

Does that make sense? that matched with I said above right?


> As said before: Blending function is applied to all bound 
> buffers.
> 


what about glBlendFunci, which enabled different blendings per buffer... or is 
that not supported?


> So could try to post your buffer setup and your passes or at least 
> create a minimalistic example showing your problem?
> A little more context on what you are trying to achieve would be helpful too


I will try to post some code tonight if needed, don't have access to it right 
now.

For context: I am rendering terrain with water. the surface of the water is 
partly transparant. for the part underwater I want to use some form of fog 
effect and for the part above water I use some other 3d fog effect. So if the 
camera is above water and look at the water it need to do the following for 
each pixel:
-start with the terrain color (from rendered terrain)
-apply underwater effect
-apply the semi-transparent water-surface pixel (from rendered water)
-apply above water fog effect

So the thing is: I need both the original rendered terrain pixel and also the 
original rendered water-surface pixel.
so that is why I want to render my terrain and my water-surface to two separate 
buffers, so that in the 'final' shader (the deffered one or however you call 
it) I have access to both the rendered water and the rendered terrain under 
that water and calculate the final pixel in a way that I find logical. I 
understand that there might be tons of other ways to do this, but as I'm pretty 
new I hope to do things first in a way which seems logical to me, before doing 
it some other way that is harder to understand for me. But still if you have a 
better idea on how to do what I want I'm open for it :)

Hope I explained this clear enough!

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





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

Reply via email to