Radial lens distortion with auto fit
In your harnessGodot shaderMIT
Bend the image like a real lens with the Brown-Conrady radial model: barrel or pincushion distortion from two coefficients, an automatic zoom that hides empty corners, and an optional dark rim.

What it takes and gives
- Shader type
- spatial
- Render modes
- unshaded, cull_disabled, depth_test_disabled, depth_draw_never, skip_vertex_transform, fog_disabled
- Parameters
- screen_texture (sampler2D), k1 (float = 0.22), k2 (float = 0.06), auto_fit (bool = yes), zoom (float = 1), edge_darkening (float = 0.3)
- Use it on
- A MeshInstance3D with a 2 x 2 QuadMesh,
material.tresas its material override and a large extra cull margin, as indemo.tscn. - Result
- The scene bulging outward with bent straight lines and slightly darker corners.
- Renderers
- compatibility: compiled and rendered, forward plus: not verified, mobile: not verified
- Placement
- res://baltor/godot_shaders/post_lens_distortion/
Limits. Sampling the already rendered frame loses resolution at the centre when zoomed. Tangential (decentring) distortion is not modelled. The pass reads Godot's screen texture after opaque geometry, so transparent objects drawn after it are not processed and its order among other transparent passes is not controlled.
Details
- Kind
- Godot shader
- Engine
- Godot 4.3 or later
- Files
- 11 files, 78.3 KB
- Licence
- MIT
- Declared effects
- reads files, runs commands
- Checked with
- Godot 4.7.2, opengl3 compatibility (Mesa llvmpipe, Xvfb)
- Checks
- contract static, engine run, engine log clean, shader in scene, capture written, render not uniform, shader changes pixels
- Techniques
- Brown-Conrady radial distortion polynomial, Automatic fit scale from the corner radius
- Tags
- godot shader, spatial, post-process, lens distortion, barrel, pincushion, camera, full-screen
- Identity
library.supply.creative_originals.e132db6a86bbd456cf570415.4f3f0e6fa7ead573- Version
4f3f0e6fa7ead5733ae065694e6e53715cc65c1be55ef8638f424c81138a7671
The version is the SHA-256 of the item your harness downloads; every file in it names its own checksum.
Something wrong with this item, its rights or its safety? Report it on the support page, or from your harness after a download.

