From 23623696718d2b7ebc2223854dcd4c65882eb7d5 Mon Sep 17 00:00:00 2001
From: pwarszawski
Date: Sat, 14 Nov 2026 21:11:41 +0100
Subject: [PATCH] Cluster culling: the radius of a lamp isn't a part of its
brightness
light_peak() scaled point and spot lights by 1 + ambient, but for them ambient holds the radius of the sphere the light
shines from, negative with the soft falloff. A soft lamp with a radius of 1 m or more got no range and lit nothing; other
lamps got ranges too short (soft) or too long. The shading ends the light at 1 / sqrt(quadratic) whatever its radius.
---
shaders/ogl46/cluster_cull.comp | 3 ++-
shaders/vk14/cluster_cull.comp | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/shaders/ogl46/cluster_cull.comp b/shaders/ogl46/cluster_cull.comp
index 0545540f9..59d9a6bea 100644
--- a/shaders/ogl46/cluster_cull.comp
+++ b/shaders/ogl46/cluster_cull.comp
@@ -25,7 +25,8 @@ float light_peak(light_s light)
if (light.type == LIGHT_HEADLIGHTS)
// weights are the state of the individual lamps and the beam texture, which is not brighter than 1, picks from them
return peak * max(light.headlight_weights.r, max(light.headlight_weights.g, light.headlight_weights.b));
- return peak * (1.0 + light.ambient);
+ // point and spot lights: ambient holds the signed radius of the sphere the light shines from, which brings no brightness
+ return peak;
}
// distance from the light at which its contribution falls under MIN_CONTRIBUTION, 0 for a light which has none
diff --git a/shaders/vk14/cluster_cull.comp b/shaders/vk14/cluster_cull.comp
index 141f9eaf5..3f5792280 100644
--- a/shaders/vk14/cluster_cull.comp
+++ b/shaders/vk14/cluster_cull.comp
@@ -25,7 +25,8 @@ float light_peak(light_s light)
if (light.type == LIGHT_HEADLIGHTS)
// weights are the state of the individual lamps and the beam texture, which is not brighter than 1, picks from them
return peak * max(light.headlight_weights.r, max(light.headlight_weights.g, light.headlight_weights.b));
- return peak * (1.0 + light.ambient);
+ // point and spot lights: ambient holds the signed radius of the sphere the light shines from, which brings no brightness
+ return peak;
}
// distance from the light at which its contribution falls under MIN_CONTRIBUTION, 0 for a light which has none