home/ atoms/ normalized-camera-coordinates

Normalizing pixel coordinates to [-1,1] makes shaders resolution-independent and centers the mathematical origin

A Shadertoy fragment shader receives pixel coordinates fragCoord in [0,resolution] pixels. Dividing by resolution maps to [0,1]; subtracting 0.5 and multiplying by 2 gives [-1,1]. For a non-square viewport, dividing x by the aspect ratio corrects for pixel aspect, so circles remain circular. This normalized coordinate system matches how mathematicians define curves and is the standard for all distance-field shaders. Any SDF or camera ray defined in these units is automatically resolution-independent: the same code runs at 800×450 or 1920×1080 without changing shape sizes.

Examples

vec2 uv = (fragCoord - 0.5*iResolution.xy) / iResolution.y; // aspect-corrected [-1,1]

Assessment

A shader designed at 800×450 is run at 1920×1080 without coordinate normalization. Describe the visual distortion that occurs and how normalization fixes it.

“normalize your pixel coordinates to something that goes from negative one to one from left to right and negative one to one in the vertical direction from bottom to top”
corpus · inigo-quilez-live-coding-happy-jumping-video · chunk 2