View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# [D3D11] Displacement Mapping

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

3 replies to this topic

### #1Nicolas Bertoa  GDNet+

Posted 12 February 2013 - 08:27 AM

Hi community. I finished a new mini project about Displacement Mapping using DirectX 11.

DESCRIPTION:
A normal map is a texture, but instead of storing RGB data at each texel,
we store a compressed x-coordinate, y-coordinate and z-coordinate in
the red component, green component, and blue component, respectively.
These coordinates define a normal vector, thus a normal map stores a
normal vector at each pixel.

The strategy of normal mapping is to texture our polygons with normal
maps. We then have per-pixel normals which capture the fine details of a
surface like bumps, scratches and crevices. We then use these per-pixel
normals from the normal map in our lighting calculations, instead of
the interpolated vertex normal.

Normal mapping just improves the lighting detail, but it does not
improve the detail of the actual geometry. So in a sense, normal mapping
is just a lighting trick.

The idea of displacement mapping is to utilize an additional map, called a heightmap, which describes the
bumps and crevices of the surface. In other words, whereas a normal map
has three color channels to yield a normal vector (x, y, z) for each
pixel, the heightmap has a single color channel to yield a height value h
at each pixel. Visually, a heightmap is just a grayscale image (grays
because there is only one color channel), where each pixel is
interpreted as a height value, it is basically a discrete representation
of a 2D scalar field h = f(x, z). When we tessellate the mesh, we
sample the heightmap in the domain shader to offset the vertices in the
normal vector direction to add geometric detail to the mesh.

on its own. That is, if you subdivide a triangle several times, you just
get more triangles that lie on the original triangle plane. To add
detail, then you need to offset the tessellated vertices in some way. A
heightmap is one input source that can be used to displace the
tessellated vertices.

To generate heightmaps you could use NVIDIA Photoshop's plugin or CrazyBump for example

BIBLIOGRAPHY:
Introduction to 3D Game programming using DirectX 11.
Real Time Rendering

VIDEO DEMONSTRATION:

SOURCE CODE:

My Blog

### #2riuthamus  Moderators

Posted 12 February 2013 - 10:09 AM

This is amazing! Thanks... i hope we can figure out how to use this with our current engine. I wonder how hard this would be to implement into a block type of world like minecraft?

### #3Nicolas Bertoa  GDNet+

Posted 12 February 2013 - 11:38 AM

Thanks riuthamus!

I was trying to get a good displacement mapping effect using cubes, but I need to improve tessellation on the edges. Basically I am using the same algorithm for all the shapes. You can check it in my repository, the project is called DisplacementMapping.

My Blog

### #4riuthamus  Moderators

Posted 12 February 2013 - 12:04 PM

Thank you very much, this is very promising as it would help greatly to make a very real looking region

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.