Back home 🏡 WGSL Spec Bevy WGSL Functions

visibility_buffer_resolve.wgsl

Import path

Structures

PartialDerivatives

#
Name Type Shader Def
barycentrics vec3<f32> 🟢 MESHLET_MESH_MATERIAL_PASS
ddx vec3<f32> 🟢 MESHLET_MESH_MATERIAL_PASS
ddy vec3<f32> 🟢 MESHLET_MESH_MATERIAL_PASS

VertexOutput

#
Name Type Shader Def
position vec4<f32> 🟢 MESHLET_MESH_MATERIAL_PASS
world_position vec4<f32> 🟢 MESHLET_MESH_MATERIAL_PASS
world_normal vec3<f32> 🟢 MESHLET_MESH_MATERIAL_PASS
uv vec2<f32> 🟢 MESHLET_MESH_MATERIAL_PASS
ddx_uv vec2<f32> 🟢 MESHLET_MESH_MATERIAL_PASS
ddy_uv vec2<f32> 🟢 MESHLET_MESH_MATERIAL_PASS
world_tangent vec4<f32> 🟢 MESHLET_MESH_MATERIAL_PASS
mesh_flags u32 🟢 MESHLET_MESH_MATERIAL_PASS
cluster_id u32 🟢 MESHLET_MESH_MATERIAL_PASS
motion_vector vec2<f32> 🟢 MESHLET_MESH_MATERIAL_PASS, 🟢 PREPASS_FRAGMENT, 🟢 MOTION_VECTOR_PREPASS

MeshletVertex

#
Name Type Shader Def
position vec3<f32> 🟢 MESHLET_MESH_MATERIAL_PASS
normal vec3<f32> 🟢 MESHLET_MESH_MATERIAL_PASS
uv vec2<f32> 🟢 MESHLET_MESH_MATERIAL_PASS

Functions

compute_partial_derivatives

#

Shader defs:

🟢 MESHLET_MESH_MATERIAL_PASS

https://github.com/ConfettiFX/The-Forge/blob/9d43e69141a9cd0ce2ce2d2db5122234d3a2d5b5/Common_3/Renderer/VisibilityBuffer2/Shaders/FSL/vb_shading_utilities.h.fsl#L90-L150
fn compute_partial_derivatives(vertex_world_positions: array<vec4<f32>, 3>, ndc_uv: vec2<f32>, half_screen_size: vec2<f32>) -> PartialDerivatives
Parameter Type
vertex_world_positions array<vec4<f32>, 3>
ndc_uv vec2<f32>
half_screen_size vec2<f32>
Returns: PartialDerivatives

resolve_vertex_output

#

Shader defs:

🟢 MESHLET_MESH_MATERIAL_PASS

Load the visibility buffer texture and resolve it into a VertexOutput.
fn resolve_vertex_output(frag_coord: vec4<f32>) -> VertexOutput
Parameter Type
frag_coord vec4<f32>
Returns: VertexOutput

load_vertex

#

Shader defs:

🟢 MESHLET_MESH_MATERIAL_PASS

fn load_vertex(meshlet: ptr<function, Meshlet>, vertex_id: u32) -> MeshletVertex
Parameter Type
meshlet ptr<function, Meshlet>
vertex_id u32
Returns: MeshletVertex

normal_local_to_world

#

Shader defs:

🟢 MESHLET_MESH_MATERIAL_PASS

fn normal_local_to_world(vertex_normal: vec3<f32>, instance_uniform: ptr<function, Mesh>) -> vec3<f32>
Parameter Type
vertex_normal vec3<f32>
instance_uniform ptr<function, Mesh>
Returns: vec3<f32>

calculate_world_tangent

#

Shader defs:

🟢 MESHLET_MESH_MATERIAL_PASS

https://www.jeremyong.com/graphics/2023/12/16/surface-gradient-bump-mapping/#surface-gradient-from-a-tangent-space-normal-vector-without-an-explicit-tangent-basis
fn calculate_world_tangent(world_normal: vec3<f32>, ddx_world_position: vec3<f32>, ddy_world_position: vec3<f32>, ddx_uv: vec2<f32>, ddy_uv: vec2<f32>) -> vec4<f32>
Parameter Type
world_normal vec3<f32>
ddx_world_position vec3<f32>
ddy_world_position vec3<f32>
ddx_uv vec2<f32>
ddy_uv vec2<f32>
Returns: vec4<f32>