O'Reilly logo

WebGL Game Development by Sumeet Arora

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

Understanding cubemaps and multi-texturing

So far, we have used only 2D textures in our model. However, at the beginning of the chapter, we also mentioned another kind of texture called cubemaps. Cubemaps are often used in games to approximate an environmental reflection on the surface of a model. Let's say you have a shiny mirror in your game and you want to show the reflection of the left wall, or when the mirror rotates, you want to show the reflection of the right wall. The biggest application of cubemaps in gaming is skylight illumination and skyboxes.

A cube texture map consists of six two-dimensional images that correspond to the faces of a cube. The s, t, and p coordinates represent a direction vector emanating from the center of the cube ...

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