Brain Dump

Environment Mapping

Tags
computer-graphics

Is an alternative to texture-mapping where an objects surface [see page 5, reflects] the environment it's placed in.

See here for the history of environment mapping.

Think: mirror, astronaut helmet, shiny utensils.

This can be used to create complex CG effects like the T-1000, even in [see page 15, real world] scenes.

The general [see page 6, idea] is for each ray of light intersecting on an object, we reflect the ray (equidistant to the normal) and pick the color that ray then intersects with in the world. (see Ray Tracing).

To optimise this, we actually store a texture of the world surrounding the object and then pick the pixel the ray intersects on the texture (rather than an object in the world).

Note: The larger the resolution of the stored texture, the better the reflection that is rendered.

Note: You can [see page 21, pre-filter] the texture to get a brushed metallic affect.

Texture Generation

The texture can be [see page 7, stored] as a:

  • sphere (more complicated, artefacts near the poles).
  • cube (easy to make)

For the [see page 9, cube] we:

  1. Surround object to be mapped in a cube with a virtual camera.
  2. Use centre of cube as viewpoint and produce a rendered image of the environment as seen through each face of the cube.
  3. Create \((u,v)\) coordinates for each face on the cube.
  4. For each polygons vertex, calculate the reflected vector and cube-face that vector intersects.
  5. Calculate the appropriate \((u,v)\) coordinates for the cube-face.

Disadvantages

  • Reflected geometry is incorrect (approximation through texture).
  • Quality depends on the resolution of the texture.
  • Object cannot reflect in itself (eg. teapot spout)
  • A separate world map is required for each object in the scene.
  • Translating an object required the world map to be rebuilt.
  • Neighbouring shiny objects will not interact.

Many of these issues will be fixed by Ray Tracing.

Links to this note