Question

I've been learning OpenGL and 3D graphics for a while and I've come to the well-known problem: transparency, translucency and draw order dependency.

I know about different alpha-blending algorithms: subtractive, which is best, but requires a correct ordering; additive or multiplying, which are order-independent, but provide poor results; disabling z-buffer techniques; and so on.

So, the main conclusion I had learned: there is no magic method to do transparency.

The question is: how transparency is being implemented in modern games? I mean, there deffenetly are transperent objects in them: windows, glasses, etc. I want to learn the best practices on this matter - how this being done in the "big league", but I didn't find yet any paper on this subject.

Was it helpful?

Solution

The question is: how transparency is being implemented in modern games?

In the way that best matches the graphical needs of the game. Yes, this is a broad answer, but the situation hasn't changed a lot over the past 15 years.

Most 3D games will still do the usual 2 rendering passes:

  • Opaque pass where all solid objects are drawn sorted by texture/shader first, near to far second
  • Transparent pass where all translucent objects are drawn strictly sorted far to near.

Sorting by distance is cheap, Quicksort and Mergesort are highly efficient. But what really sucks performance is the need to draw strictly far to near in the transparent pass, since this breaks any texture/shader sorting. And switching textures and/or shaders creates a very noticeable performance hit.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top