Skip to main content
gamedev.net
🔒 Locked

transparency question

Started by whitedragon101 2 replies 400+ views
Original Post
whitedragon101
whitedragon101
I have tried a couple of blending tutorials for making 3D objects transparent. The main problem is when I try it with a large number of cubes in line (mostly red in colour) the colour becomes white. Is there any way around this?
Silverclaw
Silverclaw
Experiment with different blending equations (glBlendFunc). You problably have a adding equation "GL_ADD" or something like that. Try other equations to achieve better results. Also, consult the Red Book for available constants.
Education is the progressive discovery of our own ignorance.
whitedragon101
whitedragon101
My current equation is:

glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

which works for a small amount of objects, but once I start to rack up the number of cubes the cumulative colour becomes white.
Silverclaw
Silverclaw
Replace GL_ONE_MINUS_SRC_ALPHA with

GL_ZERO; GL_ONE; GL_SRC_COLOR; GL_ONE_MINUS_SRC_COLOR; GL_SRC_ALPHA; GL_ONE_MINUS_SRC_ALPHA; GL_DST_ALPHA; GL_ONE_MINUS_DST_ALPHA

Now try with these different constants and see what results come out. Again check the redbook on Blending or the OpenGL programming guide.
Education is the progressive discovery of our own ignorance.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.