Hi Bram,

There is nothing weird about what you are seeing given what you're doing.
Blending with MRT ist always applied to all bound render targets of the framebuffer object. If you want to blend only a single buffer, then do a separate pass, where you blend it. In case you want to apply different blend functions to different FBO attachments you cat take a look at:
http://www.opengl.org/registry/specs/EXT/draw_buffers2.txt
This extension would actually allow to blend only a single attachment.
I've asked for support on the mailing list how to use it/integrate into OSG. Unfortunately without any response.

But it is undefined behaviour not writing all attached buffers, as you do in your description.
So If there is something like

gl_FragData[3] = vec4(0,1,0,1);

without any

gl_FragData[0] .. gl_FragData[2]

then you shader is invalid (yet syntactically correct)


cheers
Sebastian
Hi,

I ran into something weird, or something that I don't know how it works exactly.

What I want to do when rendering to multiple targets is that I selectively 
write to certain color buffers in my shader, but leave others alone.
for example


Code:
gl_FragData[3] = vec4(0,1,0,1);



without setting the fragment data for the first 3 buffers...

This doesn't seem to go well. for example, if I don't explicity set a value in 
the color buffer 4, it seems to copy the color value from the first color 
buffer for some reason instead of leaving it alone.

So I though: ok I HAVE to explicitly set all a value on all used color buffers, 
so then if I don't want to touch one of the buffers, I just use blending and I 
write a value with an alpha of 0, so it doesn't effect the buffer. This doesn't 
work as expected.

It seems that the blending only looks at the color buffer 0 ? if I write a some 
color-value with an alpha of 0 to the color buffer 0, it doesn't seem to matter 
what I write to the other buffers, it doesn't write anything.

So not sure if you can follow what I'm explaining, but bottom line is: I would 
like to selectively write to certain color buffers in my shaders, and leave the 
other alone. Any ideas on how to do that properly? Or am I trying something 
impossible and do I need another solution?


Thank you!

Cheers,
Bram

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





_______________________________________________
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