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.

raymarch.wgsl

Import path

Bindings

depth_linear_sampler

#
@group(1)
@binding(2)
var depth_linear_sampler: sampler

depth_nearest_sampler

#
@group(1)
@binding(3)
var depth_nearest_sampler: sampler

Structures

HybridRootFinder

#
struct HybridRootFinder {
linear_steps: u32 ,
bisection_steps: u32 ,
use_secant: bool ,
linear_march_exponent: f32 ,
jitter: f32 ,
min_t: f32 ,
max_t: f32 ,
}

DistanceWithPenetration

#
struct DistanceWithPenetration {
distance: f32 ,
valid: bool ,
penetration: f32 ,
}

DepthRaymarchDistanceFn

#
struct DepthRaymarchDistanceFn {
depth_tex_size: vec2<f32> ,
march_behind_surfaces: bool ,
depth_thickness: f32 ,
use_sloppy_march: bool ,
}

DepthRayMarchResult

#
struct DepthRayMarchResult {
hit: bool ,
hit_t: f32 ,
hit_uv: vec2<f32> ,
hit_penetration: f32 ,
hit_penetration_frac: f32 ,
}

DepthRayMarch

#
struct DepthRayMarch {
linear_steps: u32 ,
linear_march_exponent: f32 ,
bisection_steps: u32 ,
use_secant: bool ,
jitter: f32 ,
ray_start_cs: vec3<f32> ,
ray_end_cs: vec3<f32> ,
march_behind_surfaces: bool ,
use_sloppy_march: bool ,
depth_thickness_linear_z: f32 ,
depth_tex_size: vec2<f32> ,
}

Functions

hybrid_root_finder_new_with_linear_steps

#
fn hybrid_root_finder_new_with_linear_steps ( ) -> HybridRootFinder

hybrid_root_finder_find_root

#

depth_raymarch_distance_fn_evaluate

#
fn depth_raymarch_distance_fn_evaluate (
ray_point_cs: vec3<f32>
) -> DistanceWithPenetration

depth_ray_march_new_from_depth

#
fn depth_ray_march_new_from_depth (
depth_tex_size: vec2<f32>
) -> DepthRayMarch

depth_ray_march_to_cs_dir_impl

#
fn depth_ray_march_to_cs_dir_impl (
infinite: bool
)

depth_ray_march_from_cs

#

March from a clip-space position (w = 1)

fn depth_ray_march_from_cs ( )

depth_ray_march_to_cs

#

Must be called after from_cs, as it will clip the world-space ray to the view frustum.

fn depth_ray_march_to_cs ( )

depth_ray_march_to_cs_dir

#

Must be called after from_cs, as it will clip the world-space ray to the view frustum.

fn depth_ray_march_to_cs_dir ( )

depth_ray_march_to_ws

#

Must be called after from_cs, as it will clip the world-space ray to the view frustum.

fn depth_ray_march_to_ws ( )

depth_ray_march_to_ws_dir

#

Must be called after from_cs, as it will clip the world-space ray to the view frustum.

fn depth_ray_march_to_ws_dir ( )

depth_ray_march_march

#

Perform the ray march.

fn depth_ray_march_march ( ) -> DepthRayMarchResult