• Create Account

## Transparency?

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

3 replies to this topic

### #1mkaltner  Members

122
Like
Likes
Like

Posted 06 September 2001 - 06:26 AM

Well, I''ve been reading through the OpenGL Game Programming book and I noticed that it doesn''t talk much about 2D (or 3D for that matter) transparency. It states that there are several blend functions and to use each of them to find new effects. It also states that transparency is the result of subtacting the source from the destination (or vice versa?) polygons but what exactly are they? Is the source polygon the first one drawn? It seems to me that the first one would be the source and the second the destination but an explanation would be nice... And this kind of thing happens a few places in the book really, somewhat annoying. Don''t just say, "Do this and you''ll get this result" without explaining exactly why... Well anyway, back to my question. Anyway able to explain this transparency thing a little better? - Mike

### #2Seaman  Members

122
Like
Likes
Like

Posted 06 September 2001 - 09:37 AM

oki, its quite simple really.
source is the incomming fragment ( ie the pixel that is about to be drawn to the framebuffer), and destination is the fragment that is allready there (ie the current value of the pixel at the location of the incomming pixel about to be drawn in the frame buffer).
The actual blend equation used by openGL is: -
Red(source)*Source(RedFactor) + Red(dest)*Dest(RedFactor)
and so on for the other channels.
The params to glBlendFunction, set what is used for the source(RedFactor) and dest(redFactor),( and obviouly the factors for the other channels). Simple example, glBlendFunc(GL_ZERO,GL_ONE) would be like this: -
Red(source)*0 + Red(dest)*1.
Also if your implementation supports it you can change the above equation by calling glBlendEquation(), this is part of the openGL 1.2 imaging subset so you may have to call it in extension styleeee.
hope thats of some use.

### #3 Anonymous Poster_Anonymous Poster_*   Guests

Likes

Posted 06 September 2001 - 09:55 AM

i thnk its time for nehe.gamedev.net!

### #4zedzeek  Members

528
Like
Likes
Like

Posted 06 September 2001 - 11:02 AM

check my site theres a demo that lets u play around with the blending methods + shows the math behind it

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.