PDA

View Full Version : Transparency bleed through



dlswimmer
04-06-2004, 08:24 AM
I am having issues with my transparency in the beginning of a game. What I have done right now is more of a walkthrough maze than anything. I have a slightly transparent cylinder at the start and the finish and it bleeds through the walls. I was wondering how I can fix that. If anyone has a few minutes, could you please look at this and tell me how to fix it.
The code is at http://people.clemson.edu/~rlieber/lesson6.cpp
The data for the code is in the directory http://people.clemson.edu/~rlieber/data/
The data needs to be in the data folder for it to work. The executable for the program is at http://people.clemson.edu/~rlieber/lesson6.exe
Thank you very much for any help. If anyone has anything else to offer, like anything I can do to speed up rendering slightly I will be greatly appreciated. Thanks again

endash
04-06-2004, 11:38 AM
Could you just post a screenshot?

dlswimmer
04-06-2004, 02:52 PM
The two cylinders are at the start and finish of the maze. They are just preliminary graphics which will be turned into animations later. The first one is at the start, then second is a picture from the start looking in the direction of the finish. The cylinder is bleeding through all the opaque walls.
Image 1
http://people.clemson.edu/~rlieber/screen1.jpg
Image 2
http://people.clemson.edu/~rlieber/screen2.jpg

dlswimmer
04-06-2004, 02:54 PM
The server isn't working at the moment, but should be back up shortly. I posted two screenshots and my code and such is up there as well.

chowe6685
04-06-2004, 04:39 PM
it looks like you are disabling depth testing when you draw the transparent objects. A better idea is to disable depth writes ie
glDepthMask(GL_FALSE);
and leave depth testing enabled

dlswimmer
04-06-2004, 04:41 PM
do I set the depth mask back to true wehn I am done?

dlswimmer
04-06-2004, 04:51 PM
this is what happens now with the cylinder. I did the GLDepthMask and it did stop the bleed through, but it now does this. I also have one more issue, when in the middle of the cylinder, the blue tint is not shown and I was wondering why. Thanks again

chowe6685
04-06-2004, 05:04 PM
do you have backface culling enabled?

dlswimmer
04-07-2004, 05:15 AM
I guess I never posted the picture, here it is

http://people.clemson.edu/~rlieber/screen3.jpg

I did fix both of my problems by rendering the transparent cylinder after everything else, but was wondering if there was a way to fix it without doing that? Thanks

ZbuffeR
04-07-2004, 12:40 PM
Maybe something like this :

drawSomeStuf()
glDepthMask(GL_FALSE);
drawBlueTransparentCylinder();
glDepthMask(GL_TRUE);
drawSomeOtherStuf()

chowe6685
04-07-2004, 01:06 PM
the way you are doing things you must draw the cylindar last.
What is happening is this. The disabling of the depth mask means that the cylinder is not writing the depth buffer, which is what you want, otherwise if one was immediately behind the other it would not be drawn. However, because of this if you draw the maze after the cylinders there is a chance that a wall behind the cylinder will be drawn on top of it. There are two solutions to this problem. The first is a hack and what I suggested before, disable the depth mask but draw all transparent objects after the opaque geometry. Second draw everything in back to front order. Depending on how you store your level this is usually quite difficult. I would recommend just drawing the cylinders after everything else.