Saturday, November 9, 2013

Parallax trix

Considering that numerous seemed to get pleasure from the parallax mapping showed off in the material editor, I just wanted to show off the more advanced way of carrying out it and also giving some explanations.

No Parallax
This is when no parallax effect is added, just boring and flat. What takes place is that the engine easy interpolates the uv-coordinate (the position on the texture map) according to the vertices (the points) of the model.

Offset Parallax

This approach is truly just a low-cost trick and as noticed in the image it fails at steep angles. Regardless of this, as the material editor video showed, it nonetheless gives a excellent impact in most situations! The way it performs is by adding an offset to the uv coordinate depending on the height of the height map and of the angle of the eye (compared to position of the pixel). The greatest difficulty with this is that a pixel can by no means occlude (be in front of) one more.

Relief mapping
This algorithm is a lot more accurate than offset mapping, but also a lot more costly. This is no longer a low-cost trick and works by casting a ray from the position of the eye and into the height map. It is then computed exactly where the ray very first hit something and the uv coordinate of that point is employed. This sort of ray casting is utilised in all sophisticated parallax strategies, but is implemented differently. In relief mapping, one particular very first measures along the ray at certain intervals and looks for an intersection. When 1 is discovered a binary search is used between the intersection and the eye position to pin point the precise intersection point. The binary search means that the distance between eye and the initial discovered position is halved over and over, locking in on the intersection.

Other techniques such a cone step mapping give even better outcomes but require the height map to be set up with particular added information that is calculated prior to the rendering starts. There are also strategies for letting the height map not only occlude itself but also the other objects in the scene. It can even carve the actual model to much better match the height map, see "Relief Maps with Silhouttes" right here for an example. This actually takes the strategy to new heights (ha..ha...) and it is genuinely cool how considerably can be done with what starts out as a flat surface!

No comments:

Post a Comment