PDA

View Full Version : Transparency - depth test in 3D



08-01-2002, 08:06 AM
Hello
I got in a little rendering pb..

I have 3 3d objects that are transparent and, depending on your rotation, can superposed.

So How to get rid of the effect resulting in the drawing order ? depending of your view no other object is drawn behind the first you draw (which is transparent).


So I don't get a uniform transparent behavior.
In the red book they talk about glDepthMask() when you have a fully opaque object and a transparent one but what about several 3d transparent objects ?

Thanks for your help

Paul

Miguel_dup1
08-01-2002, 09:21 AM
Originally posted by paul32:

In the red book they talk about glDepthMask() when you have a fully opaque object and a transparent one but what about several 3d transparent objects ?


Why dont you try it and see if it works?

08-01-2002, 09:29 AM
Originally posted by mancha:
Why dont you try it and see if it works?
Because ALL my objects are transparent. The trick in the red book works because the first object you draw in opaque. In my case it is transparent so when the first object drawn is in front of another transparent object all part of objects that I should see behind the first object are not drawn..

That is why the red book solution doesn't work for multiple transparent 3d objects

Paul

Jan
08-01-2002, 10:03 AM
Your problem is an advanced one. The only real solution is to draw the objects from back to front, meaning to draw the objects that are far away first and the nearest last.
Real engines do this usually with BSP-Trees (Binary Space Partitioning Trees). If you are interessted in this topic do a search in google.
However BSP-Trees are a bit work to implement.
Maybe your program doesnīt need a very complex solution. Maybe you can just take your objects and calculate their center-points. When you draw them you calculate the distance of the camera to the center-points and then draw them in back-to-front order.
As far as i know there is also an extension that allows to draw blended objects in any order. I donīt know how it is called and i think this extension is not implemented in many drivers, so you certainly wonīt want to use it. Anyway, this is the link to SGIs extension-registry: http://oss.sgi.com/projects/ogl-sample/registry/ .

Jan.

08-01-2002, 10:06 AM
Originally posted by Jan2000:
Your problem is an advanced one. The only real solution is to draw the objects from back to front, meaning to draw the objects that are far away first and the nearest last.
Real engines do this usually with BSP-Trees (Binary Space Partitioning Trees). If you are interessted in this topic do a search in google.
However BSP-Trees are a bit work to implement.
Maybe your program doesnīt need a very complex solution. Maybe you can just take your objects and calculate their center-points. When you draw them you calculate the distance of the camera to the center-points and then draw them in back-to-front order.
As far as i know there is also an extension that allows to draw blended objects in any order. I donīt know how it is called and i think this extension is not implemented in many drivers, so you certainly wonīt want to use it. Anyway, this is the link to SGIs extension-registry: http://oss.sgi.com/projects/ogl-sample/registry/ .

Jan.

THank you Jan.

DFrey
08-01-2002, 10:11 AM
This has been discussed many times on the forum. You simply need to sort your triangles, and draw them from far to near. If the objects are allowed to penetrate one another, then you would also need to split some triangles in order to get the correct rendered scene. However, if you have a highend video card, like a fast GeForce 3 or Geforce 4 Ti, then there is a document available on the nvidia developer web page that descibes how to draw transparent objects without sorting.

fringe
08-02-2002, 02:13 AM
Hi All,

Along the same lines of this questrion (and maybe a partial answer) could you not just draw all your non-transparent objects. Turn off writting to depth buffer then draw all the clear objects (read this somewhere else). If all the objects have the same transparency (and colour?) it doesn't matter which you draw first since the effect of drawing any of them is the same?

fringe