Sign in to follow this  

A8_UNORM Texture sampling problem

This topic is 2057 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 [CODE]Texture2D<float> sth[/CODE] to [CODE]Texture2D<float4> sth[/CODE] 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
Please consider reading comments to the blog. There is an answer [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]
[url="http://blogs.msdn.com/b/chuckw/archive/2010/07/15/ddswithoutd3dx-sample-update.aspx"]http://blogs.msdn.co...ple-update.aspx[/url]

Share this post


Link to post
Share on other sites
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
Hmm. So it seems i need to change my format to L8 and it is gonna be loaded as R8. Thank you. [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]

Share this post


Link to post
Share on other sites

This topic is 2057 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this