Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


[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.

  • You cannot reply to this topic
3 replies to this topic

#1 Nikko_Bertoa   Members   -  Reputation: 423

Like
2Likes
Like

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.

While tessellating geometry adds triangles, it does not add detail
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:
http://code.google.com/p/dx11/



Sponsor:

#2 riuthamus   Moderators   -  Reputation: 5606

Like
0Likes
Like

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?



#3 Nikko_Bertoa   Members   -  Reputation: 423

Like
1Likes
Like

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.



#4 riuthamus   Moderators   -  Reputation: 5606

Like
0Likes
Like

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.



PARTNERS