Chapter 6. Colors, Depth Testing, and Alpha Blending

In this chapter, we will go a little bit deeper in the use of colors in WebGL. We will start by examining how colors are structured and handled in both WebGL and ESSL. Then we will discuss the use of colors in objects, lights and in the scene. After this we will see how WebGL knows how perform object occlusion when one object is in front of another. This is possible thanks to depth testing. In contrast, alpha blending will allows us to combine the colors of objects when one is occluding the other. We will use alpha blending to create translucent objects.

This chapter talks about:

  • Using colors in objects
  • Assigning colors to light sources
  • Working with several light sources in the ESSL program
  • The ...

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.