Use of color in the scene

It is time to discuss transparency and alpha blending. We mentioned before that the alpha channel can carry information about the opacity of the color with which the object is being painted. However, as we saw in the cube example, it is not possible to obtain a translucent object unless alpha blending is activated. Things get a bit more complicated when we have several objects in the scene. We will see here what to do in order to have a consistent scene when we have translucent and opaque objects.

Transparency

The first approach to obtain transparent objects is to use polygon stippling. This technique consists of discarding some fragments so you can see through the object. Think of it as punching little holes throughout ...

Get WebGL Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.