This commit is contained in:
2026-09-05 15:39:19 +02:00
parent 7efb1a1404
commit f8cfb69b21
14 changed files with 495 additions and 960 deletions
+7 -6
View File
@@ -216,9 +216,9 @@ fn new_traverse(ray_dir: vec3<f32>, ray_origin: vec3<f32>, root_id: u32, dist_of
{
let max_depth = 5;
let dist_offset_voxel = dist_offset * f32(1 << u32(max_depth * 2));
let fovy_deg = 100.;
let fovy_rad = (fovy_deg / 180.) * 3.14159;
let cone_factor = tan(fovy_rad) * 2.;
let fovy_deg = 100. / 1920.;
let fovy_rad = (fovy_deg * 3.14) / 180.;
let cone_factor = tan(fovy_rad / 2.) * 2.;
let st_pointer = structure_table_pointer[root_id];
@@ -272,9 +272,9 @@ fn new_traverse(ray_dir: vec3<f32>, ray_origin: vec3<f32>, root_id: u32, dist_of
var child_pos = (voxel >> vec3(u32(node_shift - 2))) & vec3(3);
var pointer = structure_pool[dfs_stack[current_depth]].pointers[child_pos.x + child_pos.y * 4 + child_pos.z * 4 * 4];
let min_child_size = (length(vec3<f32>(voxel) - pos_origin) + dist_offset) * cone_factor;
let min_child_size = (length(vec3<f32>(voxel) - pos_origin) + dist_offset_voxel) * cone_factor;
while(node_subdivided(pointer) &&
f32(child_size / 8) >= min_child_size
f32(child_size / 4) >= min_child_size
)
{
if(!node_pointer_valid(pointer) && node_subdivided(pointer))
@@ -558,10 +558,11 @@ fn fragment(in: VertexOutput) -> FragmentOutput
let ray_origin = (in.cam_pos - in.chunk_position) + ray_dir * (max(0., interp.x));
let result = new_traverse(ray_dir, ray_origin, in.structure_id, length(in.cam_pos - ray_origin));
let result = new_traverse(ray_dir, ray_origin, in.structure_id, length(in.cam_pos - (ray_origin + in.chunk_position)));
let clip_pos = constants.view_proj * vec4(result.hit_pos + in.chunk_position, 1.);
let depth = clip_pos.z / clip_pos.w;
var frag_out: FragmentOutput;
//frag_out.color = result.color;
frag_out.color = result.color;
frag_out.depth = depth;
return frag_out;