Search across packages, versions, files, declarations, and comments. Use multiple terms to narrow results (AND), and add @vertex, @fragment, or @compute to filter by shader stage.

Constants

FAR

#
const FAR: f32 = 100.0

SURFACE_EPSILON

#
const SURFACE_EPSILON: f32 = 0.001

MAX_STEPS

#
const MAX_STEPS: u32 = 160u

STEP_SCALE

#
const STEP_SCALE: f32 = 0.5

GYROID_SCALE

#
const GYROID_SCALE: f32 = 5.0

Bindings

globals

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

Structures

Ray

#
struct Ray {
origin: vec3<f32> ,
dir: vec3<f32> ,
}

GBufferOutput

#

Our render pass has two color targets, matching the deferred prepass: location 0: the packed gbuffer (Rgba32Uint) location 1: the deferred lighting pass id (R8Uint)

struct GBufferOutput {
@location(0)
deferred: vec4<u32> ,
@location(1)
deferred_lighting_pass_id: u32 ,
@builtin(frag_depth)
depth: f32 ,
}

Functions

gyroid_field

#
fn gyroid_field (
p: vec3<f32>
) -> f32

map

#
fn map (
p: vec3<f32>
) -> f32

sdf_normal

#
fn sdf_normal (
p: vec3<f32>
) -> vec3<f32>

raymarch

#
fn raymarch (
ray_origin: vec3<f32>
, 
ray_dir: vec3<f32>
) -> f32

ray_for_uv

#
fn ray_for_uv (
uv: vec2<f32>
) -> Ray

depth_for_world_pos

#
fn depth_for_world_pos (
world_pos: vec3<f32>
) -> f32

fragment

#
@fragment
Calculates the final color of each pixel on the screen
fn fragment (
in: FullscreenVertexOutput
) -> GBufferOutput

fragment_shadow

#
@fragment
Calculates the final color of each pixel on the screen
fn fragment_shadow (
in: FullscreenVertexOutput
) ->
@builtin(frag_depth)
f32
Contents