Unformatted text preview:

Trompe L oeil The Triumph of St Ignatius 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 Projection of Reflection Vectors Environment mapping maps reflection vectors to texture viewing direction u reflection vector r Need a projection function for reflection vector r s t Projecting Reflection Directions The set of all unit direction vectors is the unit sphere 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 Geometry of Sphere Maps image plane reflected rays Spherical Projection of Reflection Vectors r x y z Reflection vector 2 n u n r u n u Resulting texture coordinates x 1 y 1 s t 2m 2 2m 2 m x 2 y 2 z 1 2 2 z 1 unit normal n unit viewing direction u r unit reflected direction All in eye space Environment Mapping with OpenGL OpenGL uses spherical projection sphere map is view dependent must regenerate when camera moves or else see the same thing To use environment maps first create the map image then enable texture coordinate generation glEnable GL TEXTURE GEN S glEnable GL TEXTURE GEN T and instruct OpenGL to generate texture coordinates glTexGeni GL S GL TEXTURE GEN MODE GL SPHERE MAP glTexGeni GL T GL TEXTURE GEN MODE GL SPHERE MAP Sphere Maps and Cube Maps unit sphere unit cube There is a natural mapping between these two Sphere Maps for Texture Shading Adding Silhouettes with Sphere Maps Add black rim around the edge of the sphere map not shown Filtered Environment Maps


View Full Document

U of I CS 418 - Environment Mapping

Loading Unlocking...
Login

Join to view Environment Mapping and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Environment Mapping and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?