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

Jean-Sébastien Guay jean-sebastien.guay at cm-labs.com
Mon Mar 9 06:59:08 PDT 2009


Hi Jim,

> .....................
> // activate blending to be able to write to gl_FragColor.a
> stateset->setMode(GL_BLEND, osg::StateAttribute::ON);
> ......................
> 
> No, this comment has a misunderstanding.
> 
> Writing to gl_FragColor.a in the fragment shader does work of course
> but it isn't the final RGBA value as the pipeline has
> a hardware stage AFTER the fragment shader.

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?

We were working under that assumption. 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? (I seem to recall there was a way, but I can't 
remember the specifics).

Thanks,

J-S

-- 
______________________________________________________
Jean-Sebastien Guay    jean-sebastien.guay at cm-labs.com
                                http://www.cm-labs.com/
                         http://whitestar02.webhop.org/



More information about the osg-users mailing list