Back home 🏡 WGSL Spec Bevy WGSL Functions

bloom.wgsl

Bindings

Name Group Binding index Binding type Type
input_texture # 0 0 texture_2d<f32>
s # 0 1 sampler
uniforms # 0 2 <uniform> BloomUniforms

Structures

BloomUniforms

#
Name Type
threshold_precomputations vec4<f32>
viewport vec4<f32>
aspect f32
uv_offset f32

Functions

soft_threshold

#

Shader defs:

🟢 FIRST_DOWNSAMPLE

https://catlikecoding.com/unity/tutorials/advanced-rendering/bloom/#3.4
fn soft_threshold(color: vec3<f32>) -> vec3<f32>
Parameter Type
color vec3<f32>
Returns: vec3<f32>

tonemapping_luminance

#
luminance coefficients from Rec. 709. https://en.wikipedia.org/wiki/Rec._709
fn tonemapping_luminance(v: vec3<f32>) -> f32
Parameter Type
v vec3<f32>
Returns: f32

rgb_to_srgb_simple

#
fn rgb_to_srgb_simple(color: vec3<f32>) -> vec3<f32>
Parameter Type
color vec3<f32>
Returns: vec3<f32>

karis_average

#
http://graphicrants.blogspot.com/2013/12/tone-mapping.html
fn karis_average(color: vec3<f32>) -> f32
Parameter Type
color vec3<f32>
Returns: f32

sample_input_13_tap

#
[COD] slide 153
fn sample_input_13_tap(uv: vec2<f32>) -> vec3<f32>
Parameter Type
uv vec2<f32>
Returns: vec3<f32>

sample_input_3x3_tent

#
[COD] slide 162
fn sample_input_3x3_tent(uv: vec2<f32>) -> vec3<f32>
Parameter Type
uv vec2<f32>
Returns: vec3<f32>

downsample_first

#
@fragment

Shader defs:

🟢 FIRST_DOWNSAMPLE

fn downsample_first(output_uv: vec2<f32>) -> @location(0) vec4<f32>
Parameter Type
output_uv vec2<f32>
Returns: @location(0) vec4<f32>

downsample

#
@fragment
fn downsample(uv: vec2<f32>) -> @location(0) vec4<f32>
Parameter Type
uv vec2<f32>
Returns: @location(0) vec4<f32>

upsample

#
@fragment
fn upsample(uv: vec2<f32>) -> @location(0) vec4<f32>
Parameter Type
uv vec2<f32>
Returns: @location(0) vec4<f32>