[osg-users] Can't write to ALPHA component with custom fragment shader in RTT pass

Jim Brooks jimblist at gmail.com
Mon Mar 9 08:58:05 PDT 2009

>I agree that whatever is put in gl_FragColor.a will not be the final
>alpha value in the framebuffer, but at least if we put gl_FragColor.a =
>0.0 then the current fragment shader's output color should be
>transparent, and so anything behind should be completely visible, right?

Not necessarily.  If the object-that-is-supposed-to-be-transparent
still has depth writing enabled, it will overwrite more distant objects.
Then there's which blend functions are enabled which
can alter the output of the fragment shader.

>If not, then is there some other
>way to "kill" a fragment we don't want to show up once we're at the
>fragment shader stage?

GLSL has "discard".

More information about the osg-users mailing list