PDA

View Full Version : Regional Transparency



the_black_damon
12-02-2003, 11:00 AM
Is there a way to achieve transparency in a specified region of the screen other than using overlay planes. I am looking for an alternative due to the rumored spotty hardware support for overlays. Any help suggestions would be greatly appreciated.

Thanks

ScottManDeath
12-02-2003, 12:50 PM
maybe using the alpha test and proper texure values/color values?

what are you going to do?

the_black_damon
12-02-2003, 07:27 PM
Sorry to be so vague. I am rendering 3D models over an animated 2D background and I need to be able so specify a tranparency value for a region of the screen (as opposed to transparency tied to either the individual models or backgrounds).

Thanks,

Damon

heppe
12-02-2003, 07:42 PM
hardware support for overlays is indeed spotty (e.g. Radeons have none at all).

3d models on 2d backgrounds... so what's keeping you from doing normal alpha blending?

ScottManDeath
12-02-2003, 08:28 PM
-render to the alpha buffer where you wish to have transparency and enable blending and us glBlendFuncSeparate(GL_ZERO,GL_ONE,GL_ONE,GL_ZERO) ;this copies just the alpha part of the incoming geometry to the framebuffer and leaves the rgb values untouched. of course you need GL 1.4 headers and a decent video card for top performance
-alternantively cou can render clear alpha to 0.0, render you 2d stuff and then black geometry with proper alpha and use glBlendEquation(GL_ADD); to update just the alpha channel

-when rendering the 3d models enable blending and us glBlendFunc(GL_DST_ALPHA,GL_ONE_MINUS_DST_ALPHA);
-pay attention to backfaces!

[This message has been edited by ScottManDeath (edited 12-02-2003).]

heppe
12-04-2003, 06:29 AM
There's also glColorMask, which could be useful here (e.g. with args false,false,false,true).

(why do I have images of kids playing duck duck goose running through my head?)

ScottManDeath
12-04-2003, 08:40 AM
why to do it simple, when there is also a complicated solution http://www.opengl.org/discussion_boards/ubb/biggrin.gif