Skip to content

Commit

Permalink
fix: radix sort depth key (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
mosure authored Nov 20, 2023
1 parent 54e44af commit 6c44e85
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/render/sort/radix.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ struct SortingSharedA {
}
var<workgroup> sorting_shared_a: SortingSharedA;

// TODO: resolve flickering (maybe more radix passes?)
@compute @workgroup_size(#{RADIX_BASE}, #{RADIX_DIGIT_PLACES})
fn radix_sort_a(
@builtin(local_invocation_id) gl_LocalInvocationID: vec3<u32>,
Expand All @@ -42,7 +41,9 @@ fn radix_sort_a(
let clip_space_pos = world_to_clip(transformed_position);
if(in_frustum(clip_space_pos.xyz)) {
// key = bitcast<u32>(1.0 - clip_space_pos.z);
key = u32((1.0 - clip_space_pos.z) * 0xFFFF.0) << 16u;
// key = u32(clip_space_pos.z * 0xFFFF.0) << 16u;
let normalized_depth = (1.0 - clip_space_pos.z) * 0.5;
key = u32(normalized_depth * 0xFFFF.0) << 16u;
key |= u32((clip_space_pos.x * 0.5 + 0.5) * 0xFF.0) << 8u;
key |= u32((clip_space_pos.y * 0.5 + 0.5) * 0xFF.0);
}
Expand Down
1 change: 1 addition & 0 deletions viewer/viewer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ fn setup_gaussian_cloud(
GaussianSplattingBundle {
cloud,
settings,
..default()
},
Name::new("gaussian_cloud"),
));
Expand Down

0 comments on commit 6c44e85

Please sign in to comment.