mess with seb's trace

This commit is contained in:
2026-10-27 23:52:19 +00:00
parent a1eabf12ce
commit 7bef1dad7e
+10 -6
View File
@@ -5,9 +5,13 @@ import package::render::util::{get_internal_pos, get_low_corner, get_high_corner
enable wgpu_binding_array;
const EPSILON = .001;
const MAX_STEPS = 50;
// const SEB_EPSILON = 0.00025;
// const SEB_MAX_STEPS = 1024;
const SEB_EPSILON = EPSILON;
const SEB_MAX_STEPS = MAX_STEPS;
// axis aligned, center at the origin, dimensions "box_size"
// https://iquilezles.org/articles/intersectors/
fn box_intersection(ro: vec3<f32>, rd: vec3<f32>, box_size: vec3<f32>) -> vec2<f32>
@@ -49,17 +53,17 @@ fn sebastian_trace(metadata: TapeMetadata, spatial_texture: u32, near_plane: f32
//s = s * 2.0 - 1.0;
var d = s;
if (s > 0.00025)
if (s > SEB_EPSILON)
{
for (var i=0; i<1024; i++) {
let uvw = ray_pos + ray_dir * d;
for (var i=0; i<SEB_MAX_STEPS; i++) {
let uvw = fma(ray_dir, vec3(d), ray_pos);
if (d > far_plane) {
return -1.0;
}
let s = spatial_scene(metadata, spatial_texture, vec4(uvw, metadata.time));
//s = s * 2.0 - 1.0;
d += s;
if (s < 0.00025) {
if (s < SEB_EPSILON) {
return d;
}
}
@@ -86,6 +90,6 @@ fn trace_tape(metadata: TapeMetadata, spatial_texture: u32, primitive_id: u32, r
return near_far.x;
}
return molive_trace(metadata, spatial_texture, near_far.x, near_far.y, raypos, raydir);
//return molive_trace(metadata, spatial_texture, near_far.x, near_far.y, raypos, raydir);
return sebastian_trace(metadata, spatial_texture, near_far.x, near_far.y, raypos, raydir);
}