A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
Map: brighter, glowing front lines at the gameplay zoom (#2431) (#2884)
Eyal Golanb6533f87ade0
diff --git a/changelog.d/2431-border-glow.md b/changelog.d/2431-border-glow.mdnew file mode 100644index 000000000..008997f5f--- /dev/null+++ b/changelog.d/2431-border-glow.md@@ -0,0 +1,3 @@+### Changed+- The map's front lines read brighter at the gameplay zoom: a brighter orange-red stripe, the Israeli side's blue kept as+ ruled, and a soft glow along the inside of each band. Grey contested lines stay flat and dashed (#2431).diff --git a/docs/visual-v1.md b/docs/visual-v1.mdindex 4a311f6c7..7259f58ac 100644--- a/docs/visual-v1.md+++ b/docs/visual-v1.md@@ -1025,7 +1025,7 @@ otherwise. Next to main's look, A2's bands keep their weight when the camera pulis never under 6 px, the light stripe 1 px and the wash 12 px, measured across the edge so they hold under the tilt.Both sides wash alike at 0.45, falling as 1 - x squared, so the wash holds well into the hex and reaches a quarter ofits inradius (about 953 m on 4.4 km hexes); a light tint of the region's colour covers the territory, 0.12 up close and rising to-0.25 at the overview. Band plus wash never pass half the inradius, so a far hex is not filled by its outline. The+0.25 at the overview. Since #2431 the stronger tier's two sides also glow ("Issue #2431", below). Band plus wash never pass half the inradius, so a far hex is not filled by its outline. Theneutral grey keeps its 0.14 wash and its dashes, never shorter than 8 px. The other variants stay selectable forcomparison: `?bordervariant=legacy` in the WebGL URL (or `-bordervariant legacy` on desktop and in the editor) drawsmain's earlier look exactly, and `a`, `b`, `c`, `b2` and `c2` draw the prototype's other variants; anything else draws A2@@ -3544,6 +3544,31 @@ are in-engine captures at the source above; right panels are the existing AI-gennot gameplay. Pending: a person's look at judea30 and the transport anomaly noted above. No simulation hash,human review flag, licence declaration or release gate changed.+## Issue #2431: brighter, glowing borders at the gameplay zoom+Branch `visual/2431`, on #2427's lighting. The band's width was not the gap: at gameplay03 A2 draws about 10 px against the promo's 8. The colour was: the blue stripe's saturation was 0.44 against the promo's 0.59 (72,114,176), and nothing marked the band as lit.++- **What changed.** On A2, B2 and C2 (the stronger tier; Legacy, A, B and C are as they were): a brighter orange edge stripe, `_ScBorderStripe2` (sRGB 0.92, 0.37, 0.14), while the blue stripe stays the owner's ruled blue (`Primary`'s colour; C2 keeps its own blue; see "The owner's blue" below), and a halo along the inside of the light stripe (`_ScBorderGlow`: pale blue 0.66, 0.78, 0.97 and warm 1.02, 0.57, 0.22, opacity 0.72 at the stripe, falling as a square over 320 m, at least 6 px). Grey does not glow, so contested ground stays flat and dashed. The tint and wash keep `Style.Colour`.+- **Why a split colour.** A brighter `Colour` also brightens the fill. At gameplay03 the fill at the new colours gave rose +4 -> +7, land warmth 0.232 -> 0.248, saturation 0.426 -> 0.435 and palette distance 0.308 -> 0.345, though its hue came nearer the promo (27.9 -> 26.5). With the stripe apart from the fill, the land's numbers do not move. B2's rim is drawn from the stripe colour, so on the orange side it follows the brighter stripe.+- **Why in the shader.** Bloom is a full-screen pass and #2427 kept it off. The halo is drawn in the wash's room: no fetch (`TheBordersReadOneTexelAPixel`), no wider reach (it is never wider than the wash, `GlowWidthPx`, so the early-out stays exact, `TheEarlyOutIsExactInEveryVariant`, and a far hex whose wash has given way has no glow). Not under the stripes or a rim.+- **The tint is not the golden gap.** Editor frames at gameplay03, composited with the UI, one session, the same state, the projection at 16:9 (the rig sets `cam.aspect`: #2882); the crop as in "Issue #38: grade retune". #2427's hypothesis was that the tint explains much of what is left. It does not:++| Land at gameplay03 | hue | rose | saturation | palette distance |+|---|---|---|---|---|+| promo | 26.6 | +5 | 0.364 | |+| as played (tint 0.12, wash 0.45) | 27.9 | +4 | 0.426 | 0.308 |+| tint 0.06 | 28.2 | +4 | 0.424 | 0.305 |+| tint 0 | 28.4 | +3 | 0.423 | 0.303 |+| tint 0, wash 0.25 | 28.5 | +3 | 0.423 | 0.305 |+| borders off | 32.9 | -5 | 0.407 | 0.309 |++ (The issue's 0.40 is the Primary style's own strength; A2 draws 0.45, `StrongWashStrength`.) Taking the tint away moves the hue half a degree, away from the promo, takes 0.003 off the saturation and 0.005 off the distance. With the borders off the land is further from the promo on hue, rose and distance, and nearer on saturation (0.407): the territory colour helps the hue and costs some saturation; the distance barely moves. The tint and wash stay as they were; the rest of the gap is not the borders (hypothesis: the land and town art).+- **Rendered (`TheStripesGlowAtGameplay03`, proof edge on the coastal plain).** Old colours against the first fit (blue stripe 0.26, 0.40, 0.61, since withdrawn): blue stripe saturation 0.45 -> 0.52, orange stripe value 0.79 -> 0.91, the glow's lift over the far wash -0.003 -> 0.130 (blue) and -0.015 -> 0.074 (orange). The two halos stand 38.3 apart under simulated deuteranopia and protanopia at worst (bar 15), and `ColourBlindPlayersTellTheStylesApartInEveryVariant` passes on every variant, Neutral included.+- **The owner's blue.** The first fit's brighter blue stripe took `ThePrimaryStripeIsTheDeeperBlueOfTheRuling` from 2.6 to 8.8 deltaE76, past the owner's #519 bound ("bring the stripe back to about 3 deltaE76 of the ruled blue or less", above). Retuned on the owner's ruling of 7 Nov 2026 (relayed by the coordinator): the blue stripe is `Primary`'s ruled colour again on every tier and the halo carries the Israeli side's glow; the test now asserts the bound (`md <= 3`) for the default, stronger tier. Expected about #2427's 2.6, since the stripe colour is #2427's again: **to be measured** (the halo's first pixel may still count in the stripe's read). With it, `TheStripesGlowAtGameplay03`'s blue saturation bar is the ruled blue's: 89,119,156 has HSV saturation (156-89)/156 = 0.429, so the bar is at least 0.42 (the tightest under it), in place of 0.50; the bars on the blue and orange halo lifts, the halos' colour-blind distance and the orange stripe's value are unchanged. The numbers in "Rendered" above and in "WebGL `?shot`" below are the first fit's, **to be measured** again.+- **WebGL `?shot`, against #2427's final values.** Gameplay03: land mean (145, 115, 87), hue 28.9, saturation 0.422, whole-frame warmth 0.091 and palette distance 0.32 on both sides. Overview: sand 0.347 -> 0.348, sea -0.237 -> -0.239, both inside their bands; Negev clipped 0.088% on both. `art_checkpoint.sh` passed: goldens, shots and material guards.+- **Cost: NOT MEASURED.** `?vprofile` needs `machine_lock.py --exclusive`, which the lanes may not take. From the source: on every land pixel of a drawn region, two colour selects, a max and a lerp; inside the band's branch, the halo (a division, a min, a max, a square). No fetch, pass or variant. That is an argument, not a number. Boot: NOT MEASURED. Web build, uncompressed: 567,916 KB by `du` (`wasm` 65,096 KB, `data` 36,072 KB); only a shader and C# changed, no asset.+- **Colour-blind copies.** In the deuteranopia copy of gameplay03 the blue reads clearly; the orange reads as a pale yellow band, near the land's own hue on the plain and carried by its contrast. The rendered bars above pass; a player's eye on it is the owner's call.+- **Readability.** Looked at in composited frames, before and after: label pills, the map legend, English and Hebrew; a Move pick (#2201's lit hexes) over the Jordan Valley front: its fill and outline draw over the bands, as before. The sea and the Negev are unchanged by eye and in the numbers (`TheSunlitDesertDoesNotClip`: 0.00%).+## Issue #2427: second lighting and grade pass (warm golden land, sea held)Branch `visual/2427`. The issue called the land flat khaki next to promo 03. Measured on main at the gameplay pose, in WebGL, the land's means are already near the promo's. What differs is the spread: the promo's lit ground runs wider (hue 15-40 degrees) and its shade is greyer, ours sits in a narrow terracotta band with a pink cast. Much of that band in the frame is the territory tint of the 15 May 1948 control layer (`_ScBorderTint`), which the editor's `MapCapture.Promo` does not draw: orange-red over the hills, blue over the Israeli plain, which turns its fields lilac-grey. That tint is the borders lane's (#2431), not the grade's. Hypothesis, not tested: most of what is left between this pass and the promo's hills is the tint and the land's own colours.diff --git a/unity/Assets/Scripts/Map/MapBorders.cs b/unity/Assets/Scripts/Map/MapBorders.csindex 918b95585..2370eabda 100644--- a/unity/Assets/Scripts/Map/MapBorders.cs+++ b/unity/Assets/Scripts/Map/MapBorders.cs@@ -22,7 +22,7 @@ namespace Statecraft.Game.Map/// camera pulls out. B: A with a thin dark outer rim. C: A with the Primary blue pushed toward Okabe-Ito's/// colour-blind-safe blue (#0072B2). A2, B2, C2: the same on the stronger tier for gameplay03, the view players live in/// (coordinator, 2026-10-26: A read almost like main there): a 6 px colour stripe floor, a 0.45 wash that holds most- /// of its strength until near its reach, and a 0.12 tint up close (MapBorders.Strong*).</summary>+ /// of its strength until near its reach, a 0.12 tint up close (MapBorders.Strong*) and the glow (#2431; MapBorders.Glow*).</summary>public enum BorderVariant : byte { Legacy = 0, A = 1, B = 2, C = 3, A2 = 4, B2 = 5, C2 = 6 }/// <summary>Which region each hex belongs to, and how each region is outlined: what the border renderer draws. A hex not@@ -82,7 +82,10 @@ namespace Statecraft.Game.MapRim = Shader.PropertyToID("_ScBorderRim"), Dash = Shader.PropertyToID("_ScBorderDash"),Colour1 = Shader.PropertyToID("_ScBorderColour1"), Light1 = Shader.PropertyToID("_ScBorderLight1"), Shape1 = Shader.PropertyToID("_ScBorderShape1"),Colour2 = Shader.PropertyToID("_ScBorderColour2"), Light2 = Shader.PropertyToID("_ScBorderLight2"), Shape2 = Shader.PropertyToID("_ScBorderShape2"),- Colour3 = Shader.PropertyToID("_ScBorderColour3"), Light3 = Shader.PropertyToID("_ScBorderLight3"), Shape3 = Shader.PropertyToID("_ScBorderShape3");+ Colour3 = Shader.PropertyToID("_ScBorderColour3"), Light3 = Shader.PropertyToID("_ScBorderLight3"), Shape3 = Shader.PropertyToID("_ScBorderShape3"),+ Glow1 = Shader.PropertyToID("_ScBorderGlow1"), Glow2 = Shader.PropertyToID("_ScBorderGlow2"), Glow3 = Shader.PropertyToID("_ScBorderGlow3"),+ GlowWidth = Shader.PropertyToID("_ScBorderGlowWidth"),+ Stripe1 = Shader.PropertyToID("_ScBorderStripe1"), Stripe2 = Shader.PropertyToID("_ScBorderStripe2"), Stripe3 = Shader.PropertyToID("_ScBorderStripe3");/// <summary>One style's look. Colours are sRGB (above 1: brighter than white before the grade), measured on/// promo/final/03-gameplay-1936.png (2752 px wide) and set so the graded game matches them (docs/visual-v1.md, "Region borders"). BandM is the coloured plus light stripe in metres,@@ -107,6 +110,21 @@ namespace Statecraft.Game.Map/// hex at gameplay03.</summary>public const float StrongMinColourPx = 6f, StrongWashStrength = 0.45f, StrongTintNear = 0.12f;public static bool Strong(BorderVariant v) => v >= BorderVariant.A2;+ /// <summary>The stronger tier's glow (#2431): promo 03's lines read as lit edges, and bloom would be a full-screen pass, so the+ /// shader draws it. A brighter orange edge stripe (on screen, about the promo's 176-230,83-114,50-67), and a soft halo of a+ /// lighter colour along the inside of each light stripe, GlowOpacity at the stripe and gone GlowM metres in, never under+ /// GlowMinPx. The blue stripe stays the owner's ruled blue (Primary's colour; #519: "bring the stripe back to+ /// about 3 deltaE76 of the ruled blue or less", ControlTests.ThePrimaryStripeIsTheDeeperBlueOfTheRuling), so on the Israeli+ /// side the halo carries the glow. The tint and the wash keep <see cref="Style.Colour"/>: a brighter fill reddened+ /// the hills (rose index +4 to +7, palette distance 0.308 to 0.345 at gameplay03). Neutral has no glow: grey stays flat+ /// and dashed, a third cue beside the colour. Not a variant of its own: A2, B2 and C2 draw it (C2 keeps its own blue stripe).</summary>+ public static readonly Color GlowStripeSecondary = new Color(0.92f, 0.37f, 0.14f),+ GlowHaloPrimary = new Color(0.66f, 0.78f, 0.97f), GlowHaloSecondary = new Color(1.02f, 0.57f, 0.22f);+ public const float GlowOpacity = 0.72f, GlowM = 320f, GlowMinPx = 6f;+ /// <summary>The halo's on-screen width (px) at <paramref name="metresPerPx"/> beside a full band: the shader's, which also takes+ /// ScSharedBand of it on a shared edge (<paramref name="washPx"/> is already that side's there). It lives in the wash's room+ /// (<paramref name="washPx"/>, BandWidths), so a far hex whose wash has given way has no glow.</summary>+ public static float GlowWidthPx(float metresPerPx, float washPx) => Mathf.Min(Mathf.Max(GlowM / metresPerPx, GlowMinPx), washPx);/// <summary>Legacy: main's styles, exactly (shape: band m, colour share, wash width times the band, wash strength),/// with main's 2 px floor for the whole band and its far fade (StatecraftBorders.hlsl, ScBorderLegacy).</summary>@@ -302,6 +320,7 @@ namespace Statecraft.Game.Mapstatic void SetStyles(){var v = Variant; bool strong = Strong(v);+ foreach (var g in new[] { Glow1, Glow2, Glow3 }) Shader.SetGlobalVector(g, Vector4.zero); // Neutral never glowsif (v == BorderVariant.Legacy){SetStyle(Colour1, Light1, Shape1, Primary); Shader.SetGlobalVector(Shape1, LegacyShape1);@@ -315,12 +334,22 @@ namespace Statecraft.Game.MapSetStyle(Colour1, Light1, Shape1, Side(StrongBlue(v) ? PrimaryStrongBlue : Primary));SetStyle(Colour2, Light2, Shape2, Side(Secondary));SetStyle(Colour3, Light3, Shape3, Neutral);+ SetStripe(Stripe1, Colour1Of(v)); // the ruled blue on every tier (#519); the halo carries the glow+ SetStripe(Stripe2, strong ? GlowStripeSecondary : Secondary.Colour);+ SetStripe(Stripe3, Neutral.Colour);+ if (strong) { SetGlow(Glow1, GlowHaloPrimary); SetGlow(Glow2, GlowHaloSecondary); }+ Shader.SetGlobalVector(GlowWidth, new Vector4(GlowM, GlowMinPx, 0f, 0f));Shader.SetGlobalVector(Min, new Vector4(MinLightPx, MinWashPx, strong ? 1f : 0f, 0f)); // w 0: the prototype's drawingShader.SetGlobalVector(Tint, new Vector4(strong ? StrongTintNear : TintNear, TintFar, TintNearInradiusPx, TintFarInradiusPx));Shader.SetGlobalVector(Rim, new Vector4(RimM, RimMinPx, HasRim(v) ? RimOpacity : 0f, RimValue));Shader.SetGlobalVector(Dash, new Vector4(NeutralDashM, NeutralDashOn, NeutralDashMinPx, 0f));}+ static Color Colour1Of(BorderVariant v) => (StrongBlue(v) ? PrimaryStrongBlue : Primary).Colour;++ static void SetStripe(int stripe, Color c) { var l = c.linear; Shader.SetGlobalVector(stripe, new Vector4(l.r, l.g, l.b, 1f)); }+ static void SetGlow(int glow, Color c) { var l = c.linear; Shader.SetGlobalVector(glow, new Vector4(l.r, l.g, l.b, GlowOpacity)); }+static void SetStyle(int colour, int light, int shape, Style s){var c = s.Colour.linear; var l = s.Light.linear;diff --git a/unity/Assets/Shaders/StatecraftBorders.hlsl b/unity/Assets/Shaders/StatecraftBorders.hlslindex 314e71883..8dc282be5 100644--- a/unity/Assets/Shaders/StatecraftBorders.hlsl+++ b/unity/Assets/Shaders/StatecraftBorders.hlsl@@ -26,6 +26,11 @@ float4 _ScBorderRim; // the dark outer rim (variant B): x width (m), y leasfloat4 _ScBorderColour1, _ScBorderLight1, _ScBorderShape1;float4 _ScBorderColour2, _ScBorderLight2, _ScBorderShape2;float4 _ScBorderColour3, _ScBorderLight3, _ScBorderShape3;+// The glow (#2431), per style: rgb its colour (linear), w its opacity at the light stripe (0: none). A soft bright halo along the+// inside of the band, drawn in the wash's room so it needs no fetch, no pass and no wider reach (bloom would be a full-screen pass).+float4 _ScBorderGlow1, _ScBorderGlow2, _ScBorderGlow3;+float4 _ScBorderStripe1, _ScBorderStripe2, _ScBorderStripe3; // the edge stripe's colour (linear); Colour stays the wash's and the tint's+float4 _ScBorderGlowWidth; // x the halo's width (m), y its least width (px); never wider than the wash// The outward unit normals of a hex's edges (p space: x east, y south), in tools/hexgrid.py's NEIGHBOURS order (axial// steps (1, 0), (1, -1), (0, -1), (-1, 0), (-1, 1), (0, 1): MapBorders.NeighbourSteps). Bit i of a hex's edge mask is edge i.@@ -189,8 +194,9 @@ void ScBorderCiv(float4 own, float2 v, float2 p, float2 px, float2 py, float siz// shrinks (the overview reads as coloured territory with a firm edge, not a hairline).float tint = lerp(_ScBorderTint.x, _ScBorderTint.y,saturate((_ScBorderTint.z - inradius / footprint) / max(_ScBorderTint.z - _ScBorderTint.w, 1e-3)));- float bandA = 0.0, washA = 0.0;+ float bandA = 0.0, washA = 0.0, halo = 0.0;float3 stripe = colour.rgb;+ float3 edgeColour = (primary ? _ScBorderStripe1 : (neutral ? _ScBorderStripe3 : _ScBorderStripe2)).rgb;// A hex with no border edge, or a pixel beyond every band's reach, gets the tint alone.[branch] if (edges != 0 && edge < reach){@@ -199,7 +205,7 @@ void ScBorderCiv(float4 own, float2 v, float2 p, float2 px, float2 py, float siz// width. Only an edge whose rim, band or wash reaches the pixel competes: under the camera's tilt an edge's pixels// can be wider than another's, so otherwise a farther edge with nothing to draw here could win the pixel, and the// early-out would not be exact (TheEarlyOutIsExact).- float bestPx = 1e9, bestHalf = 1.0, bestAlong = 0.0;+ float bestPx = 1e9, bestHalf = 1.0, bestAlong = 0.0, bestAa = 1.0;float4 bestW = float4(0.0, 0.0, 0.0, 0.0);[unroll] for (int i = 0; i < 6; i++){@@ -222,7 +228,7 @@ void ScBorderCiv(float4 own, float2 v, float2 p, float2 px, float2 py, float siz{// The dash phase runs along the edge in one direction for both hexes (edges i and i + 3 are// opposite: their tangents are flipped back), so the two halves of a shared neutral edge line up.- bestPx = d / aa; bestHalf = share; bestAlong = dot(p, i < 3 ? t : -t); bestW = w;+ bestPx = d / aa; bestHalf = share; bestAlong = dot(p, i < 3 ? t : -t); bestW = w; bestAa = aa;}}}@@ -232,11 +238,16 @@ void ScBorderCiv(float4 own, float2 v, float2 p, float2 px, float2 py, float sizfloat cColour = saturate(colourEnd - bestPx + 0.5), cBand = saturate(bandEnd - bestPx + 0.5);float rimA = cRim * _ScBorderRim.z;bandA = cBand - cRim + rimA;- stripe = bandA > 0.0 ? (colour.rgb * (cColour - cRim) + light.rgb * (cBand - cColour) + colour.rgb * _ScBorderRim.w * rimA) / bandA : colour.rgb;+ stripe = bandA > 0.0 ? (edgeColour * (cColour - cRim) + light.rgb * (cBand - cColour) + edgeColour * _ScBorderRim.w * rimA) / bandA : colour.rgb;// How far through the wash (0 at the band, 1 at its reach; max(): no division by zero for a style with no// wash, review M3). It falls as a smoothstep, or (the stronger tier) as x^2, holding its strength farther in.float x = saturate((bestPx - bandEnd) / max(bestW.w, 1e-3));washA = shape.w * (1.0 - lerp(x * x * (3.0 - 2.0 * x), x * x, _ScBorderMin.z));+ // The glow: from the light stripe inwards, full at the stripe and gone by its width, inside the wash (the wash gives+ // way first at the far zooms, so the glow goes with it and the early-out's reach stays exact).+ float glowPx = min(max(_ScBorderGlowWidth.x / bestAa, _ScBorderGlowWidth.y) * bestHalf, bestW.w);+ float g = 1.0 - saturate((bestPx - bandEnd) / max(glowPx, 1e-3));+ halo = glowPx > 0.0 ? g * g * (1.0 - cBand) : 0.0; // never under the stripes or a rimif (neutral){// box-filtered dash: the share of this pixel's footprint along the edge that falls on a drawn dash. The@@ -245,13 +256,15 @@ void ScBorderCiv(float4 own, float2 v, float2 p, float2 px, float2 py, float sizfloat period = _ScBorderDash.x * exp2(max(0.0, ceil(log2(max(_ScBorderDash.z / _ScBorderDash.y * footprint / _ScBorderDash.x, 1e-6)))));float ph = frac(bestAlong / period), fw = max(footprint / period, 1e-4);float on = saturate((_ScBorderDash.y - ph) / fw + 0.5) * saturate(ph / fw + 0.5);- bandA *= on; washA *= on;+ bandA *= on; washA *= on; halo *= on;}}// The wash and the tint are the region's colour under the band: the stronger of the two.- float fill = max(washA, tint) * (1.0 - bandA);+ float4 glow = primary ? _ScBorderGlow1 : (neutral ? _ScBorderGlow3 : _ScBorderGlow2);+ float fill = max(max(washA, tint), halo * glow.w) * (1.0 - bandA);float cover = bandA + fill;- float3 c = cover > 0.0 ? (stripe * bandA + colour.rgb * fill) / cover : colour.rgb;+ float3 under = lerp(colour.rgb, glow.rgb, glow.w > 0.0 ? halo : 0.0);+ float3 c = cover > 0.0 ? (stripe * bandA + under * fill) / cover : colour.rgb;float a = cover * (1.0 - water);baseColor *= 1.0 - a;emission = lerp(emission, c, a);diff --git a/unity/Assets/Tests/EditMode/BorderCivTests.cs b/unity/Assets/Tests/EditMode/BorderCivTests.csindex 80b1bad85..4fc7405b4 100644--- a/unity/Assets/Tests/EditMode/BorderCivTests.cs+++ b/unity/Assets/Tests/EditMode/BorderCivTests.cs@@ -468,6 +468,109 @@ public class BorderCivTestsAssert.Greater(a2.wash, a.wash * 1.3f, "A2's wash reads farther in");}+ /// <summary>#2431: the glow lives in the wash's room at every zoom, so a far hex whose wash has given way has none and the+ /// early-out's reach stays exact.</summary>+ [Test]+ public void TheGlowStaysInsideTheWash()+ {+ foreach (var s in Styles)+ foreach (var mpp in MetresPerPx)+ {+ var w = MapBorders.BandWidths(s, mpp, Inradius, rim: false, MapBorders.StrongMinColourPx);+ Assert.LessOrEqual(MapBorders.GlowWidthPx(mpp, w.wash), w.wash + 1e-4f, $"{mpp} m/px");+ }+ Assert.AreEqual(0f, MapBorders.GlowWidthPx(2000f, 0f), "no wash, no glow");+ Assert.AreEqual(MapBorders.GlowM / 30f, MapBorders.GlowWidthPx(30f, 100f), 1e-4f, "the world width up close");+ Assert.AreEqual(MapBorders.GlowMinPx, MapBorders.GlowWidthPx(300f, 100f), 1e-4f, "and a floor farther off");+ }++ /// <summary>#2431: the stronger tier glows and nothing else does: Legacy, A, B and C draw as before, grey never glows,+ /// and the wash and the tint keep the style's colour, so the glow does not recolour the land (a brighter fill reddened+ /// the hills: rose index +4 to +7 at gameplay03).</summary>+ [Test]+ public void OnlyTheStrongerTiersColourStripesGlow()+ {+ var (map, _, _) = BorderTests.Open();+ Vector4 G(string n) => Shader.GetGlobalVector(n);+ var blue = MapBorders.Primary.Colour.linear; var orange = MapBorders.Secondary.Colour.linear;+ foreach (var v in new[] { BorderVariant.Legacy, BorderVariant.A, BorderVariant.B, BorderVariant.C, BorderVariant.A2, BorderVariant.B2, BorderVariant.C2 })+ {+ MapBorders.Variant = v;+ string at = v.ToString();+ bool glows = MapBorders.Strong(v);+ Assert.AreEqual(glows ? MapBorders.GlowOpacity : 0f, G("_ScBorderGlow1").w, at);+ Assert.AreEqual(glows ? MapBorders.GlowOpacity : 0f, G("_ScBorderGlow2").w, at);+ Assert.AreEqual(0f, G("_ScBorderGlow3").w, $"{at}: grey stays flat");+ if (!MapBorders.StrongBlue(v)) Assert.AreEqual(new Vector4(blue.r, blue.g, blue.b, 1f), G("_ScBorderColour1"), $"{at}: the wash and the tint");+ Assert.AreEqual(new Vector4(orange.r, orange.g, orange.b, 1f), G("_ScBorderColour2"), $"{at}: the wash and the tint");+ if (v == BorderVariant.Legacy) continue;+ void Stripe(string name, Color c) { var l = c.linear; Assert.AreEqual(new Vector4(l.r, l.g, l.b, 1f), G(name), $"{at}: {name}"); }+ // The blue stripe is the style's own blue on every tier, the owner's ruled blue (#519; C and C2 keep their own blue,+ // the variant's point): on the stronger tier the halo carries the Israeli side's glow.+ Stripe("_ScBorderStripe1", MapBorders.StrongBlue(v) ? MapBorders.PrimaryStrongBlue.Colour : MapBorders.Primary.Colour);+ Stripe("_ScBorderStripe2", glows ? MapBorders.GlowStripeSecondary : MapBorders.Secondary.Colour);+ Stripe("_ScBorderStripe3", MapBorders.Neutral.Colour);+ }+ Assert.IsNotNull(map);+ }++ /// <summary>#2431: at gameplay03 A2's stripes read as promo 03's lit lines and a soft halo runs along the inside of the band. The+ /// orange stripe's brightness passes the old colour's (0.79) towards the promo's (0.69-0.90); the blue stripe stays the+ /// owner's ruled blue (#519, ControlTests.ThePrimaryStripeIsTheDeeperBlueOfTheRuling), so its saturation only has to hold+ /// about that blue's (89,119,156: 0.43) and not be paled by its halo; the pixels just inside the light stripe are lighter+ /// than the wash farther in, on both sides; and+ /// the two halos stay apart for colour-blind players, with the bound the stripes meet (GradeTests).</summary>+ [UnityTest]+ public IEnumerator TheStripesGlowAtGameplay03()+ {+ var (map, cam, rig) = BorderTests.Open();+ yield return null;+ RenderSample.TiltShift(false);+ BorderProof.Show(map);+ var (inner, outer) = BorderTests.ProofEdge(map, 34.80, 31.86, "coastal_plain");+ BorderTests.LookAtEdge(map, rig, inner);+ static float Saturation(Color c) { Color.RGBToHSV(c, out _, out var sat, out _); return sat; }+ static float Value(Color c) => Mathf.Max(c.r, Mathf.Max(c.g, c.b));+ // the mean colour between fromM and toM from the edge+ static Color Between(BorderTests.Walk w, float fromM, float toM)+ {+ var at = Enumerable.Range(0, w.On.Count).Where(k => Mathf.Abs(w.SignedM[k]) >= fromM && Mathf.Abs(w.SignedM[k]) <= toM).Select(k => w.On[k]).ToList();+ return at.Count == 0 ? Color.black : new Color(at.Average(c => c.r), at.Average(c => c.g), at.Average(c => c.b));+ }+ var walks = BorderTests.WalkEdge(map, cam, inner, outer, 9, 1920, 1080);+ var sat = new List<float>(); var val = new List<float>(); var liftP = new List<float>(); var liftS = new List<float>(); var apart = new List<float>();+ foreach (var w in walks)+ {+ float mpp = (w.SignedM[w.SignedM.Count - 1] - w.SignedM[0]) / Vector2.Distance(w.Px[w.Px.Count - 1], w.Px[0]);+ var p = BorderTests.Read(w, -1, BorderTests.Blueness, 0.45f); var s = BorderTests.Read(w, +1, BorderTests.Redness);+ sat.Add(Saturation(p.Stripe)); val.Add(Value(s.Stripe));+ // just past each light stripe (its pixels' worth of bleed skipped), against the wash far inside+ var wp = MapBorders.BandWidths(MapBorders.Primary, mpp, Inradius, false, MapBorders.StrongMinColourPx);+ var ws = MapBorders.BandWidths(MapBorders.Secondary, mpp, Inradius, false, MapBorders.StrongMinColourPx);+ float nearP = (wp.colour + wp.light + 1.5f) * mpp, nearS = (ws.colour + ws.light + 1.5f) * mpp;+ Color haloP = Between(Half(w, -1), nearP, nearP + 2f * mpp), farP = Between(Half(w, -1), 700f, 1000f);+ Color haloS = Between(Half(w, 1), nearS, nearS + 2f * mpp), farS = Between(Half(w, 1), 700f, 1000f);+ liftP.Add(RenderSample.Luma(haloP) - RenderSample.Luma(farP)); liftS.Add(RenderSample.Luma(haloS) - RenderSample.Luma(farS));+ foreach (var kind in new[] { RenderSample.Cvd.Deuteranopia, RenderSample.Cvd.Protanopia })+ apart.Add(RenderSample.DeltaE(RenderSample.SimulateCvd(haloP, kind), RenderSample.SimulateCvd(haloS, kind)));+ }+ TestContext.WriteLine($"blue stripe saturation {Median(sat):0.00}, orange stripe value {Median(val):0.00}; halo lift blue {Median(liftP):0.000}, orange {Median(liftS):0.000}; halos apart (colour-blind, least) {apart.Min():0.0}");+ Assert.GreaterOrEqual(Median(sat), 0.42f, "the blue stripe keeps the ruled blue's saturation, not paled by its halo: 89,119,156 has HSV saturation (156-89)/156 = 0.429, and 0.42 is the tightest bar under it");+ Assert.GreaterOrEqual(Median(val), 0.82f, "the orange stripe is bright");+ Assert.GreaterOrEqual(Median(liftP), 0.05f, "the blue side glows along its light stripe");+ Assert.GreaterOrEqual(Median(liftS), 0.05f, "the orange side glows along its light stripe");+ Assert.GreaterOrEqual(apart.Min(), 15f, "the halos stay apart for colour-blind players");+ }++ /// <summary>One side of a walk, as a walk (sign -1 the inner hex).</summary>+ static BorderTests.Walk Half(BorderTests.Walk w, int sign)+ {+ var half = new BorderTests.Walk();+ for (int k = 0; k < w.On.Count; k++)+ if (w.SignedM[k] * sign > 0f) { half.On.Add(w.On[k]); half.Off.Add(w.Off[k]); half.SignedM.Add(w.SignedM[k]); half.Px.Add(w.Px[k]); }+ return half;+ }+/// <summary>Variant B: a dark rim on the edge. Close up (20 km), the darkest Primary pixel within 60 m of a/// primary-secondary proof edge is clearly darker with B than with A (and with B2 than with A2).</summary>[UnityTest]diff --git a/unity/Assets/Tests/EditMode/ControlTests.cs b/unity/Assets/Tests/EditMode/ControlTests.csindex 5cfac915b..b207f1a93 100644--- a/unity/Assets/Tests/EditMode/ControlTests.cs+++ b/unity/Assets/Tests/EditMode/ControlTests.cs@@ -489,10 +489,14 @@ public class ControlTests}/// <summary>Rendered: on a coastal-plain proof edge at gameplay03's zoom, the Primary band measures about the owner's- /// deeper blue (promo 03's Israeli side, about 89,119,156 on screen), against main's lighter 120,142,192.</summary>+ /// deeper blue (promo 03's Israeli side, about 89,119,156 on screen), against main's lighter 120,142,192. Drawn in the+ /// default variant, the stronger tier (A2), so its glow (#2431) is on: the bound is the owner's #519 ruling's+ /// (docs/visual-v1.md, "Less pink, then merge", 2026-10-15).</summary>[UnityTest]public IEnumerator ThePrimaryStripeIsTheDeeperBlueOfTheRuling(){+ MapBorders.Variant = MapBorders.DefaultVariant;+ Assert.IsTrue(MapBorders.Strong(MapBorders.Variant), "the default is the stronger tier, which glows");var (map, cam, rig) = BorderTests.Open();yield return null;RenderSample.TiltShift(false);@@ -510,6 +514,9 @@ public class ControlTestsfloat md = d.OrderBy(x => x).ElementAt(d.Count / 2), mm = dMain.OrderBy(x => x).ElementAt(dMain.Count / 2);TestContext.WriteLine($"median deltaE76 to the ruling's blue {md:0.0}, to main's {mm:0.0}");Assert.Less(md, 10f, "about the ruling's deeper blue");+ // #519 (2026-10-15, "Less pink, then merge"): "bring the stripe back to about 3 deltaE76 of the ruled blue or less";+ // the stronger tier's glow (#2431) is carried by the halo, not by moving this stripe off the ruled blue.+ Assert.LessOrEqual(md, 3f, "the stronger tier's stripe: \"bring the stripe back to about 3 deltaE76 of the ruled blue or less\" (#519)");Assert.Less(md, mm, "nearer the deeper blue than main's lighter one");}/// <summary>Not a check: the contact sheet's raw renders (run on demand: -testFilter ControlTests.ContactSheetRenders, the