mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-02 18:56:49 +01:00
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.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user