Back home 🏡 WGSL Spec Bevy WGSL Functions

ssao.wgsl

Bindings

Name Group Binding index Binding type Type
preprocessed_depth # 0 0 texture_2d<f32>
normals # 0 1 texture_2d<f32>
hilbert_index_lut # 0 2 texture_2d<u32>
ambient_occlusion # 0 3 texture_storage_2d<r16float, write>
depth_differences # 0 4 texture_storage_2d<r32uint, write>
globals # 0 5 <uniform> Globals
thickness # 0 6 <uniform> f32
point_clamp_sampler # 1 0 sampler
linear_clamp_sampler # 1 1 sampler
view # 1 2 <uniform> View

Functions

load_noise

#
fn load_noise(pixel_coordinates: vec2<i32>) -> vec2<f32>
Parameter Type
pixel_coordinates vec2<i32>
Returns: vec2<f32>

calculate_neighboring_depth_differences

#
Calculate differences in depth between neighbor pixels (later used by the spatial denoiser pass to preserve object edges)
fn calculate_neighboring_depth_differences(pixel_coordinates: vec2<i32>) -> f32
Parameter Type
pixel_coordinates vec2<i32>
Returns: f32

load_normal_view_space

#
fn load_normal_view_space(uv: vec2<f32>) -> vec3<f32>
Parameter Type
uv vec2<f32>
Returns: vec3<f32>

reconstruct_view_space_position

#
fn reconstruct_view_space_position(depth: f32, uv: vec2<f32>) -> vec3<f32>
Parameter Type
depth f32
uv vec2<f32>
Returns: vec3<f32>

load_and_reconstruct_view_space_position

#
fn load_and_reconstruct_view_space_position(uv: vec2<f32>, sample_mip_level: f32) -> vec3<f32>
Parameter Type
uv vec2<f32>
sample_mip_level f32
Returns: vec3<f32>

updateSectors

#
fn updateSectors(min_horizon: f32, max_horizon: f32, samples_per_slice: f32, bitmask: u32) -> u32
Parameter Type
min_horizon f32
max_horizon f32
samples_per_slice f32
bitmask u32
Returns: u32

processSample

#
fn processSample(delta_position: vec3<f32>, view_vec: vec3<f32>, sampling_direction: f32, n: vec2<f32>, samples_per_slice: f32, bitmask: ptr<function, u32>)
Parameter Type
delta_position vec3<f32>
view_vec vec3<f32>
sampling_direction f32
n vec2<f32>
samples_per_slice f32
bitmask ptr<function, u32>

ssao

#
@compute
fn ssao(global_id: vec3<u32>)
Parameter Type
global_id vec3<u32>