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.

ssao.wgsl

Bindings

preprocessed_depth

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

normals

#
@group(0)
@binding(1)
var normals: texture_2d<f32>

hilbert_index_lut

#
@group(0)
@binding(2)
var hilbert_index_lut: texture_2d<u32>

ambient_occlusion

#
@group(0)
@binding(3)
var ambient_occlusion: texture_storage_2d<r16float, write>

depth_differences

#
@group(0)
@binding(4)
var depth_differences: texture_storage_2d<r32uint, write>

globals

#
@group(0)
@binding(5)
var<uniform> globals: Globals

thickness

#
@group(0)
@binding(6)
var<uniform> thickness: f32

point_clamp_sampler

#
@group(1)
@binding(0)
var point_clamp_sampler: sampler

linear_clamp_sampler

#
@group(1)
@binding(1)
var linear_clamp_sampler: sampler

view

#
@group(1)
@binding(2)
var<uniform> view: View

Functions

load_noise

#
fn load_noise (
pixel_coordinates: vec2<i32>
) -> 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

load_normal_view_space

#
fn load_normal_view_space ( ) -> vec3<f32>

reconstruct_view_space_position

#
fn reconstruct_view_space_position (
depth: f32
) -> vec3<f32>

load_and_reconstruct_view_space_position

#
fn load_and_reconstruct_view_space_position (
sample_mip_level: f32
) -> vec3<f32>

updateSectors

#
fn updateSectors (
min_horizon: f32
max_horizon: f32
samples_per_slice: f32
bitmask: u32
) -> u32

processSample

#
fn processSample (
delta_position: vec3<f32>
view_vec: vec3<f32>
sampling_direction: f32
samples_per_slice: f32
)

ssao

#
@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 ssao (
@builtin(global_invocation_id)
global_id: vec3<u32>
)