Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am implementing Displacement mapping using DirectX 11 with its new tessellation stages.
Diffuse map and displacement map are generated by xNormal.
The result after I applied displacement mapping is cracked so badly.

Then I realized the values in the texture along seams are not the same/continuous, so I just use diffuse texture as displacement map, and the diffuse color is all-red.

The result is better but still 1-pixel gap along the seams.
I was confused by the little gap, so I enlarged the colored-part in the texture using MS painter, then the gap disappeared!

Now I just don't understand where the problem is. Even if the value along seams from different part of the texture is the same (red in this case), there are still gaps on the result model.

Here are the result screenshots. (reputation too low to post multiple links!)
http://imgur.com/a/OT2tt

I tried all sample filter here(MSDN) but nothing helps.

What causes the gap? It will be better if the problem can be solved by just modifying texture instead of changing my code.

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

Try hard-coding a constant displacement value, such as 1.0. If you still get cracks when using a constant displacement then look at your displacement vectors. How are you calculating them? They need to be exactly, bit-for-bit, equal across the seams; any discrepancy in how they're calculated could lead to cracking. If you're using the vertex normal as a displacement vector, ensure that the normals in the mesh are exactly equal cross the seams.

Once you've gotten things working for a constant displacement value you can put back in the texture-based displacement, but you'll see cracks again. With irregularly shaped UV seams it's impossible in general to make the textures match up precisely across the seam (it can be done if the seam is perfectly horizontal or vertical in UV space and both sides of the seam are precisely the same length).

There are ways to fix the problem, but it requires building some extra vertex data and adding some code to the shader. The basic idea is to sample the displacement map on both sides of the seam, and interpolate the resulting displacement values smoothly across the seam so that there's no sharp discontinuity. A bit more detail can be found in the "My Tessellation Has Cracks" talk by Bryan Dudash, listed on this page.

share|improve this answer
    
I tried constant displacement by using an all-red diffuse texture as displacement map, there are still 1-pixel wide gaps on the model. But if I hard-code it into shader like PosW += 1.0f * NormalW, the gaps will be closed. –  Vivacissimo May 28 '13 at 1:34
    
I've seen a texturing tool to fix this kind of problem but it wasn't released. The tool is used to find edges in the texture and corresponding UV seams, and 'smooth' them or something like that. Anyways the idea is the same with yours. –  Vivacissimo May 28 '13 at 1:38
    
Thank for the information, I will try to fix it procedurally. –  Vivacissimo May 28 '13 at 1:41
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.