Advanced search tips: use spaces to require multiple terms (AND), | for alternatives (OR), wrap phrases in quotes (="a b"), =term for exact match, 'term to include, !term to exclude, ^term to match prefix, !^term to exclude prefix, .ext$ to match suffix, and !.ext$ to exclude suffix.

water.wgsl

Import path

Constants

NO_BED_DEPTH

#
const NO_BED_DEPTH: f32 = 256.0

CAUSTIC_CELLS_PER_TILE

#
const CAUSTIC_CELLS_PER_TILE: f32 = 16.0

CAUSTIC_FOCUS_GAIN

#
const CAUSTIC_FOCUS_GAIN: f32 = 12.0

CAUSTIC_DAYLIGHT_MIN_LUX

#
const CAUSTIC_DAYLIGHT_MIN_LUX: f32 = 64.0

CAUSTIC_REFERENCE_SUN_LUX

#
const CAUSTIC_REFERENCE_SUN_LUX: f32 = 120000.0

CAUSTIC_LUMINANCE_WEIGHTS

#
const CAUSTIC_LUMINANCE_WEIGHTS: vec3<f32> = vec3(0.2126, 0.7152, 0.0722)

Functions

bed_water_depth

#

Water depth under the sea level from the game’s bed height map. Outside the mapped area (or with no map at all) the sample keeps the deep default, mirroring a full-depth capture texel.

fn bed_water_depth (
world_xz: vec2<f32>
) -> f32

blended_water_depth

#

The bed map is world-static, so Crest’s cascade blending for SeaFloorDepth collapses to one lookup; only the shallow-attenuation cap remains.

fn blended_water_depth (
world_xz: vec2<f32>
) -> f32

caustic_bed_radiance

#

Direct sunlight reaches the bed before Beer-Lambert mixing.

fn caustic_bed_radiance (
scene_colour: vec3<f32>
world_xz: vec2<f32>
water_depth: f32
time: f32
sun_direction: vec3<f32>
sun_unexposed_radiance: vec3<f32>
sun_shadow: f32
extinction: vec3<f32>
) -> vec3<f32>