unratio: Aspect Ratio Inverse Transform
Coordinate denormalization for aspect ratio correction
The unratio function performs the inverse transformation of aspect ratio correction, converting normalized coordinates back to their original aspect ratio space.
Given input coordinates st
and screen dimensions s
, the function applies:
This transformation adjusts the Y-coordinate to restore the original aspect ratio distortion, undoing previous ratio correction.
Function Signature
Function | Input Types | Output Type | Description |
---|---|---|---|
unratio | vec2, vec2 | vec2 | Inverse aspect ratio correction |
Parameters
st
: Input coordinates to transforms
: Screen dimensions (width, height)
Live Editor
const fragment = () => { const coords = uv.sub(0.5) const restored = unratio(coords, iResolution) const color = restored.add(0.5).abs() return vec4(color, 0.5, 1) }