Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: radix sort depth key #34

Merged
merged 1 commit into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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