A8_UNORM Texture sampling problem

Started by
2 comments, last by BuraCULa 11 years, 12 months ago
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?
Advertisement
Please consider reading comments to the blog. There is an answer smile.png
http://blogs.msdn.co...ple-update.aspx
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.
Hmm. So it seems i need to change my format to L8 and it is gonna be loaded as R8. Thank you. smile.png

This topic is closed to new replies.

Advertisement