problem with transparency. pls help me!
Hmmmm, eternal problems with transparency ...
I have this problem:
--------------------
I have the room where is two window (only transparent objects). If I look (from outside) through window no. 1 -> I see window no. 2. All is OK, cause I can see objects placed beyond both windows. But if I look from another side - through window no. 2 - I don''t see anything !!! (transparency fails).
--------------------
While I understand this problem it relates with DEPTH testing. In this case is DEPTH testing enabled. If I disable DEPTH testing and use some glBlendFunc - it works ( objects are fully transparent ). B u t the windows are drawn above all objects in framebuffer, even if they are somewhere behind of all objects. (note transparent objects I draw as a last)
Is anybody who know this problem and can give me some advice how to draw FULLY transparent and non-transparent objects together?
The order you draw things in matters a lot. Just draw all transparent objects last starting with the one farthest from the camera ending with the closest. This will blend it with everything drawn before correctly.
Hmm. It is not so simple as you seems. So e.g. how can I detect the distance of the objects from camera? I know, I know ... it is possible to compute (but what if these transparent objects will overlay?), but then the OpenGL losts the meaning. I try to find something, some trick with GL functions (right parameters, disabling, enabling, ...)
January 16, 2003 12:46 AM
I am not sure if this helps, but have you tried disabling depth test right before where you want to draw the transparent object and then enable it right after that?
For example:
glDisable(GL_DEPTH_TEST);
// Code for drawing transparent object
glEnable(GL_DEPTH_TEST);
NOTE: This is the proper way to do transparency, but if you are only looking for a quick fix, give this a try.
For example:
glDisable(GL_DEPTH_TEST);
// Code for drawing transparent object
glEnable(GL_DEPTH_TEST);
NOTE: This is the proper way to do transparency, but if you are only looking for a quick fix, give this a try.
1) draw your solid geomerty (not transparent)
2) disable depth writes (not whole depth test, just writes.. )
3) sort transparent triangles back to front
4) draw transparent gegometry
5) enable depth writes
note : you can skip point 4 if you use one,one blending mode
You should never let your fears become the boundaries of your dreams.
2) disable depth writes (not whole depth test, just writes.. )
3) sort transparent triangles back to front
4) draw transparent gegometry
5) enable depth writes
note : you can skip point 4 if you use one,one blending mode
You should never let your fears become the boundaries of your dreams.
You should never let your fears become the boundaries of your dreams.
Ok _DarkWing_, but how to sort the polygons easy and fast??? Cause it is really not simply. For example, if one polygon laps another one. Then I cannot decide which is more closely. And then there is a problem with rotation of scene.
????
So,
1) how to sort polygons?
2) how disable DEPTH_TEST for writing only?
[edited by - ivanzigo on January 16, 2003 6:33:04 AM]
????
So,
1) how to sort polygons?
2) how disable DEPTH_TEST for writing only?
[edited by - ivanzigo on January 16, 2003 6:33:04 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement