Program 19 – Offset Mapping
21.09.2004
Offset 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
Top 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.