Skip to content

A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.

test(grade): the grade keeps saturation near the ungraded frame (merge review I1, M1)

eyalgolan12d0ae697edd
diff --git a/unity/Assets/Scripts/Map/MapGrade.cs b/unity/Assets/Scripts/Map/MapGrade.cs
index 1bc78b429..55aed21fe 100644
--- a/unity/Assets/Scripts/Map/MapGrade.cs
+++ b/unity/Assets/Scripts/Map/MapGrade.cs
@@ -7,7 +7,7 @@ namespace Statecraft.Game.Map
{
/// <summary>The map's colour grade (research notes §1, §2.2 "Colour grading"): a Neutral tonemapper owned by the map (the
/// pipeline assets' template profile already applied one; without any, the graded Negev clips about 2.5% of its
- /// pixels: GradeTests.TheSunlitDesertDoesNotClip), slightly brighter, more contrast and saturation, a warm white balance, teal shadows against amber
+ /// pixels: GradeTests.TheSunlitDesertDoesNotClip), slightly brighter, more contrast (saturation neutral since the merge point), a warm white balance, teal shadows against amber
/// highlights (the promo's complementary sea and land), and a gentle dark-navy vignette. LDR grading on both tiers: the
/// tonemapper and one LUT in the uber pass.</summary>
public static class MapGrade
diff --git a/unity/Assets/Tests/EditMode/GradeTests.cs b/unity/Assets/Tests/EditMode/GradeTests.cs
index 8a0968c09..0e78a50ca 100644
--- a/unity/Assets/Tests/EditMode/GradeTests.cs
+++ b/unity/Assets/Tests/EditMode/GradeTests.cs
@@ -29,6 +29,7 @@ public class GradeTests
var (_, _, profile) = Open();
Assert.IsTrue(profile.TryGet<ColorAdjustments>(out var ca));
Assert.AreEqual(MapGrade.Saturation, ca.saturation.value); Assert.Greater(ca.contrast.value, 0f);
+ Assert.That(MapGrade.Saturation, Is.InRange(-10f, 4f), "the grade does not lift saturation (merge point)");
Assert.IsTrue(profile.TryGet<WhiteBalance>(out var wb)); Assert.Greater(wb.temperature.value, 0f, "warm");
Assert.IsTrue(profile.TryGet<SplitToning>(out var st));
Assert.Greater(st.shadows.value.b, st.shadows.value.r, "teal shadows"); Assert.Greater(st.highlights.value.r, st.highlights.value.b, "amber highlights");
@@ -151,9 +152,13 @@ public class GradeTests
Assert.Greater(control, 0.01f, "without the tonemapper the graded desert clips");
}
- /// <summary>Rendered at the gameplay pose: the grade lifts mean saturation by at least 5%.</summary>
+ /// <summary>Rendered at the gameplay pose: the grade neither washes the colour out nor pumps it. Since the merge point
+ /// MapGrade.Saturation is 0 (merged diorama02 was over the promo's saturation at 16), so the grade's only effect on
+ /// saturation is the side effect of contrast, white balance and split toning: measured 0.568 -> 0.598 (x1.053).
+ /// The ceiling catches a return of the saturation lever (about +0.7% of frame saturation per unit here, so x1.12 is
+ /// about Saturation 10); the floor catches a milky grade.</summary>
[UnityTest]
- public IEnumerator TheGradeLiftsSaturation()
+ public IEnumerator TheGradeKeepsSaturationNearTheUngradedFrame()
{
var (map, rig, _) = Open();
yield return null;
@@ -161,8 +166,9 @@ public class GradeTests
var cam = Camera.main;
VisualToggles.Set("grade", false); var flat = RenderSample.Render(cam, 480, 270);
VisualToggles.Set("grade", true); var graded = RenderSample.Render(cam, 480, 270);
- TestContext.WriteLine($"saturation {flat.MeanSaturation():0.000} -> {graded.MeanSaturation():0.000}");
- Assert.Greater(graded.MeanSaturation(), flat.MeanSaturation() * 1.05f);
+ float ratio = graded.MeanSaturation() / flat.MeanSaturation();
+ TestContext.WriteLine($"saturation {flat.MeanSaturation():0.000} -> {graded.MeanSaturation():0.000} (x{ratio:0.000})");
+ Assert.That(ratio, Is.InRange(0.98f, 1.12f));
}
/// <summary>Rendered: MapGrade's vignette darkens the corners relative to the centre more than the vignette it replaces