在对多采样纹理进行采样时,我们必须使用整数坐标,即
ivec2 Texcoord = ivec2(textureSize(texsampler) * In.Texcoord);
vec4 color = texelFetch(texsampler, Texcoord, i); //i = sample, Texcoord is integer
代替
vec4 color = texture(texsampler, txcooord); //txcoord is float between [0,1]
为什么我们需要映射到每个纹素的精确整数坐标?为什么我的 UV 坐标不能在 0.0 到 1.0 之间浮动。我猜这与多重采样纹理存储在内存中的方式有关。但整个想法对我来说有点模糊。
我在这里看到了一个类似的问题:Multisample texture sampling,但这不是我想要的。