Back home 🏡 WGSL Spec Bevy WGSL Functions

water_material.wgsl

Bindings

Name Group Binding index Binding type Type
globals # 0 1 <uniform> Globals
water_normals_texture # 2 100 texture_2d<f32>
water_normals_sampler # 2 101 sampler
water_settings # 2 102 <uniform> WaterSettings

Structures

WaterSettings

#
Parameters to the water shader.
Name Type
octave_vectors array<vec4<f32>, 2>
octave_scales vec4<f32>
octave_strengths vec4<f32>

Functions

sample_noise_octave

#
Samples a single octave of noise and returns the resulting normal.
fn sample_noise_octave(uv: vec2<f32>, strength: f32) -> vec3<f32>
Parameter Type
uv vec2<f32>
strength f32
Returns: vec3<f32>

sample_noise

#
Samples all four octaves of noise and returns the resulting normal.
fn sample_noise(uv: vec2<f32>, time: f32) -> vec3<f32>
Parameter Type
uv vec2<f32>
time f32
Returns: vec3<f32>

fragment

#
@fragment
fn fragment(in: VertexOutput, is_front: bool) -> FragmentOutput
Parameter Type
in VertexOutput
is_front bool
Returns: FragmentOutput