🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Blue and Alpha components of SNORM texture are always zero?

Started by
0 comments, last by adam7 2 years, 7 months ago

I'm trying to generate a normal Gbuffer. I use the R16G16B16A16_SNORM format to store my normals using this code:

input.normal = normalize(input.normal);
input.tangent = normalize(input.tangent);
float3 binormal = normalize(cross(input.tangent, input.normal));

float3 normal = (normalMap.Sample(SampleType, input.tex).rgb * 2.0) - 1.0f;
float3x3 texSpace = float3x3(input.tangent, binormal, input.normal);
float3 finalNormal = normalize(mul(normal, texSpace));

output.normals = float4(finalNormal.rgb, 1.0f);

The result looks like the 2 images below. However, notice that the blue and alpha channels always come back as zero even though there is visibly data in the blue channel and the alpha is explicitly set to 1.0 in the shader:

In the case of the first screenshot, we can verify that the blue channel shouldn't be zero because computing sqrt(0.86633^2 + 0.49866^2) is 0.99959 which is probably why it looks like there is information in the blue channel. So why does it come up as zero on both debuggers?

This topic is closed to new replies.

Advertisement