From 52087e8db40b86152b3fcd2cffb23362f9a866c7 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Tue, 28 Apr 2026 14:25:28 +0200 Subject: [PATCH] Add smoothstep function for color interpolation --- src/rendering/world-background-renderer.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/rendering/world-background-renderer.ts b/src/rendering/world-background-renderer.ts index c7ed86b0..8fe9a96e 100644 --- a/src/rendering/world-background-renderer.ts +++ b/src/rendering/world-background-renderer.ts @@ -42,6 +42,12 @@ function lerp(left: number, right: number, amount: number) { return left + (right - left) * amount; } +function smoothstep(edge0: number, edge1: number, value: number) { + const amount = clamp((value - edge0) / (edge1 - edge0), 0, 1); + + return amount * amount * (3 - 2 * amount); +} + function resolveGradientColors(background: WorldBackgroundSettings) { if (background.mode === "solid") { return {