Zanir » Blog Archive » Program 19 – Offset Mapping

Program 19 – Offset Mapping

21.09.2004

019_Offset_Mapping_Offset_roomOffset mapping use new texture coordinations for sample base and normal map. These is computed from original texture coordinations with equation:

new_texture_coordinations = (0.04*height-0.02)*eye + original_texture_coordinations

height reads from height map and eye is eye vector (vector from surface to camera position) in tangent space.

Offset mapping is explain in Parallax Mapping with Offset Limiting

I use some optimalizations:

  • draw only objects which are in view frustum (Frustum Culling)
  • change those triangles which are out from light range to triangle with zero surface with vertex shader
  • draw in order from camera position

019_Offset_Mapping_bump019_Offset_Mapping_Offset019_Offset_Mapping_DisplacementTop picture presents usual per pixel lighting with ambient, diffuse and specular factor (exponent 32). Middle picture presents per pixel lighting with offset mapping. Bottom picture presents displacement mapping.

Request pixel shader 1.1. Uses also pixel shader 1.4.

source code and executable – 500kB

Leave a Reply