git.lucas.co / cce-gallery
widget gallery and compositor test bench

commitdb7a2b9693bfe2706034eb76136d48e03323c49b
parentf9350cee3a
authorLucas Galante <[email protected]>
date2026-07-04 21:41
Clamp bevel corner shading factor to [-1.0, 1.0] to prevent visual hotspots/darkspots

 src/main.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main.rs b/src/main.rs
index 629ca72..d0c0812 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -198,7 +198,7 @@ fn push_bevel_slice_corners(
             let theta2 = start_angle + ((j + 1) as f32) * (end_angle - start_angle) / (segments as f32);
             let theta_mid = 0.5 * (theta1 + theta2);
 
-            let factor = -(theta_mid.cos() + theta_mid.sin());
+            let factor = -(theta_mid.cos() + theta_mid.sin()).clamp(-1.0, 1.0);
             let offset = factor * color_offset;
 
             let segment_color = [