_______________________


Rob Galanakis
Technical Artist
516.680.1603
robg@robg3d.com

Parallax

Introduction

Parallax mapping is a convoluted and confusing topic. There are a number of different types of bump mapping, and parallax is one. The development of the methods is not quite iterative and not at all linear. Its damn confusing, actually. I'll give a quick run-down of all the methods, so that you can sound graphically sophisticated when you're discussing next-gen shader rendering techniques at parties.

The start of the road

These techniques have been around for years now, and they are common place and relatively cheap. Also, there was a somewhat linear development of the techniques, in contrast to the later "Occlusion" techniques.

Normal Mapping

Normal mapping reads the normal for a surface from a texture, instead of the geometry. This allows a flat surface to take the lighting information of a much more complex surface. It is also a relatively cheap technique. See my Shaders article.

Parallax/Offset/Virtual Displacement Mapping

(Unreal Engine 3) This uses a heightmap that will alter the UV's of a surface depending on the height and the the eye vector (the line from the camera to the pixel). Lower areas will squish together, higher areas will spread out some, and the result will look like the texture is occluded. This technique is relatively cheap; it is just a few instructions added to a normal mapping shader. However, because of the (sometimes extreme) distortion, many people prefer not to use it. I have an example on my Functions page.

Parallax with Offset Limiting

(FEAR) At glancing angles, the texture appears to "swim" a great deal with regular Parallax mapping. The pixels are all a mess. If we assume some things about the height (such as it recedes into the surface only), we can limit this offset by capping it and pushing some pixels 'behind' the alpha mask.

Iterative Parallax Mapping

http://www.cescg.org/CESCG-2006/papers/TUBudapest-Premecz-Matyas.pdf

One of the more interesting Parallax implementations, which never really caught on. It uses the ideas learned later, with the Occlusion mapping types, in order to find a more exact Parallax via iterations of the offset.

The fork in the road

Here we have a paradigm shift. All the techniques up to now are "hacks" are far as the occlusion goes. The following techniques are all similar in a couple ways; they use a raytrace to test for occlusion; they actually perform occlusion of pixels, and are not "hacks" like the above techniques. There is "true" occlusion. The difference is mainly in how the raytrace is performed, with regards to accuracy, performance, etc. The paradigm shift is also that none of these are feasible in a game on current hardware (as of GeForce 8 series). You won't see use of these techniques until DirectX 10 hardware is common, even though the techniques have been around for a few years now.'

Relief Mapping

http://fabio.policarpo.nom.br/relief/index.htm

This uses a binary search. It was one of the really groundbreaking Parallax papers, and he's referenced in nearly every Occlusion shader paper. It is a good and usable Occlusion solution (clocks at 69 pixel shader instructions in Policarpo's implementation). The main drawback is that that it uses hard-edged shadows, and the binary searches can leave very apparent 'slices' (though this is apparent on all occlusion shaders in varying degrees).

Cone Mapping

http://www.lonesock.net/files/ConeStepMapping.pdf

This focuses on creating a better method of finding the ray intersection between the view and the heightfield. Other methods have to balance number of searches with efficiency... this does things differently, but as I haven't analyzed the shader code, I'm not sure how (it has to do with cone volumes or some such). On the other Occlusion methods, you can see linear artifacts at glancing angles, created by the lowered concentration of intersection checks.

Parallax Occlusion

http://ati.amd.com/developer/i3d2006/I3D2006-Tatarchuk-POM.pdf

(Crysis) One of the main addition here is soft-shadowing. This is an extremely expensive implementation, but its what you'll be seeing on next-gen hardware, most likely. Tartarchuk's big improvement is the sampling method, using more samples for steeper viewing angles (decreasing the linear artifacts while maximizing efficiency).

You can download a POM shader for 3dsmax and FXComposer from my HLSL page, and see it in a function on my Functions page. There is also a version included with ShaderFX, though it is based on Policarpo's implementation of it, which is inferior to the Tartarchuk version (the one I've ported), though they should be fixing this soon.

Steep Parallax

http://graphics.cs.brown.edu/games/SteepParallax/index.html

Developed by the Computer Science Department at Brown University. This is better for fine surface details, such as the illusion of hair. It is, however, prohibitively expensive and does not provide as good a visual result as other methods.

Conclusions

There isn't really a "best" method. Normal mapping is the simplest, and Parallax Occlusion with Soft Shadows the best. But lots of people like Normal Mapping because it doesn't have any texture swimming, and Parallx Occlusion isn't usable. Better methods are more expensive, and sometimes require properly designed assets, meaning they are not compatible. For example, to maximize a relief mapped wall you may put extra detail (such as a vine) in the texture; however, if you were just using Parallax you'd probably want to model the vine with polygons. Its important also to note that the Occlusion techniques aren't really usable in games today. This is merely meant as a extremely brief and simplistic overview of the different Parallax techniques, because, as we can see, there are at least 7 of them. I hope this cleared things up, and if there are any questions, corrections, or disagreements, don't hesitate to email me.

Update 2/06: Though I wrote this article less than a year ago, many new techniques have been explored, some by the originators of the above techniques. Sooner or later I will add them to the list and bring things up to date.