Jump to content
  • Advertisement
Sign in to follow this  
Chris_F

Incorrect value range when sampling BC5_SNORM texture

This topic is 2315 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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. blink.png

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.

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Could you find a pixel with negative values on the BC5_SNORM image in PIX?


PIX is unable to display SNORM textures.

Share this post


Link to post
Share on other sites

Then I would check Format in pLoadInfo given to D3DX11CreateShaderResourceViewFromFile.


It's BC5_SNORM all day every day.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!