Baltor Get started

Gallery / Godot shaders

Screen-space glass refraction with dispersion

In your harnessGodot shaderMIT

Transparent glass that bends the scene behind it by offsetting the screen texture with the view-space normal, splits the colour channels for dispersion, blurs with mip levels for frosted glass, and adds a Fresnel rim and tint.

Render of Screen-space glass refraction with dispersion
The render its check recorded in Godot 4.7.2, 256 by 256 pixels.

What it takes and gives

Shader type
spatial
Render modes
unshaded, cull_back, depth_draw_always, shadows_disabled
Parameters
screen_texture (sampler2D), tint (vec4 = 0.85, 0.95, 1, 1), refraction_strength (float = 0.08), dispersion (float = 0.25), frost (float = 0), fresnel_power (float = 4), fresnel_strength (float = 0.6), reflection_color (vec4 = 0.9, 0.95, 1, 1) and 1 more
Result
A clear sphere that magnifies and bends the scene behind it with coloured fringes at the edges.
Renderers
compatibility: compiled and rendered, forward plus: not verified, mobile: not verified
Placement
res://baltor/godot_shaders/glass_refraction/

Limits. Screen-space: objects outside the screen or in front of the glass cannot be refracted, and edges of the screen clamp. Other transparent objects are not in the screen copy. The reflection is a flat colour, not the environment. Unshaded, so scene lights add no highlight.

Details

Kind
Godot shader
Engine
Godot 4.3 or later
Files
11 files, 67.7 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
Screen texture refraction offset by view-space normals, Per-channel offsets for chromatic dispersion, Mip level blur for frosted glass, Fresnel-style edge blend
Tags
godot shader, spatial, glass, refraction, dispersion, screen texture, transparent
Identity
library.supply.creative_originals.479c12afcbc40cbf2c69a8fa.c811c52d84656a76
Version
c811c52d84656a762cda64c5b82bd3fcec3b85d59497a8142e0b10bb85b8b0e7

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.