Sharp Sprite is a collection of Defold materials that implements Rotated Grid Super-Sampling (RGSS) for the Defold engine. If you use down-scaled high-resolution images in your game and you want to get rid of blurriness (because of mipmapping) or sharpness (because of disabled mipmapping), then RGSS is for you.
How does it work?
RGSS samples the texture multiple times with an offset on each sample and averages the results. For this, it uses a 4x MSAA rotated grid pattern, sometimes called 4 rooks.
Itās based on an original idea by Ben Golus - Sharper Mipmapping using Shader Based Supersampling.
The second solution, that included in this repo, uses mip biasing. Mip biasing tells the GPU to adjust what mip level to use. The shaders use mip bias of -1.0 that pushes the mip level one full mip back to make 2D sprites look much sharper. Itās almost as fast as the standard materials. Use this first. If it fits your project well, keep it and donāt try RGSS at all.
Also, check out the demo .
Notes
- RGSS requires the OES_standard_derivatives OpenGL extension to run. Itās universally supported by WebGL 1.0, by the most of OpenGL ES 2.0 devices (Android stats and by all iOS devices).
- On mobile GPUs, it can have a significant performance impact. You should always check the game performance on your target devices!