1 / 10

Module 06

Module 06. Advanced mapping techniques: Environment mapping. Overview. Environment mapping Sphere mapping Cube mapping. Environment mapping. Environment mapping technique is used to model unique type of objects (like chrome, polished metal, glass) which reflect the environment they are in.

ngonzales
Download Presentation

Module 06

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Module 06 Advanced mapping techniques: Environment mapping

  2. Overview • Environment mapping • Sphere mapping • Cube mapping

  3. Environment mapping • Environment mapping technique is used to model unique type of objects (like chrome, polished metal, glass) which reflect the environment they are in. • In practice, environment mapping applies a special texture map that contains an image of the scene surrounding an object to the object itself. • The result approximates the appearance of a reflective surface, close enough to fool the eye, without incurring any of the expensive computations involved in ray-tracing. • The GL_SPHERE_MAP and GL_REFLECTION_MAP texture generation modes can be used in conjunction with an appropriate texture map to create realistic reflections.

  4. Sphere mapping • For the GL_SPHERE_MAP mode, or sphere mapping the texture coordinates are generated using a vector from the eye to the point on the surface and the surface normal to create a reflection vector. The reflection vector is used to calculate the texture coordinates. • Drawbacks: - sphere mapping is view dependent, so viewing a reflective object from -- - anywhere other than the center of projection can produce incorrect results - the reflection won't pick up any objects moving in the world • Advantage: - faster than cube mapping in static environments

  5. Cube mapping (1) • In the GL_REFLECTION_MAP mode, or cube mapping the world is rendered six times (once for each direction) from the reflective object's perspective. • The results are then stored in the six faces of a cube map, which is then applied to the object. • This approach is much better than sphere mapping, since a reflection image can be generated anywhere in the world, and it can be updated dynamically to reflect objects inmotion. • Cube maps are also view independent and can be easily mapped onto any objects. • For these reasons, sphere mapping is generally not used often.

  6. Cube mapping (2) • Texture coordinates used in conjunction with cube texture maps are typically generated at runtime. For instance, environment mapping can be performed by calculating the reflection of the direction to the camera and storing it in the {s,t,r) coordinates at each vertex of a triangle mesh. The reflection direction calculation is normally implemented in hardware, so this can be done very efficiently. • The s-, t-, and r-coordinates represent a direction vector emanating from the center of the cube that points toward the texel to be sampled.

  7. Cube mapping(3) • Orientation of the cube map axes relative to each of the six faces:

  8. Cube mapping(4) • Cubemap covering the six faces of a cube

  9. Final result

  10. Practice Open: Lab06 /SphereMapping / SphereMapping.sln Lab06 /CubeMapping / CubeMapping.sln

More Related