[osg-users] RTT With Background Alpha

J.P. Delport jpdelport at csir.co.za
Tue Apr 12 00:04:53 PDT 2011


Hi,

On 11/04/11 23:03, Dan West wrote:
> Thanks for the link JP. I didn't see anything drastically different
> in what you were doing, so I started fiddling around with a bunch of
> the different parameters that MAY have something to do with the
> issue.
>
> After no success there, I realized what I needed was an osg::TexEnv.
> I created a TexEnv with the DECAL mode and the black background (that
> should have been transparent) became transparent as I envisioned.
>
> The table about halfway down this page
> (http://www.opengl.org/sdk/docs/man/xhtml/glTexEnv.xml) helped me
> understand what was happening. I'm not sure what 'TexEnv' is used if
> one isn't set, but it appears the same as when a MODULATE TexEnv is
> used. GL_MODULATE multiplies the existing and incoming alpha values,
> losing the transparency (even though I would think the alpha would
> stay at zero - zero times something is still zero, right??).
yes, osg defaults to modulate. I think modulate just multiplies the 
colour vectors, it's not like blending equations.

>
> Anyhow, you can try adding the following lines to the osgprerender
> example if you're interested in what I was going for:
>
> Code: osg::TexEnv* texenv = new osg::TexEnv( osg::TexEnv::DECAL );
> stateset->setTextureAttributeAndModes( 1, texenv );
>
>
>
> The only thing remaining that I'd like to do is to have the alpha
> from newer texture renders 'darken' the existing alpha. If you
> remember, I disabled clearing the color buffer, so I'd like my
> overlay to darken if there are repeated passes over a particular area
> of the texture (I'm only using solid colors, so it would look a bit
> better than it would with the cessna 8) ).
>
> Is this possible using the color buffer as I am, or would I have to
> implement a shader to get this to work?

I'd recommend going the shader route. I've recently done some work on 
projective texturing and the shader was much less effort than trying to 
bend the fixed function pipeline to what I wanted.

rgds
jp

>
> Thanks for the help guys! ~ talyn
>
> ------------------ Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=38412#38412
>
>
>
>
>
> _______________________________________________ osg-users mailing
> list osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>

-- 
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