after revisiting the subject in the context of recent d3d11 2d example implementations i went back and cleaned up the original shadertoy a bit: https://www.shadertoy.com/view/MlB3D3 slight caveat: this simplification only works as long as fract(pixel) stays positive (which it might not, given that fract is calculated as x - floor(x)), but for typical sprite rendering it shouldn't be an issue