Transperency in modern games and other 3D applications
Asked Answered
B

1

2

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.

Brothers answered 27/4, 2014 at 8:45 Comment(2)
I recently wrote a summary of some transparency rendering methods as an answer to a similar question. See #23281192.Guaranty
@RetoKoradi thanks. Info about GL_SAMPLE_ALPHA_TO_COVERAGE was extremely useful.Brothers
L
5

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.

Lutanist answered 27/4, 2014 at 10:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.