I'm a gameplay programmer
focused on developing
engaging and unique experiences!

My Resume Learn more

Alpha Transparency

A common graphical behavior artists and programmers want to author is transparency. However, transparency creates a couple problems in our graphics pipeline due to the nature of being able to see through objects.

Draw Order

The first problem comes up in the order we draw objects. If we treated transparent objects the same as opaque ones, there's the chance we would draw an opaque object over a transparent object and never see it! This means we want to draw all transparent objects after we've drawn all opaque objects. However that's not all, what if we had two transparent objects overlapping with each other? We don't want to stick with the common order of drawing front to back because we would see an incorrect representation of seeing the transparent object behind the first one. This means transparent objects are drawn in the order of back to front.

All this means our graphics pipeline needs to know the different between independent draw calls (opaque objects) and dependent ones (transparent objects).

Transparent Object Scene

If we implement transparency taking into account the draw order problem mentioned above, we should achieve a simple scene like the one below. Notice how you can see the red, green, and blue spheres through the transparent spheres!

Visualizing Draw Order

Another way we can visualize that transparent objects are being sorted correctly is by looking at the order they are drawn in. The animation below demonstrates opaque objects being drawn first from front-to-back and then transparent objects last from back-to-front. Note how transparent objects prioritize being drawn back to front over being grouped by materials!

No Comments Yet.

Leave a comment