This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vec2 texCoord = /* (e.g. vTexCoord.st) */; | |
vec2 texSize = /* (e.g. textureSize (tex, 0)) */; | |
float scalingFactor = /* The virtual res the user wants */ | |
vec2 pixelCoords = texCoord * texSize; | |
vec2 subPixel = (fract (pixelCoords) - .5) * 2; | |
subPixel = pow (abs (subPixel), vec2 (scalingFactor)) * sign (subPixel) / 2 + .5; | |
texCoord = (floor (pixelCoords) + subPixel) / texSize; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment