PDA

View Full Version : Rendering scene with only transparent objects



BGM
09-20-2004, 08:10 PM
Hi,

To rendering a scene using OpenGl with only transparent objects the method i use is :
- Set up alpha values for transparent objects.
- Enable blending.
- Render transparent objects back-to-front.

This works fine if we have well-defined objects.
Eg. camera Obj1 Obj2 Obj3 Obj4
where obj(1-4) are all transparent(say spheres) and rendered in the order 4,3,2,1.

But this method wont work if we have transparent objects overlapping with each other.
This would happen only in case of rendering complex surfaces.(say using TRIANGLE FANS)
Thus, if we had 2 transparent surfaces (using TRI-Fans) overlapping each other , rendering each triangle back to front will be computation intensive.

Is there a solution for achieving true transpareny in this case?

-BGM

147-2
09-21-2004, 07:14 PM
maybe you can get away with turning off depth buffering or depth testing when you draw. Might help you in this case.

BGM
09-22-2004, 02:39 AM
The "hack" you mention only works in the case where you have non-overlapping translucent polys.

ZbuffeR
09-22-2004, 12:16 PM
General transparency is hard to perform correctly.

The only case which does not need sorting nor depth testing is additive transparency (ie gl_one gl_one and such). This is (was) the most frequent mode in games, should be restricted the flames and such but is often found for dust, fog, even glass.

Other cases would need real sorting to be correct. For self-intersecting geometry, it is a problem.