Professional Documents
Culture Documents
Environment Mapping
We can also use texturing to simulate reflections imagine enclosing object in a box project the world onto the sides of the box for any point on the object, compute reflection by looking up appropriate reflected direction in the cube map Fairly easy to generate place camera at center of object render scene for each side of the box But not totally accurate reflections are only accurate for point at which the images were taken all other reflections are incorrect but people generally never notice
viewing direction u
reflection vector r Need a projection function for reflection vector
r ( s, t )
Thus, any parameterization of the unit sphere will do but some are better than others Example: compute latitude/longitude angles and scale to [0,1] introduces significant distortion especially at poles
reflected rays
image plane
n u
n : unit normal u : unit viewing direction r : unit reflected direction All in eye space!
To use environment maps first create the map image then enable texture coordinate generation
glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T);
unit sphere
unit cube