blending not quite working ...

Started by
2 comments, last by burnseh 22 years, 6 months ago
hello, I''m having some trouble with blending. Transparent objects don''t show up quite right when theres an opaque object behind it. Best way to describe this is to show you.. heres an exe i uploaded: http://www.postmodernist.com/richard/SolarSystem001.rar Currently, the objects are drawn in the following order: 1. the earth (opaque) 2. earth''s clouds (alpha = 0.7) 3. earth''s atmosphere (alpha = 0.5) 4. earth''s moon (opaque) 5. the sun thanks for any help, rich
Advertisement
From what I've done with this subject, is that when doing blending of different 3D objects, you need to disable the depth mask when drawing the blended object.

Something like:

// draw non-blended objects here

glEnable(GL_BLEND);
glDepthMask(GL_FALSE);

glBlendFunc(GL_SRC_ALPHA, GL_ONE);

// draw blended object here

glDepthMask(GL_TRUE);
glDisable(GL_BLEND);

Play around with that and see if you can get what you want.

- Mike

P.S. I didn't download the program (rar format is not popular, use zip) so this may not be correct.

EDIT: typo

Edited by - mkaltner on November 8, 2001 7:01:30 PM
"The important thing to remember when programming is: When you're 90% complete, there's still 50% more to go."
thanks for the reply

I tried the depthmask true/false and it works. I was using it already but in the wrong way.

much appreciated


btw, uploaded as .zip, use down arrow to move back a bit so you can see the sun
and the fixed exe ... (textures are in zip)

http://www.postmodernist.com/richard/SolarSystem.exe

This topic is closed to new replies.

Advertisement