I have a simple pixel shader like below. the result looks wrong if I use "texture2d.Gather". But, if I use "texture2d.Sample", the result is correct. the shader resource is RGB8_UNORM, my questions are
1. Gather and Sample should both return float4 in this case, right?
2. I searched the archive, some posts suggest that Gather will return the values of 4 texels. Since TemplateType is float4 here, the return value should be float4. where does "4 texels" come into picture?
3. based on the document, both Gather and Sample should return un-filtered values at one specific texture, correct?
-Sample returns a float4 containing the RGBA of the sampled texture.
-Gather returns a float4 in which each component contains the Red channel of the 4 texels that are used to perform bilinear filtering. So if you want to get the value in the Green channel you can you use GatherGreen() (and also GatherBlue() and GatherAlpha() ).
-So like I said before the return float4 is float4(Red of texel 1, Red of texel 2, Red of texel 3, Red of texel 4).
-Incorrect. Both Sample and Gather return values sampled using whatever filtering method you set in the sampler state used in those functions.