From 46a95243bbb5d68292800cd8b4d059f7ce6ec253 Mon Sep 17 00:00:00 2001 From: mosure Date: Sun, 26 Nov 2023 20:26:44 -0600 Subject: [PATCH] fix: radix sort depth inversion --- src/render/mod.rs | 4 ++-- src/render/sort/radix.wgsl | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/render/mod.rs b/src/render/mod.rs index a2a12f46..5dd8ad4e 100644 --- a/src/render/mod.rs +++ b/src/render/mod.rs @@ -484,8 +484,8 @@ impl SpecializedRenderPipeline for GaussianCloudPipeline { format: TextureFormat::Rgba8UnormSrgb, blend: Some(BlendState { color: BlendComponent { - src_factor: BlendFactor::DstAlpha, - dst_factor: BlendFactor::One, + src_factor: BlendFactor::One, + dst_factor: BlendFactor::OneMinusSrcAlpha, operation: BlendOperation::Add, }, alpha: BlendComponent { diff --git a/src/render/sort/radix.wgsl b/src/render/sort/radix.wgsl index 3dee8d91..3b929fc6 100644 --- a/src/render/sort/radix.wgsl +++ b/src/render/sort/radix.wgsl @@ -57,9 +57,7 @@ fn radix_sort_a( let clip_space_pos = world_to_clip(transformed_position); if(in_frustum(clip_space_pos.xyz)) { // key = bitcast(1.0 - clip_space_pos.z); - // 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.z * 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); }