Jump to content

  • Log In with Google      Sign In   
  • Create Account


Incorrect value range when sampling BC5_SNORM texture


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 Chris_F   Members   -  Reputation: 2180

Like
0Likes
Like

Posted 15 March 2012 - 11:09 AM

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. Posted Image

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.

Sponsor:

#2 Dawoodoz   Members   -  Reputation: 290

Like
0Likes
Like

Posted 15 March 2012 - 12:27 PM

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.

My open source DirectX 10/11 graphics engine. https://sites.google.com/site/dawoodoz

"My design pattern is the simplest to understand. Everyone else is just too stupid to understand it."


#3 Chris_F   Members   -  Reputation: 2180

Like
0Likes
Like

Posted 15 March 2012 - 12:41 PM

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.

#4 Dawoodoz   Members   -  Reputation: 290

Like
0Likes
Like

Posted 15 March 2012 - 02:02 PM

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

My open source DirectX 10/11 graphics engine. https://sites.google.com/site/dawoodoz

"My design pattern is the simplest to understand. Everyone else is just too stupid to understand it."


#5 Chris_F   Members   -  Reputation: 2180

Like
0Likes
Like

Posted 15 March 2012 - 02:31 PM

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


PIX is unable to display SNORM textures.

#6 Dawoodoz   Members   -  Reputation: 290

Like
0Likes
Like

Posted 16 March 2012 - 08:17 AM

Then I would check Format in pLoadInfo given to D3DX11CreateShaderResourceViewFromFile.

My open source DirectX 10/11 graphics engine. https://sites.google.com/site/dawoodoz

"My design pattern is the simplest to understand. Everyone else is just too stupid to understand it."


#7 Chris_F   Members   -  Reputation: 2180

Like
0Likes
Like

Posted 16 March 2012 - 12:18 PM

Then I would check Format in pLoadInfo given to D3DX11CreateShaderResourceViewFromFile.


It's BC5_SNORM all day every day.

#8 Chris_F   Members   -  Reputation: 2180

Like
0Likes
Like

Posted 19 March 2012 - 03:12 PM

Bump.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS