Book Image

WebGL HOTSHOT

By : Mitch Williams
Book Image

WebGL HOTSHOT

By: Mitch Williams

Overview of this book

Table of Contents (17 chapters)
WebGL HOTSHOT
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Demonstrating environment mapping for reflections


One of the great techniques of computer graphics is reflections. The truest reflection is looking through a mirror. Since mirrors generally have no distortion, this can be achieved by rendering from a second camera. Most reflections are of other surfaces such as metal, a pane of glass, or water (such as a still lake). If the scene contains multiple reflective surfaces, it grows in complexity. Such photorealism is beyond the capabilities of WebGL, for now. But like so much in computer graphics, we deploy techniques to accomplish a close representation of reflections – environment maps. Essentially, an environment map is created by placing 3D object(s), such as the car, inside a cube where each of the six sides of the cube is texture mapped with the surrounding environment. The top of the cube may be the sky, the bottom of the cube the ground, and the four sides would be images looking north, east, west, and south.

Prepare for lift off

Light...