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.

volumetric_fog.wgsl

Constants

FRAC_4_PI

#
const FRAC_4_PI: f32 = 0.07957747154594767

Bindings

volumetric_fog

#
@group(1)
@binding(0)
var<uniform> volumetric_fog: VolumetricFog

depth_texture

#

Shader defs requirments:

🟢 MULTISAMPLED

@group(1)
@binding(1)
var depth_texture: texture_depth_multisampled_2d

depth_texture

#

Shader defs requirments:

šŸ”“ MULTISAMPLED

@group(1)
@binding(1)
var depth_texture: texture_depth_2d

density_texture

#

Shader defs requirments:

🟢 DENSITY_TEXTURE

@group(1)
@binding(2)
var density_texture: texture_3d<f32>

density_sampler

#

Shader defs requirments:

🟢 DENSITY_TEXTURE

@group(1)
@binding(3)
var density_sampler: sampler

Structures

VolumetricFog

#

The GPU version of [VolumetricFog]. See the comments in volumetric_fog/mod.rs for descriptions of the fields here.

struct VolumetricFog {
clip_from_local: mat4x4<f32> ,
uvw_from_world: mat4x4<f32> ,
far_planes: array<vec4<f32>,3> ,
fog_color: vec3<f32> ,
light_tint: vec3<f32> ,
ambient_color: vec3<f32> ,
ambient_intensity: f32 ,
step_count: u32 ,
bounding_radius: f32 ,
absorption: f32 ,
scattering: f32 ,
density_factor: f32 ,
density_texture_offset: vec3<f32> ,
scattering_asymmetry: f32 ,
light_intensity: f32 ,
jitter_strength: f32 ,
}

Vertex

#
struct Vertex {
@builtin(instance_index)
instance_index: u32 ,
@location(0)
position: vec3<f32> ,
}

Functions

vertex

#
@vertex
Processes each 3D point in a model before it's drawn
fn vertex (
vertex: Vertex
) ->
@builtin(position)
vec4<f32>

henyey_greenstein

#
fn henyey_greenstein (
neg_LdotV: f32
) -> f32

fragment

#
@fragment
Calculates the final color of each pixel on the screen
fn fragment (
@builtin(position)
position: vec4<f32>
) ->
@location(0)
vec4<f32>

fetch_point_shadow_without_normal

#
fn fetch_point_shadow_without_normal (
light_id: u32
frag_position: vec4<f32>
) -> f32

fetch_spot_shadow_without_normal

#
fn fetch_spot_shadow_without_normal (
light_id: u32
frag_position: vec4<f32>
) -> f32