Why does the same shader work so differently in XNA and MonoGame?

The xBR shader I posted in this link works very differently in XNA and MonoGame. Below is the comparison:

=XNA=

=MonoGame UWP=

They are using exactly the same shader code – the only difference is that the XNA version uses vs_3_0 and ps_3_0, while the MG version uses vs_4_1 and ps_4_1.

I wonder if this is a bug?

Hi @Tom and @KonajuGames , do you know why this is happening?

Did you consider the “DirectX half-pixel offset”, which is a difference between DirectX 9 and DirectX 10+?

Hi @mgarstenauer, thanks for the reply! I figured out why.

  • First you need to use SamplerState.PointClamp when applying xBR filter.
  • Second, not sure if this is a bug – when the game first launches in full-screen mode, it always look pixelated. Even after you click the “restore” button on the top right corner of the game window to make it shrink, it still looks pixelated. It is only after you manually adjust the size of the window that the xBR filter will start working properly.
  • Even then, you need to adjust the game window to some certain sweet spots to make the game output look right. See the two images below for comparison.

This is when the game resolution is adjusted to 1572x943. You can see it is scaled well.

This is when the game resolution is 1680x1008. See those weird hard edges around the character?