Mesostructures GSoC 2008
Introduction
Mesostructures are fine details on the surface and their 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 them. Techniques most commonly used in games and implemented in most game engines(Normal mapping, bump mapping) are not able produce such rich visual effects. The most traditional technique proposed for rendering fine structures is 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 giving real time performance. In recent years, lots of approaches have been proposed for 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.
The main project is to develop an easy-to use C++ library for doing per-pixel displacement mapping. The main focus will be to provide per-pixel displacement mapping support for height field, non-height field & dynamic height field mesostructures. The effects being targeted are self shadow, silhouettes and 3D imposters.
Support for the following per-pixel displacement mapping techniques –
- Techniques –
- Relief mapping : height field and non-height field
- Sphere tracing using distance functions
- Pyramidal displacement mapping
- Maximum mipmaps for dynamic height field rendering
- Effects –
- 3D impostors
- Self-shadow
- Occlusion
- Silhouette
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.
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: