DuDv map

From polycount
Jump to: navigation, search

DuDv is a simple way to use one texture to distort the pixels of another texture. Common uses are the heat haze above a fire, ripples refracting what's under the water, thick wavy glass distorting what's behind it, etc.

A DuDv map, the framebuffer texture that will be distorted, and the final scene. Video available here. Images by John Leonard.

A DuDv map is similar to a normal map in that it stores directional information in a texture, except mostly just the Red and Green channels are used, so the bitmap has a red/yellow/green look. A DuDv map is actually a derivative of a Normal map, and can easily be created with a variety of tools. It's usually best to blur the texture before converting it, to reduce the "jaggedness" of the distortion effect.

DuDv works in similar way to how a Parallax map distorts a surface, except DuDv doesn't take the viewing angle into consideration (no parallax) it just shifts the pixels of the reflection map before it's applied onto the mesh. The method is basically fetching Du and Dv from the DuDv map, then for every pixel in the reflection map, adding Du to the reflection map's U texture coordinate and adding Dv to its V coordinate, which then offsets the reflection map pixels, creating the distortion.

The texture that's being distorted by the DuDv map is usually either a pre-created reflection map (like a Cube Map), or better yet a real-time rendered framebuffer of the rest of the scene. To do the latter, a special render is set up for each frame by rendering just what is going to be reflected or refracted. To save on render time often the scene is set to its lowest LOD for this special render and non-essential meshes are excluded. The rendered image is projected onto the surface from the camera's point of view, then the DuDv texture is used to distort it.

Simon Schreibt has some animated examples in A Game Art Trick: 007 Legends – The World.

DuDv tools

  • Normal Map filter for Photoshop by NVIDIA
  • TGAtoDUDV by Valve Software
  • ShaderMap ($) by Rendering Systems
  • DuDv maps can be manually created in Photoshop or PaintShop Pro:
    1. Start with a Normal map.
    2. Image->Adjustments->Invert (Photoshop) or Colors->Negative Image (PaintShop Pro).
    3. Image->Adjustments->Brightness&Contrast (Photoshop) or Colors->Adjust->Brightness/Contrast (PaintShop Pro). Raise the contrast as high as it will go.

Related Pages

Personal tools