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.

environment_filter.wgsl

Bindings

input_texture

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

input_sampler

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

output_texture

#
@group(0)
@binding(2)
var output_texture: texture_storage_2d_array<rgba16float, write>

constants

#
@group(0)
@binding(3)
var<uniform> constants: FilteringConstants

blue_noise_texture

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

Structures

FilteringConstants

#
struct FilteringConstants {
mip_level: f32 ,
sample_count: u32 ,
roughness: f32 ,
noise_size_bits: vec2u ,
}

Functions

sample_environment

#

Sample an environment map with a specific LOD

fn sample_environment (
dir: vec3f
level: f32
) -> vec4f

sample_noise

#

Shader defs requirments:

🟢 HAS_BLUE_NOISE

fn sample_noise (
pixel_coords: vec2u
) -> vec4f

sample_noise

#

Shader defs requirments:

šŸ”“ HAS_BLUE_NOISE

pseudo-random numbers using RNG

fn sample_noise (
pixel_coords: vec2u
) -> vec4f

calculate_environment_map_lod

#

Calculate LOD for environment map lookup using filtered importance sampling

fn calculate_environment_map_lod (
pdf: f32
width: f32
samples: f32
) -> f32

generate_radiance_map

#
@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 generate_radiance_map (
@builtin(global_invocation_id)
global_id: vec3u
)

generate_irradiance_map

#
@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 generate_irradiance_map (
@builtin(global_invocation_id)
global_id: vec3u
)