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.

optics.wgsl

Import path

Constants

TRANSMISSION_OPAQUE_OPTICAL_DEPTH

#
const TRANSMISSION_OPAQUE_OPTICAL_DEPTH: f32 = 6.931471806

Functions

unresolved_wave_roughness

#

Dupuy et al. 2013 LEADR-style slope filtering. A pixel cannot resolve waves shorter than twice its projected world footprint. Integrate each shipped wavelength band’s measured slope variance below that Nyquist cutoff. The logarithmic partial-band term matches the generator’s octave partition.

fn unresolved_wave_roughness (
world_xz: vec2<f32>
to_view: vec3<f32>
lod_alpha: f32
lighting_normal_strength: f32
filtered_detail_variance: f32
) -> f32

deep_water_weight

#
fn deep_water_weight (
water_depth: f32
) -> f32

depth_aware_body_albedo

#
fn depth_aware_body_albedo (
water_depth: f32
deep_body_albedo: vec3<f32>
) -> vec3<f32>

far_field_water

#
fn far_field_water (
world_position: vec4<f32>
surface_level: f32
geometric_normal: vec3<f32>
to_view: vec3<f32>
wave_height: f32
water_depth: f32
) -> vec3<f32>

camera_eye_depth

#
fn camera_eye_depth (
raw_depth: f32
) -> f32

empty_camera_depth_path

#
fn empty_camera_depth_path ()

camera_depth_path

#
fn camera_depth_path ( ) -> CameraDepthPath

camera_depth_debug_from_path

#

Reimplementation of the approach in Crest OceanEmission.hlsl:195-242. The opaque camera depth, never SeaFloorDepth LodData, determines the view-ray water path and whether a refracted sample landed on geometry in front of the water.

fn camera_depth_debug_from_path ( ) -> CameraDepthDebug

opaque_background

#

Transmission samples the opaque buffer at full resolution. Distortion comes only from the displacement normal; no roughness mip or blur is used.

fn opaque_background (
subview_uv: vec2<f32>
) -> vec3<f32>

resolve_near_surface

#
fn resolve_near_surface (
surface_lod: u32
geometric_normal: vec3<f32>
far_tier: f32
mode: u32
) -> NearSurface

sample_water_medium

#
fn sample_water_medium (
surface_lod: u32
lighting_normal: vec3<f32>
to_view: vec3<f32>
mode: u32
) -> MediumState

illuminate_bed

#
fn illuminate_bed (
scene_colour: vec3<f32>
) -> vec3<f32>

resolve_transmission

#
fn resolve_transmission (
scatter_colour: vec3<f32>
mode: u32
) -> TransmissionState