diff --git a/CHANGELOG.md b/CHANGELOG.md index af7b7fcf..49c08670 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Fixed visual effects with SSAO + MSAA. Have SSAO sample from resolved multisampled depth texture (https://github.com/Simple-Robotics/candlewick/pull/105) +- Fix WBOIT transparent shader formulas, fixing transparency visual appearance and alpha channel in PNG screenshots (https://github.com/Simple-Robotics/candlewick/pull/110) ## [0.10.1] - 2026-01-19 diff --git a/shaders/compiled/PbrTransparent.frag.msl b/shaders/compiled/PbrTransparent.frag.msl index 39687ca8..1f02873b 100644 --- a/shaders/compiled/PbrTransparent.frag.msl +++ b/shaders/compiled/PbrTransparent.frag.msl @@ -192,7 +192,7 @@ struct KernelContext_0 float weight_0 = clamp((alpha_0 * 10.0 + 0.00999999977648258) * (1.0 - fragCoord_0.z * 0.30000001192092896), 0.00999999977648258, 1000.0); thread FSOutput_0 output_0; - (&output_0)->accum_0 = float4(pow(uncharted2ToneMapping_0(float3(0.02999999932944775) * mat_0.baseColor_0.xyz * float3(mat_0.ao_0) + Lo_0), float3(0.45454543828964233) ) * float3(alpha_0) * float3(weight_0) , alpha_0); - (&output_0)->reveal_0 = 1.0 - alpha_0 * weight_0; + (&output_0)->accum_0 = float4(pow(uncharted2ToneMapping_0(float3(0.02999999932944775) * mat_0.baseColor_0.xyz * float3(mat_0.ao_0) + Lo_0), float3(0.45454543828964233) ) * float3(alpha_0) * float3(weight_0) , alpha_0 * weight_0); + (&output_0)->reveal_0 = alpha_0; return output_0; } diff --git a/shaders/compiled/PbrTransparent.frag.spv b/shaders/compiled/PbrTransparent.frag.spv index 5b8c2d13..f011686a 100644 Binary files a/shaders/compiled/PbrTransparent.frag.spv and b/shaders/compiled/PbrTransparent.frag.spv differ diff --git a/shaders/src/PbrTransparent.frag.slang b/shaders/src/PbrTransparent.frag.slang index 9fe8cb1e..9179e99a 100644 --- a/shaders/src/PbrTransparent.frag.slang +++ b/shaders/src/PbrTransparent.frag.slang @@ -41,7 +41,7 @@ FSOutput main([vk::location(0)] float3 fragViewPos, float weight = clamp(w1 * (1.0 - z * 0.3), 1e-2, 1e3); FSOutput output; - output.accum = float4(color * alpha * weight, alpha); - output.reveal = 1.0 - alpha * weight; + output.accum = float4(color * alpha * weight, alpha * weight); + output.reveal = alpha; return output; }