Jump to content
  • Advertisement
Sign in to follow this  
BuraCULa

A8_UNORM Texture sampling problem

This topic is 2275 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

Hi. I have a texture with format A8_UNORM. When i try to sample it in pixel shader it was returning just zero.But when i changed my shader variable from Texture2D<float> sth to Texture2D<float4> sth and in shader, sampled the alpha component instead of the red component (sth.Sample(...).a instead of sth.Sample(...).r) it worked well.I am really confused with this situation. Although my texture has single channel,i am able to sample it with Texture2d<float4>.Can someone please enlighten me?

Share this post


Link to post
Share on other sites
Advertisement
The format dictates that that the data is in the alpha channel, not the red channel. So it makes sense that you have to ask for a float4 and use the alpha component, because if you asked for a single float you would get the red channel. You can always use R8_UNORM if you'd rather have the data in the red channel.

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!