The problem I'm having is that when I load a R8G8B8A8_SNORM encoded dds texture and sample it in my shader, it gives me values in the [-1, 1] range as I would expect. But, If I load the same normal map that was encoded as BC5_SNORM and sample it, it gives me values in the [0, 1] range.
I'm using D3DX11CreateShaderResourceViewFromFile in conjunction with D3DX11GetImageInfoFromFile to load the textures. I doubled checked and the dds file in question is certainly BC5_SNORM and not BC5_UNORM.
Incorrect value range when sampling BC5_SNORM texture
I would use PIX and sample some pixels to see if the error is in loading of the texture or if the sampling don't know what format it is stored in.
I loaded it in pix. The first normal map shows as R8G8B8A8_SNORM and the second shows as BC5_SNORM. In my pixel shader the first returns [-1, 1] and the second [0, 1], such that:
Normal1.Sample(linearSampler, input.texcoord).xy
and
Normal2.Sample(linearSampler, input.texcoord).xy * 2 - 1
return the same value.
Normal1.Sample(linearSampler, input.texcoord).xy
and
Normal2.Sample(linearSampler, input.texcoord).xy * 2 - 1
return the same value.
Could you find a pixel with negative values on the BC5_SNORM image in PIX?
PIX is unable to display SNORM textures.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement