NEWS

Master your own destiny! Command a nation!

A bit on displacement maps

On some objects in the game, for example the foundations of both the Stone Bridge and the church (on the Medium French Village map), we make use of a shader technology called displacement mapping.

intropic

Displacement mapping is a technique for adding geometric detail to the mesh the shader is applied to.

Compared to with normal maps, which works by just altering the surface normal to fake the amount of detail in the mesh detail, displacement mapping alters the mesh itself.

I’ve made some examples that i hope can show you how displacement mapping works and looks with a normal map and a diffuse map.

For this example I’ve used the texture maps from the Stone Bridge in “Medium french Village” more precisely from the foundation of the bridge.

all

These are the images we use, they have all been drawn in Photoshop, but could just as well have been renderdt from a high-poly object. Rendering maps from high-poly objects gives the best and most accurate result, but it takes more time to model a high-poly object to render from, than it does to draw grey-scale normal or displacement map in Photoshop, but if time is on your side highpoly objects is preferred, if time is not so much on your side drawing them in Photoshop will do fine ;)

Diffuse map
This is the map that defines the surface main color look.

Normal map
This is used to faking the lightning of bumps, dents, scratces and so on without added more polygons.

Displacement map
This is the map we use to for the displacement mapping, where black represents the absolute lowest and white represents the highest point. It adds a lot of details to the conture of the object.

textures2

 

Last but not least a ‘DirectX 11′-only feature we also use, called Tesselation which adds more polygons to an object the closer you get to it.
tesselation

If you want to know more about tesselation, Nvidia has published an article about it here: http://www.nvidia.com/object/tessellation.html

Over and out!

Reto.dave

  1. avatarkhitan11-21-2011

    It’s very cool to see how this all works. Thanks.

  2. avatarSamHagelund11-25-2011

    Why is the normal black and white? Do you mean it to be a “bump map”?
    If its a bump map – why not use normal maps as bump maps require more sampling to estimate normal-difference vector?

  3. avatarSamHagelund11-25-2011

    Displacement maps as far as I know em use RGBA channel to offset new veritces by (RGBA/XYZ vector, W range/intensity).
    Whats up with the greyscale tech textures?

  4. avatarReto.dave11-30-2011

    hey SamHagelund

    i understand the confusion ;) it is bump maps, but they behave as normal maps,
    but by using grey scale bump maps as normal maps we can use the same map for displacement maps

    if you are interested in reading more about the bump map/normal map thing have a look here

    http://jbit.net/~sparky/sfgrad_bump/mm_sfgrad_bump.pdf

    and thanks for commenting on my post!

    • avatarSamHagelund12-01-2011

      On the basis of game-size vs performance I suppose it makes sense.

      The paper was an interesting read even if it does use ddx and ddy. When going with DX – u limit the reach of u’r game – Carmack would be disappointed. .. unless you’ve come up with the OpenGL equivalent off screenspace derivatives. (?)!! :D

      Regarding texture packing – I imagine you’ve set up ‘the 2nd tex’ in the way of:
      R: bump
      G: Z displace
      B: specular falloff
      A: specular power

      thanks for reply! :)

  5. avatarSamHagelund12-02-2011

    Had a dream last night that I received an email referring me to an OpenGL _EXT for SS derivatives. :D

  6. avatarSamHagelund12-02-2011

    From what I understand of that bump mapping technique – by doing its 3 or 4 taps, banding could become an issue on wide area + low angle differential. The paper uses samples of noisy perturbation instead of smooth/fine curved surfaces.
    Am I correct in this?

    If so, you could either always use cluttered bump maps or take up a second texture channel for tap radii – not unlike the relaxed cone step texture for ratio values.

    … which arguably brings u full cycle to two-channeled parametrized tangent X,Y + Z reconstructed. =P

    … .. I’m rambling again – am I allowed to do that???

What are you waiting for soldier? We need heroes on the battlefield and generals to lead them!