Regarding transparency and drawing order
Well, I have a plane full of transparent objects, that, at the moment, I''m just drawing in a linear order by array index. Now, what I''d like to have, is for each of them to appear transparent over the others. Unfortunately, only the objects drawn before a particular other object, will appear transparently under it. Would calculating distances for all of them and drawing the highest first/lowest last be the best way to fix this? Or is there some GL_BLEND setting to avoid it?
Mop~
When using standard blending (GL_SRC_ALPHA, GL_SRC_ALPHA_MINUS_ONE, I think, its been a while...) you have to draw polygons in order from farthest to closest, or it will look wrong. The reason is that even though a polygon only has 50% alpha, or whatever value, it looks completely solid in the depth buffer, so nothing will be drawn behind it.
The solutions to this are either drawing polygons from farthest to closest, or using GL_ONE, GL_ONE blending and turning off depth buffer writes (glDepthMask(FALSE)). However, GL_ONE, GL_ONE blending (additive blending) only looks right for "energy" effects such as sparks or explosions. For dust, smoke, etc, you''ll have to use standard blending, and draw from back to front.
Hope this made sense.
The solutions to this are either drawing polygons from farthest to closest, or using GL_ONE, GL_ONE blending and turning off depth buffer writes (glDepthMask(FALSE)). However, GL_ONE, GL_ONE blending (additive blending) only looks right for "energy" effects such as sparks or explosions. For dust, smoke, etc, you''ll have to use standard blending, and draw from back to front.
Hope this made sense.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement