• Create Account

### #Actuallipsryme

Posted 23 April 2013 - 05:29 AM

Hey guys, I'm having a small problem with my normal mapping.

Here's how it looks:

http://d.pr/i/yszc

Now when I comment out this line here (computing of the z component instead of reading it from the file):

	// Sample the normal map, and convert the normal to world space
normalTS.xyz = NormalMap.Sample(AnisotropicSampler, input.UV).xyz * 2.0f - 1.0f;
//normalTS.z = sqrt(1.0f - ((normalTS.x * normalTS.x) + (normalTS.x * normalTS.y)));
normalWS = mul(normalTS, tangentToWorld);
normalWS = normalWS * rsqrt(dot(normalWS, normalWS));


It seems to look fine:

http://d.pr/i/UokG

Why is that ? Does the z reconstruction only work for 3Dc compressed normal maps ? But shouldn't this algorithm work for anything ?

Well looking at it in PIX it seems to generate NaN.

normalTS ( 0.811, 0.685, -1.#IO ) float3

So basically it's doing a sqrt(something negative). What am I doing wrong ?

### #5lipsryme

Posted 23 April 2013 - 05:27 AM

Hey guys, I'm having a small problem with my normal mapping.

Here's how it looks:

http://d.pr/i/yszc

Now when I comment out this line here (computing of the z component instead of reading it from the file):

	// Sample the normal map, and convert the normal to world space
normalTS.xyz = NormalMap.Sample(AnisotropicSampler, input.UV).xyz * 2.0f - 1.0f;
//normalTS.z = sqrt(1.0f - ((normalTS.x * normalTS.x) + (normalTS.x * normalTS.y)));
normalWS = mul(normalTS, tangentToWorld);
normalWS = normalWS * rsqrt(dot(normalWS, normalWS));


It seems to look fine:

http://d.pr/i/UokG

Why is that ? Does the z reconstruction only work for 3Dc compressed normal maps ? But shouldn't this algorithm work for anything ?

Well looking at it in PIX it seems to generate NaN.

normalTS ( 0.811, 0.685, -1.#IO ) float3

So basically it's doing a sqrt(something negative). What am I doing wrong ?
Update: Wait the result should be 0.1 inside the sqrt...

### #4lipsryme

Posted 23 April 2013 - 05:25 AM

Hey guys, I'm having a small problem with my normal mapping.

Here's how it looks:

http://d.pr/i/yszc

Now when I comment out this line here (computing of the z component instead of reading it from the file):

	// Sample the normal map, and convert the normal to world space
normalTS.xyz = NormalMap.Sample(AnisotropicSampler, input.UV).xyz * 2.0f - 1.0f;
//normalTS.z = sqrt(1.0f - ((normalTS.x * normalTS.x) + (normalTS.x * normalTS.y)));
normalWS = mul(normalTS, tangentToWorld);
normalWS = normalWS * rsqrt(dot(normalWS, normalWS));


It seems to look fine:

http://d.pr/i/UokG

Why is that ? Does the z reconstruction only work for 3Dc compressed normal maps ? But shouldn't this algorithm work for anything ?

Well looking at it in PIX it seems to generate NaN.

normalTS ( 0.811, 0.685, -1.#IO ) float3

So basically it's doing a sqrt(something negative). What am I doing wrong ?

### #3lipsryme

Posted 23 April 2013 - 05:24 AM

Hey guys, I'm having a small problem with my normal mapping.

Here's how it looks:

http://d.pr/i/yszc

Now when I comment out this line here (computing of the z component instead of reading it from the file):

	// Sample the normal map, and convert the normal to world space
normalTS.xyz = NormalMap.Sample(AnisotropicSampler, input.UV).xyz * 2.0f - 1.0f;
//normalTS.z = sqrt(1.0f - ((normalTS.x * normalTS.x) + (normalTS.x * normalTS.y)));
normalWS = mul(normalTS, tangentToWorld);
normalWS = normalWS * rsqrt(dot(normalWS, normalWS));


It seems to look fine:

http://d.pr/i/UokG

Why is that ? Does the z reconstruction only work for 3Dc compressed normal maps ? But shouldn't this algorithm work for anything ?

Well looking at it in PIX it seems to generate NaN.

normalTS ( 0.811, 0.685, -1.#IO ) float3

### #2lipsryme

Posted 23 April 2013 - 05:23 AM

Hey guys, I'm having a small problem with my normal mapping.

Here's how it looks:

http://d.pr/i/yszc

Now when I comment out this line here (computing of the z component instead of reading it from the file):

	// Sample the normal map, and convert the normal to world space
normalTS.xyz = NormalMap.Sample(AnisotropicSampler, input.UV).xyz * 2.0f - 1.0f;
//normalTS.z = sqrt(1.0f - ((normalTS.x * normalTS.x) + (normalTS.x * normalTS.y)));
normalWS = mul(normalTS, tangentToWorld);
normalWS = normalWS * rsqrt(dot(normalWS, normalWS));


It seems to look fine:

http://d.pr/i/UokG

Why is that ? Does the z reconstruction only work for 3Dc compressed normal maps ? But shouldn't this algorithm work for anything ?

Well look at it in PIX it seems to generate NaN.

normalTS ( 0.811, 0.685, -1.#IO ) float3

### #1lipsryme

Posted 23 April 2013 - 05:13 AM

Hey guys, I'm having a small problem with my normal mapping.

Here's how it looks:

http://d.pr/i/yszc

Now when I comment out this line here (computing of the z component instead of reading it from the file):

	// Sample the normal map, and convert the normal to world space
normalTS.xyz = NormalMap.Sample(AnisotropicSampler, input.UV).xyz * 2.0f - 1.0f;
//normalTS.z = sqrt(1.0f - ((normalTS.x * normalTS.x) + (normalTS.x * normalTS.y)));
normalWS = mul(normalTS, tangentToWorld);
normalWS = normalWS * rsqrt(dot(normalWS, normalWS));


It seems to look fine:

http://d.pr/i/UokG

Why is that ? Does the z reconstruction only work for 3Dc compressed normal maps ? But shouldn't this algorithm work for anything ?

PARTNERS