テクセルとUVの間で変換しようとしています
1/width
またはを実行することでテクセルのサイズを定義できると思いました1/height
。それを除算してテクセル番号を取得します。
私は間違っています。
これが私がやろうとしてきたことです。
float4 PostPS(PostIn In) : SV_Target
{
float4 color = 0;
uint width, height;
PostTex.GetDimensions(width, height);
float2 uv = In.texCoord;
float2 texelSize = float2(1/width, 1/height);
// Convert coords to texels
uint x = (uv.x / texelSize.x);
uint y = (uv.y / texelSize.y);
// Convert back again to uv.
uv.x = x * texelSize.x;
uv.y = y * texelSize.y;
color = PostTex.Sample(pointFilter, uv);
return color;
}
ある程度の丸め誤差がある可能性があることはわかっていますが、ある程度は機能したと思います。
ありがとう。