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

J.P. Delport jpdelport at csir.co.za
Mon Mar 9 23:55:44 PDT 2009


Hi,

Jean-Sébastien Guay wrote:
> Hi Jim,
> 
>> 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.
> 
> OK, but I'm talking about a pre-render pass to an FBO though. The FBO is 
> attached to an RGBA texture, and we want to be able to store some data 
> in the alpha channel... So we want what we write to gl_FragColor.a to 
> make it into the texture directly. Is there a way to do that?
 >
 > (in effect, we want to be able to write to 4 floats per fragment)

Yes, this is definitely possible, but why stop at 4 :).

Have a look at the osgstereomatch example and its shaders. Have a look 
in the readme at the section "Multiple Pass", there we want to simply 
store 16 values into 4 textures (MRT) during the subtract pass. In this 
case the alpha channel behaves exactly as the RGB channels.

Also investigate the use of gl_FragData versus gl_FragColor for writing 
unclipped values.

rgds
jp

> 
> Thanks,
> 
> J-S



-- 
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.

This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their support.




More information about the osg-users mailing list