Quillraven/Dark-Matter

How to calculate size of a pixel in game viewport

Quillraven opened this issue · 1 comments

Currently we know the size of one pixel of the display (desktop display or android).
But for our outline shader to be consistent across different resolutions we need to find out the size of one pixel of our game viewport because 1 pixel there represents multiple pixels of the real display.

My understanding of a fragment shader was wrong. It does not need to know the size of a pixel of the screen. Instead it needs to know the size of a pixel of the texture of the sprite to check the color of adjacent pixels.

Simply passing in the size of the sprite's texture and using the inverse size helps in the outline shader to check for adjacent texels (=pixel of the texture).