Baltor Get started

Gallery / Godot shaders

Underwater camera view

In your harnessGodot shaderMIT

Make the camera look underwater: wavy screen distortion, wavelength-dependent absorption by distance from the depth buffer (red fades first), a blue-green scattering colour, brighter light from above and a vignette.

Render of Underwater camera view
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_disabled, depth_test_disabled, depth_draw_never, skip_vertex_transform, fog_disabled
Parameters
screen_texture (sampler2D), depth_texture (sampler2D), water_color (vec4 = 0.04, 0.28, 0.38, 1), absorption (float = 0.22), red_absorption (float = 3), distortion (float = 0.006), wave_frequency (float = 18), wave_speed (float = 1.5) and 2 more
Use it on
A MeshInstance3D with a 2 x 2 QuadMesh, material.tres as its material override and a large extra cull margin, as in demo.tscn.
Result
The scene tinted deep teal and fading into murk with distance, gently wavering.
Renderers
compatibility: compiled and rendered, forward plus: not verified, mobile: not verified
Placement
res://baltor/godot_shaders/post_underwater_view/

Limits. Sky pixels are clamped to 200 metres of water. The wobble is screen-space and the same at all depths. No caustics or particles (see underwater_caustics for surface caustics). 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, 77.9 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
Beer-Lambert absorption with per-channel coefficients, In-scattering proportional to absorbed light, Sine wave screen distortion, Distance from reconstructed view position
Tags
godot shader, spatial, post-process, underwater, water, absorption, distortion, full-screen
Identity
library.supply.creative_originals.e6ce62eeffeb14c2f667d23e.9a47546b70b95ad5
Version
9a47546b70b95ad5a6a60da75664811fb390c127ada19135c5c519fda1fb1fde

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.