Bump Mapping Without Parametrization

Yesterday, I read a recent paper (May 2010) from Morten Mikkelsen at Naughty Dog about a new bump mapping technique that does not require a given surface parametrization.

The idea of his work, as I understand it, was to calculate the surface parametrization at the time the surface’s fragments are begin processed in the Pixel Shader. For that purpose, he uses ddx and ddy functions to differentiate the surface’s eye-space position received from the Vertex Shader inside each fragment processed. That way, for an arbitrary triangular mesh, he does not need to store the usual per-vertex UV, tangent or bitangent (also known as binormal) parametrization vectors.

One disadvantage of this technique is that it relies entirely on GPUs that support Shader Model 3 but I wonder if it would not be possible/viable to differentiate the surface in a deferred pass using the PS3 SPUs.

I implemented Mikkelsen’s Bump Mapping technique inside my old Detailed Surfaces Viewer project, making it easy for me to compare his technique with two others: Normal Mapping and Relief Mapping. My implementation differs from Mikkelsen because I still sample the surface’s height from a normal/height texture using an interpolated UV coordinate, and then use the ddx and ddy functions over it.

The first issue that I noticed in Mikkelsen technique was that I needed to scale the height map values to increase the normal displacement and make it looks like Normal Mapping. The following pictures show a flat surface rendered with Normal Mapping (left) and Relief Mapping (right) using the same normal/height RGBA texture/map.

Saints Normal Mapping Saints Relief Mapping

The following pictures show the same flat surface rendered with Mikkelsen’s technique using the same normal/height texture. In these pictures the height values acquired from the normal/height texture were scaled using a different factor varying is ascending order between 1, 4, 16 and 32.

Saints Bump Mapping S1 Saints Bump Mapping S4
Saints Bump Mapping S16 Saints Bump Mapping S32

As you can see, the results obtained exhibits low displacement and low noise in the first pictures but better displacement and higher noise in the last ones. I would like to further analyze this noise issue to make sure I didn’t do anything wrong and to find out how to deal with it. Note that I’m using trilinear filtering here and that the height map is the same being used by the Relief Mapping technique.

The following pictures compare Mikkelsen’s Bump Mapping without parametrization (first line), Normal Mapping (second line) and Relief Mapping (third line) techniques using two other normal/height maps. Note that for the first technique a height scale factor of 16x was used for both maps.

Four Objects Bump Rock BumpFour Objects Normal Rock NormalFour Objects Relief Rock Relief

I will update the Detailed Surfaces Viewer project as soon as I deal with the noise problem.

Comments (2)

  1. geoff says:

    Did you try evaluating the height derivative manually also as suggested at gamedev.net ?

    float2 TexDs = ddx(In.texST);
    float2 TexDt = ddy(In.texST);
    float Hll = tex_in.Sample(sampler, In.texST).x;
    float dBs = tex_in.Sample(sampler, In.texST+TexDs).x – Hll;
    float dBt = tex_in.Sample(sampler, In.texST+TexDt).x – Hll;

  2. Hi Geoff,

    Sorry for the terrible late reply, I saw you interesting comment but couldn’t answer sooner.

    I didn’t try to evaluate it manually but I don’t expect any difference in the resulting images, although I expect a performance improvement.

    Will try it soon and post it here, thanks!

Leave a Comment