Summary
And so we end this chapter on textures. As you've seen, there are lots of different kinds of textures available in Three.js, each with their different uses. You can use any image in the PNG, JPG, GIF, TGA, DDS, or PVR format as a texture. Loading these images is done asynchronously, so remember to either use a rendering loop or add a callback when you load the texture. With textures, you can create great-looking objects from low-poly models and even add fake detailed depth using bump maps and normal maps. With Three.js, it is also easy to create dynamic textures using either the HTML5 canvas element or the video element. Just define a texture with these elements as the input and set the needsUpdate
property to true
whenever you want the texture to be updated.
With this chapter out of the way, we've pretty much covered all the important concepts of Three.js. We haven't, however, looked at an interesting feature Three.js offers—postprocessing. With postprocessing, you can add effects...