Suns never take a green hue: draw sun hues from the circle minus a Settings band

Primary hue maps through ColorMath.HueOutsideBand; the secondary takes the
out-of-band side; fog tint and light derive from primary. Band edges are
SunHueExcludedStart/End (75 and 165 degrees by default).

Not yet verified on Yggdrasil at this commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-16 17:20:52 +02:00
commit 0f26c4bb35
4 changed files with 156 additions and 2 deletions

View file

@ -159,8 +159,11 @@ public static class ZoneGenerator
{
if (gas is SunData sun)
{
float primary = random.NextFloat();
float secondary = frac(primary + 1 + zoneSettings.SunSecondaryColorDistance * (random.NextFloat() > .5 ? 1 : -1));
float primary = ColorMath.HueOutsideBand(random.NextFloat(), zoneSettings.SunHueExcludedStart, zoneSettings.SunHueExcludedEnd);
float step = zoneSettings.SunSecondaryColorDistance * (random.NextFloat() > .5 ? 1 : -1);
float secondary = frac(primary + 1 + step);
if (ColorMath.HueInBand(secondary, zoneSettings.SunHueExcludedStart, zoneSettings.SunHueExcludedEnd))
secondary = frac(primary + 1 - step);
gas.Colors = new []
{
float4(ColorMath.HsvToRgb(float3(primary, zoneSettings.SunColorSaturation, .5f)), 0),