Of course I've copy-pasted the code from Listing 1 to give it a try. After few experiments and suggestion from Morten in this thread I've got it working by scaling bump input value (coefficient 0.007 worked for me). The only thing that prevented me to merge this to trunk was moire. It polluted the solution pretty heavily. And again (thanks Morten!) author suggested a solution. It was just an usage of sampler instead of gradient instructions:
float2 TexDx = ddx(IN.stcoord.xy);Guess what? Moire is gone! And I was able to compare two methods, which looks pretty much the same visually. Bump-mapping technique looks a bit more crisp, though:
float2 TexDy = ddy(IN.stcoord.xy);
float Hll = height_tex.Sample(samLinear, IN.stcoord).x;
float dBs = (height_tex.Sample(samLinear, IN.stcoord+TexDx).x - Hll);
float dBt = (height_tex.Sample(samLinear, IN.stcoord+TexDy).x - Hll);
The end of normal mapping era?
P.S. New method works a bit faster for me.
P.P.S. Added another view:
P.P.P.S. Added two builds to compare.
It almost looks as if the bump mapping version is higher resolution..
ReplyDeleteМаксим, не пробовали делать софтовую фильтрацию текстур для борьбы с микрофасетками при увеличении? Или использовать карту высот в fp-формате?
ReplyDeleteAdded small noise value:
ReplyDeletehttp://picasaweb.google.com/lh/photo/ozKIOagyppX3Kh1wCrrh4IDWkXtBQmkKYvpoJEiwPAw?feat=directlink
Limiting ddx and ddy of texture coordinates to (1 / texture_size):
http://picasaweb.google.com/lh/photo/eYd0qja5SzWeZKigoxxC-IDWkXtBQmkKYvpoJEiwPAw?feat=directlink