Mesostructures GSoC 2008
Introduction
Mesostructures are fine details on the surface and its rendering has become a hot topic in computer graphics. It is chiefly due to the amount of realism and visual effects (like occlusion, self-shadow and correct silhouettes) achieved by it. Techniques most commonly used in games and implemented in most game engines are Normal mapping, bump mapping which are not able produce such rich visual effects. The most traditional technique proposed for rendering fine details was Displacement mapping. But due to the large number of polygons involved, this technique is very slow and no where close to real time. In recent years, this problem is being seen from a different perspective via Per-Pixel displacement mapping. This technique tries to achieve the same visual effects and realism as displacement mapping but does so in pixel domain. In recent years, lots of approaches have been proposed under per-pixel displacement mapping like Relief mapping, View dependent displacement mapping(VDM), Generalized displacement mapping(GDM), cone step mapping, sphere tracing using distance functions, pyramidal displacement mapping to name a few.
Basic algorithm
We start at the input texture coordinate in the direction of the viewing ray. Based upon appropriate pre-processed data and rendering technique we find the intersection of this ray with the mesostructure, and use the texture coordinate of this point to access color texture, normal texture etc
Detailed description
Relief mapping - height field
Relief mapping, in short, consists of two steps – a linear step and a binary step. In the linear step(see figure below), we start from the input texture coordinates(A) and take constant sized steps in the viewing direction until we find a point inside the surface(3) where the height becomes less than the height of the surface at that texel.
Now we find the actual intersection point by using a binary step. We take the starting point(A) as t_s and the point 3 as t_e. We find the height of the midpoint of A and 3 along this ray. If the height of this midpoint is greater than the surface underneath, t_s becomes this midpoint. If height of midpoint is less than the surface t_e becomes this midpoint. If its equal we have found the intersection point.
Relief mapping - non-height field
In the case of non-height field intersection, the relief mapping intersection algorithm explained above is applied in parallel at relief maps of various depths. We take the intersection point which is the closest.
Sphere tracing
Preprocessing step: It involves creating the distance map from either a height field or a detailed mesh provided. This distance map is used in the rendering stage.
Rendering step: