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.

fft_resolve.wgsl

Constants

FFT_RESOLUTION

#
const FFT_RESOLUTION: u32 = 256u

LOD_COUNT

#
const LOD_COUNT: u32 = 5u

ATTENUATION_BINS

#
const ATTENUATION_BINS: u32 = 4u

NO_BED_DEPTH

#
const NO_BED_DEPTH: f32 = 256.0

Bindings

height_x

#
@group(0)
@binding(0)
var height_x: texture_2d_array<f32>

z_field

#
@group(0)
@binding(1)
var z_field: texture_2d_array<f32>

bed_height

#
@group(0)
@binding(2)
var bed_height: texture_2d<f32>

output

#
@group(0)
@binding(3)
var output: texture_storage_2d_array<rgba16float, write>

fft

#
@group(0)
@binding(4)
var<uniform> fft: FftUniform

Structures

CascadeParams

#
struct CascadeParams {
center: vec2<f32> ,
scale: f32 ,
texture_res: f32 ,
inv_texture_res: f32 ,
texel_width: f32 ,
weight: f32 ,
max_wavelength: f32 ,
}

CascadeLayout

#
struct CascadeLayout {
center: vec4<f32> ,
bed_transform: vec4<f32> ,
bed_range: vec4<f32> ,
}

FftUniform

#
struct FftUniform {
cascade_layout: CascadeLayout ,
params: vec4<f32> ,
mode: vec4<f32> ,
}

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. Nearest-texel read: the shoaling profile is smooth enough that one bed texel per cascade texel suffices.

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

shoaling_weights

#
fn shoaling_weights (
depth: f32
wave_number: f32
) -> vec2<f32>

resolve

#
@compute
Runs custom parallel code on the GPU, not limited to graphics
@workgroup_size(8, 8, 1)
Defines the size of a thread group. One to three numbers: width (x), height (y), and depth (z). Missing values default to 1
fn resolve (
@builtin(global_invocation_id)
id: vec3<u32>
)