common.wgsl
Import path
Constants
CASCADE_COUNT
#VERTEX_SNAP_MULTIPLIER
#COARSE_GRID_MULTIPLIER
#LOD_TRANSITION_START
#MORPH_BLACK_POINT
#MORPH_FADE_SIDES
#MORPH_INNER_RADIUS
#GRID_CELL_CENTER
#UV_CENTER
#MIN_SAMPLE_WEIGHT
#MIN_NORMAL_Y
#SAFE_LENGTH_SQUARED
#LUMINANCE_EPSILON
#DEBUG_MODE_WATER_PATH
#DEBUG_MODE_REFRACTION_VALIDITY
#DEBUG_MODE_TRANSMISSION
#DEBUG_MODE_UNREFRACTED
#DEBUG_MODE_BEER_LAMBERT
#DEBUG_MODE_SEA_FLOOR
#DEBUG_MODE_BEAUTY
#DEBUG_MODE_REFLECTION
#DEBUG_MODE_FOAM
#DEBUG_MODE_WAVE_HEIGHT
#DEBUG_MODE_LIGHT_RADIANCE
#DEBUG_MODE_REFLECTION_FRACTION
#DEBUG_MODE_FAR_TIER
#CREST_SSS_MAXIMUM
#CREST_SSS_RANGE
#CREST_SSS_UNCOMPRESSED
#PLANAR_PROJECTION_GUARD
#MAX_BODIES
#Bindings
lod_data
#lod_sampler
#cascade_layout
#surface
#bed_height
#detail_normal
#detail_sampler
#foam_data
#foam_sampler
#foam_pattern
#foam_pattern_sampler
#fft_surface
#field_params
#field_maps
#field_sampler
#reflection_a
#reflection_sampler
#reflection_b
#planar_reflections
#caustics_texture
#caustics_sampler
#Structures
CascadeParams
#CascadeLayout
#PlanarReflectionView
#PlanarReflectionParams
#PlanarReflectionSample
#SurfaceParams
#BodyParams
#FieldParams
#LocalLightSample
#RiverState
#One snapshot of this invocation’s river state, handed to imported modules that cannot read this file’s private globals directly.
Functions
sample_planar_reflection
#set_xz_footprint
#screen_xz_footprint
#screen_texture_lod
#Analytic texture LOD: dUV/dpixel is the world-XZ footprint divided by metres per UV repeat, and mip LOD is log2(texels covered per pixel).
begin_invocation
#Stage entry: records the owning body slot’s parameters.
set_effective_flow
#Stage entry: selects the advection current for wave-content sampling.
set_effective_time
#set_fragment_river
#Fragment entry: records the baked river-flow sample under the fragment.
set_body_optics
#Fragment entry: records the effective Beer-Lambert extinction and the scatter-endpoint scale after fresh-water optics override.
set_river_ripple
#Fragment entry: records the river ripple-strength multiplier.
invocation_extinction
#invocation_scatter_scale
#invocation_river_state
#invocation_ripple
#advected_world
#field_uv
#Samples the baked river field; returns zero flow and a huge bank margin when this material has no flow texture.
sample_field_level
#rg: surface level, one-based body slot (0 = unclaimed).
sample_field_flow
#rgb: flow m/s; z: signed bank margin in metres; w: speed m/s.
owning_body
#Parameters of the body owning a point; slot 0 falls back to the inactive ocean defaults so unguarded reads stay harmless.
lod_count
#smootherstep01
#far_tier_weight
#lod_alpha
#snap_and_transition
#world_to_uv
#sample_displacement
#Wave content advects at surface.advection.xy metres per second. A
sampling-space shift is exact Doppler advection for both spectra:
sampling at x - u * t turns every component’s phase into
(k . x) - (omega + k . u) * t. Snap/transition, depth lookups, and foam
gating stay world-anchored.
flow_frame
#capillary_resolved_weight
#godot_fresnel
#GodotOceanWaves water.gdshader: bounded GGX distribution and its Smith
masking-shadowing approximation. Aqua applies Fresnel later in Crest’s
reflection composition, so this returns the remaining direct-sun factor.
Localized-water extent controls; mirrors lod::BodyParams. flags.x is 1.0 for bounded bodies: the vertex stage skips camera snap/morph and the fragment stage culls against extent.xy (centre) and extent.w (radius).