About non-integer pixel centers & AA

Started by
1 comment, last by akhin 11 years, 8 months ago
Hi ,

When I tried to port a working FXAA D3D/HLSL shader to OGL / GLSL , the output looked like it was shifted.

Unlike D3D , it seems pixel centers are not integers , but indexed as 0.5 , 1.5 , 2.5 ...

Specifically I am interested in understanding how non-integer pixel centers could cause a difference
and how it can be fixed/compensated for.

( Assuming that this is the root cause of my problem based on some threads I saw on web)

Thanks
Advertisement
DX10 + DX11 + GL are all correct with mapping pixels this way (with the edges at integer positions, and the centres offset from the edges by 0.5).
DX9 is very silly in the way it maps pixels (with the centres at integer positions).

By default, when drawing a quad that fill the whole screen and simply copies an input texture to the output render-target, GL/DX10/DX11 will work fine, but DX9 requires that you either:
*Shift your vertices by negative half a pixel to compensate for it's silly mapping, or
*Short your texture coordinates by positive half a pixel.

Details here:
http://msdn.microsof...0(v=vs.85).aspx

If you've got something that works in DX9, then that means that you're applying one of the above half-pixel offsets, in order to make it work. To port this to DX10/DX11/GL, you simply have to remove this hack.
Thanks, I removed quad shifting part in my engine . However that didn`t solve my issue , which means it is something
different from the topic I started

Thanks anyway

This topic is closed to new replies.

Advertisement