O'Reilly logo

WebGL Beginner's Guide by Brandon Jones, Diego Cantor

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 depth ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required