Sponsored By

Defracture tool, a displacement map fixer.

A blog post about fixing displacement maps for use tesselation work out and real time displacement. (First steps on the new adventure of developing a 3D game with "next gen" technology, with the glory of tesselation.)

Ofer Rubinstein, Blogger

June 21, 2012

2 Min Read

 

(Taken from http://www.PompiDev.net/ a renewed deb blog by Ofer)

I have been working lately on displacing geometry of a 3D model in real time, after it was tesselated.
Displacement maps means I modify the geometry vertices position according to a height map texture. The issue is that most game models don't have enough geometry to support the fine details of the texture. You could send a lot of geometry to the shader, but this is wasteful. Instead, I subdivide the mesh inside the shader pipeline(tesselate).

I bought a nice 3D model of a stone golem that had normal maps but no displacement maps(height maps + normal maps). I decided to generate the height map using CrazyBump.
That worked pretty nice, but there was an issue. After displacement the model had gaps in certain parts of its surface.

GolemGap


The reason was that because the 3D model was stitched at certain places, like the shoulders and the head. Artists do that so they can unwrap the model's surface into a 2D space which is required for mapping the texture.
The gaps appeared in those stitched areas because they had duplicate vertices in the same position but with different texture space coordinates.
CrazyBump only use the image and has no reference of the geometry, so it can't tell there are different places in the texture that belong to the same 3D position in the model.

What I did to fix this is go over all the edges of the triangles that are shared in the 3D model, but are separate in the texture space. Then I just made the pixels in the height map on these edges share the same values for both edges. I had to make this edge fix more than 1 pixel width and it wasn't a simple challenge.
This image shows where I fixed the displacement map. In practice I didn't put black colors on the image, but rather an average of values on the two edges.

CommonBorders

Denoting the edges

Here are the results:

GolemFixed

Read more about:

Blogs
Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like