Rendering scene with only transparent objects


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?


maybe you can get away with turning off depth buffering or depth testing when you draw. Might help you in this case.

The “hack” you mention only works in the case where you have non-overlapping translucent polys.

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.