//[[ // // applies sub-pixel offset to the viewport texture for smooth camera movement // while keeping pixel-perfect rendering. // - game is rendered with camera snapped to integer pixels (pixel-perfect) // - this shader samples the texture with a UV offset = (smooth_pos - snapped_pos) // - the offset creates the illusion of smooth camera movement // // offset: (subPixelX, subPixelY) in UV space (0-1 range) // texture must have 1px padding on each side to avoid black bars when sampling. //]] extern vec2 offset; vec4 effect(vec4 color, Image tex, vec2 texture_coords, vec2 screen_coords) { return Texel(tex, texture_coords + offset); }