Summary

In this chapter, we have seen how to use colors on objects, lights, and on the scene in general. Specifically, we have learned that an object can be colored per vertex, per fragment, or it can have a constant color.

The color of light sources in the scene depends on implemented lighting model. Not all lights need to be always white. We have also seen how uniform arrays simplify working with multiple lights in ESSL and in JavaScript WebGL. Also we have created point directional lights.

The alpha value does not necessarily make an object translucent. Interpolative blending is necessary to create translucent objects. Also, the objects need to be rendered back-to-front.

Additionally, face culling can help to produce better results when there ...

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.