I was debugging with RenderDoc an issue on an app based on Directx11 and 12 that draw screen space quads to perform various baking steps. These baking steps just render a quad in clip space without any transformation with two triangles and the interpolated texture coordinates (TEXCOORD0) of the 4 vertices (which are then used in the pixel shader) are set to (0, 0), (0, 1), (1, 1), (1, 0).

enter image description here

In the pixel shader, checking these coordinates in the (0, 0) pixel, I expect to see the coordinates of the center of that pixel, but the values are slightly off:

enter image description here enter image description here

With a 17x17 viewport, I was expecting to see both (x, y) at 1 / (2 * 17) = (0.0294117647, 0.0294117647) but as you see I get (0.0294118524, 0.029411763). I see this on any coordinate and both in dx11 and 12. The error is small, but well above the float precision, is this normal or am I missing something?



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.