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.

Map: land use — strip fields, groves, garrigue and terraces (promo look, land cover) (#181)

Eyal Golanbe0b394838cd
diff --git a/ASSETS.yaml b/ASSETS.yaml
index b9e9d17e0..a5eb5891b 100644
--- a/ASSETS.yaml
+++ b/ASSETS.yaml
@@ -109,6 +109,11 @@ rules:
status: verified
note: "Public domain checked 2026-10-11: PD-UKGov (expired Crown copyright: 50 years from publication for published works, which HMSO treats as worldwide) and PD-scan, as Wikimedia Commons files the 1946 Survey of Palestine sheets (e.g. https://commons.wikimedia.org/wiki/File:Gaza_sh._04,_1946.jpg). Palestine Open Maps' About page calls its maps public domain under the UK Copyright, Designs and Patents Act and publishes no terms of its own for its tiles or georeferencing; the traced lines are our own derivative and copy none of its layers. No OpenStreetMap (ODbL) geometry is copied: OSM and OpenHistoricalMap lines are only measured against (tools/routes_accuracy.py, docs/routes.md)."
# --- Baked map textures (derived from the heightmap) ---
+ - glob: "unity/Assets/Textures/Map/landuse.png"
+ licence: Copernicus-DEM
+ source: "tools/land_bake.py (issue #33): the land-use colour and weight (procedural field parcels with farm tracks, garrigue, terraces and scrub) placed by: slope and water from the Copernicus DEM-derived heightmap (Copernicus-DEM); rainfall from CHELSA V2.1 bio12 (CC0-1.0) bias-corrected by the IMS station normals of content/map/precip_stations.json (data.gov.il dataset 481, IMS-data.gov.il, decision D6); content/map/hexes.json biomes (this project's own content, CC-BY-SA-4.0); and the town coordinates of content/map/settlements_1948.yaml (Wikipedia API, CC-BY-SA-4.0) for the citrus belt. Procedural, not AI-generated; attribution in NOTICE"
+ status: owner-verify
+ note: "Decision D13 (docs/oss/DECISIONS.md): the owner rules the licence of textures derived from DEM, CHELSA, IMS and coordinate inputs."
- glob: "unity/Assets/Textures/*"
licence: Copernicus-DEM
source: "tools/terrain_bake.py from the Copernicus DEM GLO-30-derived heightmap (unity/Assets/StreamingAssets/map/heightmap.*): AO, curvature, sky-view (Map/terrain_bake.png), coast distance (Map/coast.png) and the AO copy (Map/ao.png); attribution in NOTICE"
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c47ddda89..4fdef00d4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -50,6 +50,10 @@ adds a line under **Unreleased**; CI's `Changelog` job checks this (see `CONTRIB
roads and ballasted track with sleepers at the promo's scale. Each route shows only from its sourced date: the Burma
Road appears on 14 June 1948, when it was completed. Settlement buildings and trees keep clear of every route. A steam train is a showcase only (`?train`, `?units` and the
promo screenshots), not normal play. Map-only: the sim does not read them (#35).
+- Land use on the map (#33): a patchwork of strip fields (green, ochre stubble, ploughed, fallow, groves in the citrus
+ belt) with hedges and farm tracks, and garrigue, terraces and scrub on the wet hills, placed by real slope, rainfall and
+ towns and baked by `tools/land_bake.py`. Presentation only. Frame time: measured only on a busy machine so far (about
+ +0.9 ms at the gameplay zoom), not yet on an idle one.
### Changed
- Ben-Gurion's Transportation term ends on 24 December 1952, when the Fourth Government took office; the seat
diff --git a/docs/oss/DECISIONS.md b/docs/oss/DECISIONS.md
index a235e1884..09084540f 100644
--- a/docs/oss/DECISIONS.md
+++ b/docs/oss/DECISIONS.md
@@ -22,5 +22,6 @@ are already public. If a check fails, the file is removed from the tip with the
- [x] D10 I know that my personal email (commit d42bd6b, `promo/fetch_portraits.py`) and the internal plans, specs and research notes in history are public and cannot be removed (owner ruling: no history rewriting); key rotation is the only remedy for a secret. Decided (owner, 2026-10-10): acknowledged.
- [x] D11 The seven sensitive events (altalena, ten_days, operation_yoav, operation_hiram, operation_horev, bernadotte_assassination, reparations_claim) are sensitivity-reviewed: each event's YAML says `status: sensitivity-reviewed` (docs/m3-release.md, "OWNER STEP: sensitivity review"). The release gate also runs the sim's own check. Decided: the owner signed off all seven on 2026-10-10 for the itch.io build.
- [x] D12 Ruleset bypass. Recommended: the repository admin role bypasses `protect-main` always (you keep merging locally and pushing); everyone else needs review and green checks. Alternative: admins bypass only through a pull request. Decided (owner, 2026-10-10): the recommended admin bypass (`scripts/oss/github/ruleset-main-review.json`).
+- [ ] D13 Licence of the derived land-use texture `unity/Assets/Textures/Map/landuse.png` (`tools/land_bake.py`, issue #33; `ASSETS.yaml` row `owner-verify`). Owner answers four questions. (1) The 1948 settlement coordinates (`content/map/settlements_1948.yaml`, taken from the Wikipedia API, CC BY-SA 4.0) are facts, used only to place the citrus belt near the towns: does share-alike, or the EU database right for about 25 points taken from one source, reach a texture computed from them? (2) D6 found that the data.gov.il licence allows derivatives of the IMS station normals: confirm it covers landuse.png, whose rainfall is CHELSA corrected by them. (3) The Copernicus DEM licence allows redistributing derived products with its attribution (NOTICE carries it), and CHELSA V2.1 is CC0: confirm. (4) Which single `licence:` value does the row take: `Copernicus-DEM` (as now), or the most restrictive input (CC-BY-SA-4.0 if (1) says share-alike applies)? Decided:
- [ ] D-P Portraits: every `owner-verify` row in `ASSETS.portraits.yaml` checked on Commons for its US status, and the `promo/ref/*-src.jpg` and `*-sheet.jpg` provenance confirmed. Check on 2026-10-10: all 26 `owner-verify` rows (13 Government Press Office photos, 1948-1960, each used twice) carry only {{PD-Israel}}/{{PD-IsraelGov}} on Commons, with no US public-domain rationale; the URAA likely restored their US copyright (Israel protected them on 1996-01-01). Verdict: risk in the US. The promo/ref sheets and the AI likenesses in promo/final 04 and 08 derive from them. Needs the owner's call (replace with US-safe sources, see the issue for it). Decided:
- [x] D-H The AI concept art reproduces no Civilization VII icon, logo or wordmark: every image in `promo/final/` (`01` to `08`) and the hero (`docs/images/hero-concept-1936.jpg`), all prompted "in the style of Civilization VII". Owner looks at each. Decided (owner-delegated check, 2026-10-10): no Civilization, Firaxis or 2K logo, wordmark, leader portrait or copied icon in any of the nine images; 03 and the hero use generic AI-drawn yield glyphs whose colours echo Civ's.
diff --git a/docs/visual-v1.md b/docs/visual-v1.md
index aafd0f7ba..e358edfdc 100644
--- a/docs/visual-v1.md
+++ b/docs/visual-v1.md
@@ -1120,6 +1120,77 @@ Water and shore together (the toggle now covers both):
unmeasured.
- diorama02: 0.13 ms, below the noise (spread 0.18 ms).
- p95 is at or under 16.7 ms at both poses.
+## Promo track: land use (issue #33, branch promo-land)
+The flat mustard/olive ground becomes the promo's patchwork. `tools/land_bake.py` (no network, about 20 s, deterministic:
+`test_the_committed_textures_are_the_bake` checks the committed PNGs against a fresh bake) decides where from real data
+and paints what procedurally, baked:
+- where (158 x 211 m grid): fields on gentle slopes (< ~7%) with enough rain for dry farming (CHELSA bio12,
+ station-corrected as `hexgrid.py`: smoothstep 180-380 mm; the irrigated Jordan valley floor at least 0.7); the citrus
+ belt on the flat coastal plain and valley floor below 150 m near the 1948 towns (the hex-wise biome inputs softened over
+ 1.5 km, so nothing steps at hex edges); garrigue, terraces and scrub where the rain is 250-600 mm, the ground unfarmed
+ and not the shader's rock;
+- what (`landuse.png`, 2048 x 4096 RGBA, about 79 x 105 m): strip-field parcels in rotated 5 km blocks (green, ochre
+ stubble, ploughed, fallow, grass, groves), soft grassy rims, hedges, some block edges as farm tracks; on the wet hills patches
+ of stony soil and grass, terraces along the real contours every 40 m of rise, scrub; 2 x 2 samples per texel; sRGB
+ colour (the sampler decodes it) spread into the empty texels so mips and BC3 blocks never blend with black; weight in
+ alpha;
+- no roads between the towns: the first rounds joined each town to its three nearest with seeded meandering tracks
+ (`tracks.png`); a controller ruling removed them, as invented routes would draw a second road beside the real 1948 roads
+ and railways the roads track traces from the 1946 Survey of Palestine map (`tools/routes_1948.py`). A finer track
+ network, if wanted, is traced there, not generated.
+The shader lays the land between `ScGroundBase` and `ScGroundShade` (relief, AO and breakup shade the fields), up to the
+waterline: promo-sea's beach band (`ScShore`, drawn after) covers it where there is a beach, and fields reach the water
+where there is none (the Sea of Galilee, cliffs). The `land` visual toggle lerps it away: a visual switch, not a price
+(the sample still runs).
+
+**Why baked, not procedural in the shader.** The first cut drew the same pattern in the shader (about 150 instructions).
+WebGL headless, same night: base 2.72 / 9.76 ms (gameplay03 / diorama02 `all`), procedural 13.94 / 15.44; with a
+per-pixel `[branch]` and one shared noise 10.37 / 13.60; branch-free 9.58 / 13.58; flattened 10.91 / 15.01. The cost stayed
+when no pixel took the branch (`-land` 8.11 at gameplay03), and sampling the textures alone cost nothing (2.69 ms):
+most likely register pressure / occupancy from the shader's size (the GPU reserves registers for the worst path, and
+ANGLE may flatten the branch), not its arithmetic. Single builds differ by a few tenths of a millisecond, so the
+bisecting steps (fields alone +4.3 ms) are indicative only. The decision to bake holds either way.
+
+**Cost, measured base vs branch (separate builds; the toggle cannot price it).**
+- Night of 2026-10-11, idle machine: main base 2.72 / 9.76 ms -> promo-land (`4b3c307`, before the review fixes) 2.68 / 9.93
+ ms (`PROFILE summary visual=all pose=gameplay03 runs=3 median_avg_ms=2.68 spread_ms=0.09 median_p95_ms=5.00`,
+ `... pose=diorama02 ... median_avg_ms=9.93 spread_ms=0.02 median_p95_ms=11.00`): within the noise between builds.
+- Review round 1 (`24b540f` on promo-sea), A/B against the same branch with the land call cut from the shader
+ (`Builds/Web-noland`), profiled back to back while the machine was busy (another browser on the GPU: every number about
+ 5 ms above the night's): gameplay03 `all` 8.20 -> 9.09 ms (+0.89, spreads 0.09 / 0.07), `none` 7.10 -> 7.73; diorama02
+ `all` 14.07 -> 13.70 (-0.37, inside the spreads 0.49 / 0.25). p95 10 / 16 ms.
+- Idle re-measure (re-review R1): **not measured.** Waiting for a 1-minute load average under 3, checked every 5 minutes,
+ 2026-10-11 09:02-10:47 and 14:32-15:32: it went under 3 once (2.64 at 09:22), but the A/B taken then was still inflated
+ (`none` 7.36 ms at gameplay03 against the night's 2.33) and the branch half was disturbed (spreads up to 10 ms), so it
+ is not used; otherwise the load stayed between 3.9 and 51. The busy-machine A/B above is the only cost figure; re-measure
+ on an idle machine before the tier numbers are re-ratified.
+
+**Size and memory.** `landuse.png` is 10.7 MB in the build report (2048 x 4096 BC3 with mips: 10.7 MiB of GPU memory).
+The WebGL `.data` is LZ4-compressed, so the download grows less: `Web-disabled.data` 21.53 MB (promo-sea) -> 24.40 MB
+(+2.86 MB, then with the since-removed tracks texture's 0.02 MB). Halving the texture (the platforms' 2048 cap gives 1024 x 2048) blurred the
+hedges, rims and rows (gameplay03 local gradient on the plain 0.0220 -> 0.0174, -21%), so it stays 4096 rows; BC1 cannot
+hold the weight, so BC3 stays.
+
+**Platforms.** The default web build targets desktop browsers (S3TC/BC, as the map's other textures already need). The land
+texture's WebGL override pins only the size (4096) and leaves the format automatic, so the build's texture subtarget picks
+it: DXT5 by default; `Build.Web -textureSubtarget astc` (or `etc2`) makes a build for browsers without S3TC (iOS Safari,
+most Android Chrome), where the land is ASTC 6x6, 4.8 MB (`unity-build-astc.log`), and golden + smoke=5 pass. A desktop
+build opened on such a browser would decompress the land to RGBA32 on the CPU: 42.7 MiB. WebGL2 guarantees only 2048-texel
+textures; virtually every GPU offers 4096.
+
+Tests, review round 1: EditMode 465 passed (`LandUseTests`: import settings for every platform, the subtarget argument,
+`-extraPose` validation, the land follows slope/rain/towns, gameplay detail; `TheTerrainShaderCompilesForWebGL2`); tools
+pytest 194 passed; `dotnet test` 628; golden and smoke unchanged on `Web-disabled` and `Web-astc`.
+
+Colour (WebGL `?shot`, checkpoint `promo-land-r5` against `promo-sea-r2`): gameplay03 saturation 0.4792 -> 0.4681
+(promo 0.38), warmth 0.1018 -> 0.0921 (promo 0.064), contrast 0.1738 -> 0.1730, palette distance 0.5971 -> 0.5148;
+diorama02 saturation 0.4183 -> 0.4164 (bar <= 0.48), warmth 0.1171 -> 0.1154 (bar 0.087-0.145), palette distance
+0.5869 -> 0.5868. Open item 3: the land lowers gameplay03 saturation by 0.011. Open item 5: the olive plain / gold hills
+seam is now fields against garrigue, a softer step (owner to judge).
+Licence: the texture is `owner-verify` in `ASSETS.yaml` pending decision D13 (`docs/oss/DECISIONS.md`).
+Still different from the promo: soft at close zoom (rows, hedges and bushes read at the gameplay zoom, blur at 15-20 km
+and closer); terraces read faintly; the orchard ground and promo-art's groves follow separate rules; the promo's ground is warmer and browner under
+its grade.
## Open items for the art track
Each item below was ruled to the art track (controller, rank 10). None blocks landing the branch.
diff --git a/tools/README.md b/tools/README.md
index 83a86772d..ab1ab8d21 100644
--- a/tools/README.md
+++ b/tools/README.md
@@ -30,6 +30,10 @@ Offline data tools (uv inline-script Python). Run from the repo root.
alone, imported uncompressed) and `coast.png`
(exact signed Euclidean distance to the shoreline; lakes under 1 km2 count as land) from the committed heightmap (no
network). Re-run it whenever the heightmap changes; its PNG bytes are reproducible only on the same toolchain.
+- `land_bake.py` writes `unity/Assets/Textures/Map/landuse.png` (the land-use colour and weight: field parcels with
+ farm tracks, garrigue, terraces and scrub, placed by slope, rainfall and towns) from the heightmap, the CHELSA rainfall,
+ the hex biomes and the 1948 settlements (no network); `StatecraftLand.hlsl` lays it over the biome ground. Re-run it
+ whenever one of those inputs changes.
- `terrain_graph.py` writes `unity/Assets/Shaders/StatecraftTerrain.shadergraph` from Unity's "Terrain Simple" template
with one Custom Function node (`StatecraftTerrain.hlsl`); re-run it only when that function's inputs or outputs change.
- `art_compare.py` puts screenshots next to the promo image of their pose, writes deuteranopia and protanopia copies and
diff --git a/tools/land_bake.py b/tools/land_bake.py
new file mode 100644
index 000000000..c258a3b5e
--- /dev/null
+++ b/tools/land_bake.py
@@ -0,0 +1,330 @@
+# /// script
+# requires-python = ">=3.11"
+# dependencies = ["numpy==2.5.3", "pillow==12.3.0", "pyyaml==6.0.3"]
+# ///
+"""Land use for the terrain shader (issue #33): where the ground is farmed, planted or terraced, from real data,
+and what it looks like there, painted procedurally and baked (the shader only lays it over the biome ground:
+StatecraftLand.hlsl).
+
+Usage: uv run tools/land_bake.py (about 15 seconds; no network)
+Reads the committed heightmap (unity/Assets/StreamingAssets/map/heightmap.*), content/map/hexes.json (biomes),
+content/map/precip_bio12.* + precip_stations.json (CHELSA mean annual rainfall, station-corrected exactly as
+tools/hexgrid.py does) and content/map/settlements_1948.yaml. Where, on a WIDTH x HEIGHT grid (about 158 x 211 m):
+ fields: arable land: gentle slope (< ~7%) with enough rain for dry farming (smoothstep 180..380 mm; the Jordan
+ valley floor, irrigated, at least 0.7), outside water
+ orchards: the citrus belt: flat coastal plain or valley floor below 150 m within about 10 km of a town (exp(-d/7 km))
+ wet: rainfall smoothstep 250..600 mm: garrigue, terraces and scrub grow where it is high
+What (paint_land, seeded by map position only): field parcels in rotated blocks (green, ochre, ploughed, fallow, grass,
+groves in the citrus belt) with soft rims and hedges, some block edges as farm tracks; on the wet unfarmed hills patches of
+stony soil and grass, terraces along the real contours, scrub. Writes, row 0 = north:
+ unity/Assets/Textures/Map/landuse.png RGBA8, COLOUR_W x COLOUR_H (about 79 x 105 m): rgb the land's colour (sRGB,
+ spread into the empty texels), a its weight over the biome ground (2 x 2 samples per texel)
+The geography is real (slope, rain, towns); the parcels are procedural. Deterministic: the same PNG on every run."""
+import json
+import math
+import warnings
+from pathlib import Path
+
+import numpy as np
+import yaml
+from PIL import Image
+
+import hexgrid
+import terrain_bake as tb
+
+ROOT = Path(__file__).resolve().parents[1]
+MAP_DIR = ROOT / "unity" / "Assets" / "StreamingAssets" / "map"
+CONTENT = ROOT / "content" / "map"
+OUT = ROOT / "unity" / "Assets" / "Textures" / "Map" / "landuse.png"
+WIDTH, HEIGHT = 1024, 2048
+SLOPE_SMOOTH_M = 300.0 # the slope that decides "flat" is averaged over about this radius
+FLAT_SLOPE = (0.035, 0.075) # rise/run: fully arable below the first, none above the second
+RAIN_FIELDS_MM = (180.0, 380.0) # dry farming (barley in the northern Negev at about 200-250 mm)
+RAIN_WET_MM = (250.0, 600.0)
+VALLEY_IRRIGATED = 0.7
+ORCHARD_BELOW_M = 150.0
+ORCHARD_DECAY_KM = 7.0
+LAND_INTO_WATER = 3 # texels the land's masks reach past the shoreline (the shader's waterline cuts them)
+# The painted land (paint_land): field parcels, rims, hedges, block-edge tracks, garrigue, terraces and scrub, baked here
+# rather than drawn in the shader: the same pattern as procedural shader code cost about 5 ms a frame at gameplay03 on
+# WebGL even where no pixel ran it (docs/visual-v1.md, "Promo track: land use").
+COLOUR_W, COLOUR_H = 2048, 4096 # about 79 m east-west x 105 m north-south per texel
+TEXEL_M = 92.0 # mean texel size (m), for the terrace fade
+DILATE_PASSES = 32 # texels the colour spreads into empty ground: past the 16-texel footprint of mip 4
+SUPERSAMPLE = 2 # samples per texel per axis, box-filtered (the parcels' edges stay soft, not jagged)
+BLOCK_M = 5200.0 # a farm block, one angle per block
+STRIP_M = 1000.0 # strip width across the block (symbolic scale, like the kits)
+TERRACE_STEP_M = 40.0 # real metres of rise per terrace
+VERTICAL_EXAGGERATION = tb.VERTICAL_EXAGGERATION
+PALETTE_BRIGHTNESS, PALETTE_MAX = 1.107, 0.95 # MapPalette.Brightness and MaxChannel: the land sits in the biome palette
+SRGB = { # the land's colours (sRGB, before PALETTE_BRIGHTNESS), sampled from promo/final/03's ground and tuned on renders
+ "green": (0.46, 0.50, 0.31), "ochre": (0.78, 0.66, 0.44), "plough": (0.58, 0.47, 0.34), "fallow": (0.72, 0.66, 0.51),
+ "grass": (0.52, 0.54, 0.33), "orchard": (0.52, 0.47, 0.31), "hedge": (0.27, 0.30, 0.18), "dust": (0.84, 0.76, 0.61),
+ "soil": (0.66, 0.57, 0.46), "hillgrass": (0.56, 0.55, 0.37), "stone": (0.74, 0.68, 0.56), "scrub": (0.34, 0.36, 0.22),
+}
+
+
+def smoothstep(e0: float, e1: float, x: np.ndarray) -> np.ndarray:
+ t = np.clip((x - e0) / (e1 - e0), 0.0, 1.0)
+ return t * t * (3 - 2 * t)
+
+
+def bilinear(a: np.ndarray, fy: np.ndarray, fx: np.ndarray) -> np.ndarray:
+ """a sampled at fractional (row, col) positions, clamped to the edges."""
+ h, w = a.shape
+ fy = np.clip(fy, 0, h - 1); fx = np.clip(fx, 0, w - 1)
+ y0 = np.minimum(np.floor(fy).astype(int), h - 2); x0 = np.minimum(np.floor(fx).astype(int), w - 2)
+ ty, tx = fy - y0, fx - x0
+ return ((a[y0, x0] * (1 - tx) + a[y0, x0 + 1] * tx) * (1 - ty) + (a[y0 + 1, x0] * (1 - tx) + a[y0 + 1, x0 + 1] * tx) * ty)
+
+
+def texel_km(meta: dict) -> tuple[np.ndarray, np.ndarray]:
+ """(x km east of lon0, y km south of lat1) of every output texel centre, shape (HEIGHT, WIDTH)."""
+ ys, xs = np.mgrid[0:HEIGHT, 0:WIDTH]
+ return (xs + 0.5) / WIDTH * meta["width_km"], (ys + 0.5) / HEIGHT * meta["length_km"]
+
+
+def slope_map(elev: np.ndarray, meta: dict) -> np.ndarray:
+ dx, dy = tb.spacing_m(meta)
+ gy, gx = np.gradient(elev.astype(np.float64), dy, dx)
+ s = np.hypot(gx, gy)
+ return tb.box_mean(s, max(1, round(SLOPE_SMOOTH_M / dy)), max(1, round(SLOPE_SMOOTH_M / dx)))
+
+
+def rain_at(xk: np.ndarray, yk: np.ndarray, meta: dict) -> np.ndarray:
+ pr = hexgrid.load_corrected_precip(CONTENT)
+ m = pr["meta"]
+ mm = pr["mm"].copy()
+ # Sea cells are NaN: fill each with the mean of its finite neighbours, repeatedly, so the coast's rain reaches the shore.
+ for _ in range(4):
+ nan = np.isnan(mm)
+ if not nan.any():
+ break
+ p = np.pad(mm, 1, mode="edge")
+ stack = np.stack([p[1 + oy:1 + oy + mm.shape[0], 1 + ox:1 + ox + mm.shape[1]] for oy in (-1, 0, 1) for ox in (-1, 0, 1)])
+ with np.errstate(invalid="ignore"), warnings.catch_warnings():
+ warnings.simplefilter("ignore", RuntimeWarning)
+ fill = np.nanmean(stack, axis=0)
+ mm = np.where(nan, fill, mm)
+ mm = np.nan_to_num(mm, nan=0.0)
+ lon = meta["lon0"] + xk / hexgrid.km_per_deg_lon(meta)
+ lat = meta["lat1"] - yk / hexgrid.KM_PER_DEG_LAT
+ return bilinear(mm, (m["lat1"] - lat) / m["cell_deg"] - 0.5, (lon - m["lon0"]) / m["cell_deg"] - 0.5)
+
+
+def biome_at(xk: np.ndarray, yk: np.ndarray, hexes: dict) -> np.ndarray:
+ lookup = {(h["q"], h["r"]): h["biome"] for h in hexes["hexes"]}
+ q, r = hexgrid.point_to_hex(xk.ravel(), yk.ravel(), hexes["hex_size_km"])
+ return np.array([lookup.get(k, "sea") for k in zip(q, r)]).reshape(xk.shape)
+
+
+def settlements_km(meta: dict) -> list[tuple[str, float, float]]:
+ doc = yaml.safe_load((CONTENT / "settlements_1948.yaml").read_text())
+ return [(s["id"], *hexgrid.lonlat_to_km(s["lon"], s["lat"], meta)) for s in doc["settlements"]]
+
+
+def linear(srgb: tuple[float, float, float]) -> np.ndarray:
+ """An SRGB colour at the palette's brightness, in linear light (the texture holds linear values, like the biome
+ texture's sampled colour)."""
+ c = np.minimum(np.array(srgb) * PALETTE_BRIGHTNESS, PALETTE_MAX)
+ return np.where(c <= 0.04045, c / 12.92, ((c + 0.055) / 1.055) ** 2.4)
+
+
+def hash01(*ints: np.ndarray) -> np.ndarray:
+ """A deterministic hash of integer lattice coordinates to [0, 1) (uint64 arithmetic: the same on every platform)."""
+ h = np.uint64(0x9E3779B97F4A7C15)
+ for i, v in enumerate(ints):
+ k = np.asarray(v).astype(np.int64).astype(np.uint64) * np.uint64(0xBF58476D1CE4E5B9 + 2 * i)
+ h = (h ^ k) * np.uint64(0x94D049BB133111EB)
+ h ^= h >> np.uint64(31)
+ return (h >> np.uint64(11)).astype(np.float64) / float(1 << 53)
+
+
+def value_noise(x: np.ndarray, y: np.ndarray, seed: int) -> np.ndarray:
+ xi, yi = np.floor(x), np.floor(y)
+ fx, fy = x - xi, y - yi
+ ux, uy = fx * fx * (3 - 2 * fx), fy * fy * (3 - 2 * fy)
+ xi, yi = xi.astype(np.int64), yi.astype(np.int64)
+ a, b = hash01(xi, yi, seed), hash01(xi + 1, yi, seed)
+ c, d = hash01(xi, yi + 1, seed), hash01(xi + 1, yi + 1, seed)
+ return (a + (b - a) * ux) * (1 - uy) + (c + (d - c) * ux) * uy
+
+
+def paint_samples(x: np.ndarray, y: np.ndarray, fields: np.ndarray, orchards: np.ndarray, wet: np.ndarray,
+ elev: np.ndarray, grad: np.ndarray) -> tuple[np.ndarray, np.ndarray]:
+ """Linear colour (..., 3) and weight (...) of the land at map points (x m east, y m north; elev real metres, grad its
+ rise per metre). Weight 0 leaves the biome's own ground."""
+ col = {k: linear(v) for k, v in SRGB.items()}
+ patch = value_noise(x / 2600.0 + 3.1, y / 2600.0 + 3.1, 1) # one patch noise for every patchy choice
+ # Farm blocks: a wobbled grid, each block turned by up to +-20 degrees (a few by 90) about its own centre.
+ wx = 0.275 * np.sin(y / 4100.0 + np.sin(x / 6700.0))
+ wy = 0.275 * np.sin(x / 3900.0 + np.sin(y / 5300.0))
+ bpx, bpy = x / BLOCK_M + wx, y / BLOCK_M + wy
+ bix, biy = np.floor(bpx), np.floor(bpy)
+ bfx, bfy = bpx - bix, bpy - biy
+ bh = hash01(bix, biy, 2)
+ ang = (bh - 0.5) * 0.7 + np.where(bh > 0.8, math.pi / 2, 0.0)
+ qx, qy = (bfx - 0.5) * BLOCK_M, (bfy - 0.5) * BLOCK_M
+ lx, ly = np.cos(ang) * qx - np.sin(ang) * qy, np.sin(ang) * qx + np.cos(ang) * qy
+ # Strips across the block, each cut into parcels of its own length (1.1-2.6 km).
+ sx = lx / STRIP_M + bh * 7.0
+ ci = np.floor(sx)
+ ch = hash01(ci, bix, biy, 3)
+ len_m = 1100.0 + 1500.0 * ch
+ sy = ly / len_m + ch * 5.0
+ pj = np.floor(sy)
+ ph, pv, po = hash01(ci, pj, bix, biy, 4), hash01(ci, pj, bix, biy, 5), hash01(ci, pj, bix, biy, 6)
+ edge_m = np.minimum(np.minimum(sx - ci, ci + 1 - sx) * STRIP_M, np.minimum(sy - pj, pj + 1 - sy) * len_m)
+ # The crop: 0.30 green, 0.20 ochre, 0.17 ploughed, 0.13 fallow, 0.20 grass; in the citrus belt up to 55% groves.
+ kinds = [(0.30, "green", 0.20), (0.50, "ochre", 0.08), (0.67, "plough", 0.24), (0.80, "fallow", 0.0), (1.01, "grass", 0.0)]
+ crop = np.zeros(x.shape + (3,)); gain = np.zeros(x.shape); done = np.zeros(x.shape, dtype=bool)
+ for upto, name, g in kinds:
+ m = ~done & (ph < upto)
+ crop[m] = col[name]; gain[m] = g; done |= m
+ grove = po < orchards * 0.55
+ crop[grove] = col["orchard"]; gain[grove] = 0.12
+ rows = 0.6 * np.sin(lx * (2 * math.pi / 320.0)) # rows (symbolic: 320 m apart, about 3 texels)
+ crop *= ((1 + gain * rows) * (0.92 + 0.16 * pv))[..., None]
+ rim = smoothstep(20.0, 90.0, edge_m)[..., None] # soft grassy rims (promo 03)
+ farmed = col["grass"] * (1 - rim) + crop * rim
+ hedge = ((edge_m < 18.0) & (pv > 0.45))[..., None]
+ farmed = np.where(hedge, farmed * 0.3 + col["hedge"] * 0.7, farmed)
+ block_edge_m = np.minimum(np.minimum(bfx, 1 - bfx), np.minimum(bfy, 1 - bfy)) * BLOCK_M
+ edge_track = ((block_edge_m < 30.0) & (hash01(np.floor(bpx + 0.5), np.floor(bpy + 0.5), bix, biy, 7) > 0.65))[..., None]
+ farmed = np.where(edge_track, col["dust"] * 0.85 + farmed * 0.15, farmed)
+ farm_w = fields * smoothstep(0.08, 0.22, patch * 0.6 + fields * 0.5)
+
+ # The wet unfarmed hills: patches of stony soil and grass (garrigue), terraces on the slopes, scrub.
+ slope = 1.0 - 1.0 / np.sqrt(1.0 + (VERTICAL_EXAGGERATION * grad) ** 2) # the shader's 1 - n.y on the drawn relief
+ wild = wet * (1 - farm_w)
+ hill = (col["soil"] * (1 - smoothstep(0.35, 0.65, patch))[..., None] + col["hillgrass"] * smoothstep(0.35, 0.65, patch)[..., None])
+ tf = np.mod(elev / TERRACE_STEP_M, 1.0)
+ steps_per_texel = grad * TEXEL_M / TERRACE_STEP_M
+ terrace = (smoothstep(0.05, 0.10, slope) * (1 - smoothstep(0.45, 0.65, slope)) * smoothstep(120.0, 320.0, elev)
+ * smoothstep(0.55, 0.70, 1 - patch) * (1 - smoothstep(0.35, 0.8, steps_per_texel)))[..., None]
+ terraced = hill * (0.78 + 0.24 * tf)[..., None]
+ terraced = np.where((tf > 0.75)[..., None], terraced * 0.65 + col["stone"] * 0.35, terraced)
+ hill = hill * (1 - terrace) + terraced * terrace
+ scrub = (0.14 + 0.2 * smoothstep(0.55, 0.85, patch)) * (1 - smoothstep(0.5, 0.8, slope))
+ speck = (hash01(np.floor(x / 160.0), np.floor(y / 160.0), 8) < 0.30) * (1 - smoothstep(0.5, 0.8, slope)) * 0.7 # bushes
+ hill = hill * (1 - np.maximum(scrub, speck))[..., None] + col["scrub"] * np.maximum(scrub, speck)[..., None]
+ # Not on the steep faces, where the shader draws rock (ScGroundBase: smoothstep(0.22, 0.45, slope), review M5).
+ wild_w = wild * smoothstep(80.0, 250.0, elev) * 0.7 * (1 - smoothstep(0.22, 0.45, slope))
+
+ w = farm_w + wild_w
+ colour = (farmed * farm_w[..., None] + hill * wild_w[..., None]) / np.maximum(w, 1e-6)[..., None]
+ return colour, np.clip(w, 0.0, 1.0)
+
+
+def paint_land(fields: np.ndarray, orchards: np.ndarray, wet: np.ndarray, elev: np.ndarray, meta: dict) -> np.ndarray:
+ """RGBA8 COLOUR_W x COLOUR_H (row 0 = north): rgb the land's linear colour, a its weight, from SUPERSAMPLE^2 samples per
+ texel. The masks are WIDTH x HEIGHT, the elevation the heightmap's (row 0 = north)."""
+ width_m, length_m = meta["width_km"] * 1000, meta["length_km"] * 1000
+ dx, dy = tb.spacing_m(meta)
+ gy, gx = np.gradient(elev.astype(np.float64), dy, dx)
+ grad = np.hypot(gx, gy)
+ out = np.zeros((COLOUR_H, COLOUR_W, 4))
+ ss = SUPERSAMPLE
+ offs = (np.arange(ss) + 0.5) / ss
+ chunk = 256
+ for r0 in range(0, COLOUR_H, chunk):
+ rows = np.arange(r0, min(r0 + chunk, COLOUR_H))
+ fr = (rows[:, None] + offs[None, :]).ravel() # sample rows (texel units, 0 = north edge)
+ fc = (np.arange(COLOUR_W)[:, None] + offs[None, :]).ravel()
+ FR, FC = np.meshgrid(fr, fc, indexing="ij")
+ x = FC / COLOUR_W * width_m
+ y = length_m - FR / COLOUR_H * length_m
+ my, mx = FR / COLOUR_H * HEIGHT - 0.5, FC / COLOUR_W * WIDTH - 0.5
+ hy, hx = FR / COLOUR_H * (meta["height"] - 1), FC / COLOUR_W * (meta["width"] - 1)
+ c, w = paint_samples(x, y, bilinear(fields, my, mx), bilinear(orchards, my, mx), bilinear(wet, my, mx),
+ bilinear(elev.astype(np.float64), hy, hx), bilinear(grad, hy, hx))
+ rgbw = np.concatenate([c * w[..., None], w[..., None]], axis=-1) # premultiplied, so the box filter weighs colour
+ n = len(rows)
+ rgbw = rgbw.reshape(n, ss, COLOUR_W, ss, 4).mean(axis=(1, 3))
+ out[rows] = np.concatenate([rgbw[..., :3] / np.maximum(rgbw[..., 3:], 1e-6), rgbw[..., 3:]], axis=-1)
+ out[..., :3] = dilate_colour(out[..., :3], out[..., 3] > 0.5 / 255)
+ out[..., :3] = encode_srgb(out[..., :3])
+ return tb.to_u8(out)
+
+
+def encode_srgb(c: np.ndarray) -> np.ndarray:
+ """Linear -> sRGB: the texture imports as sRGB, so the GPU decodes it and 8 bits (and BC3's endpoints) spend their
+ precision where the eye does (review M3: linear storage stepped the dark hedge and scrub tones by 5-15%)."""
+ c = np.clip(c, 0.0, 1.0)
+ return np.where(c <= 0.0031308, c * 12.92, 1.055 * np.power(c, 1 / 2.4) - 0.055)
+
+
+def shift(a: np.ndarray, oy: int, ox: int) -> np.ndarray:
+ """out[y, x] = a[y + oy, x + ox] over the first two axes, the border repeated beyond it."""
+ p = np.pad(a, ((1, 1), (1, 1)) + ((0, 0),) * (a.ndim - 2), mode="edge")
+ return p[1 + oy:1 + oy + a.shape[0], 1 + ox:1 + ox + a.shape[1]]
+
+
+def dilate_colour(rgb: np.ndarray, filled: np.ndarray, passes: int = DILATE_PASSES) -> np.ndarray:
+ """Spreads the land's colour into the empty texels (weight 0): each pass gives every empty texel the mean colour of its
+ filled 4-neighbours, the rest end as the mean land colour. Mips and BC3 blocks then blend land colour with land
+ colour, not with black (review M4: the colour darkened by 8% at partial weights by mip 4)."""
+ rgb, filled = rgb.copy(), filled.copy()
+ for _ in range(passes):
+ acc = np.zeros_like(rgb); n = np.zeros(filled.shape)
+ for oy, ox in ((1, 0), (-1, 0), (0, 1), (0, -1)):
+ f = shift(filled.astype(np.float64), oy, ox)
+ acc += shift(rgb, oy, ox) * f[..., None]; n += f
+ grow = ~filled & (n > 0)
+ rgb[grow] = acc[grow] / n[grow][..., None]
+ filled |= grow
+ rgb[~filled] = rgb[filled].mean(axis=0) if filled.any() else 0.0
+ return rgb
+
+
+def bake() -> np.ndarray:
+ elev, meta = tb.load_heightmap(MAP_DIR)
+ hexes = json.loads((CONTENT / "hexes.json").read_text())
+ xk, yk = texel_km(meta)
+ hy = yk / meta["length_km"] * (meta["height"] - 1) # heightmap row (0 = north) and column of each texel
+ hx = xk / meta["width_km"] * (meta["width"] - 1)
+ e = bilinear(elev.astype(np.float64), hy, hx)
+ slope = bilinear(slope_map(elev, meta), hy, hx)
+ dx, dy = tb.spacing_m(meta)
+ water_hm = tb.water_mask(elev, dx, dy).astype(np.float64)
+ water = bilinear(water_hm, hy, hx) > 0.5
+ rain = rain_at(xk, yk, meta)
+ biome = biome_at(xk, yk, hexes)
+ # Hex-wise inputs, softened over about 1.5 km so the land does not step at hex edges (review M6).
+ sx_t, sy_t = WIDTH / meta["width_km"], HEIGHT / meta["length_km"]
+ soften = lambda a: tb.box_mean(tb.box_mean(a.astype(np.float64), round(0.75 * sy_t), round(0.75 * sx_t)),
+ round(0.75 * sy_t), round(0.75 * sx_t))
+ valley = soften(biome == "valley")
+
+ flat = 1.0 - smoothstep(*FLAT_SLOPE, slope)
+ farm_rain = np.maximum(smoothstep(*RAIN_FIELDS_MM, rain), valley * VALLEY_IRRIGATED)
+ fields = flat * farm_rain
+
+ towns = settlements_km(meta)
+ d_town = np.full(xk.shape, np.inf)
+ for _, x, y in towns:
+ d_town = np.minimum(d_town, np.hypot(xk - x, yk - y))
+ lowland = soften((e < ORCHARD_BELOW_M) & np.isin(biome, ("coastal_plain", "valley")))
+ orchards = lowland * flat * farm_rain * np.clip(1.4 * np.exp(-d_town / ORCHARD_DECAY_KM) - 0.15, 0, 1)
+
+ wet = smoothstep(*RAIN_WET_MM, rain)
+
+ # The land reaches LAND_INTO_WATER texels (about 0.5 km) into the water, so it meets the shore wherever the shader's
+ # waterline puts it, with no bare strip (review M7); the shader draws water over it.
+ land = water.copy()
+ for _ in range(LAND_INTO_WATER):
+ land = tb.shrink(land)
+ land = ~land
+ rgba = paint_land(fields * land, orchards * land, wet * land, elev, meta)
+ return rgba
+
+
+def main() -> None:
+ rgba = bake()
+ OUT.parent.mkdir(parents=True, exist_ok=True)
+ Image.fromarray(rgba, "RGBA").save(OUT)
+ print(f"wrote {OUT} ({COLOUR_W} x {COLOUR_H}): land weight mean {rgba[..., 3].mean() / 255:.3f}")
+
+
+if __name__ == "__main__":
+ main()
diff --git a/tools/terrain_graph.py b/tools/terrain_graph.py
index 3a116f49b..f92a9d9c2 100644
--- a/tools/terrain_graph.py
+++ b/tools/terrain_graph.py
@@ -6,7 +6,7 @@
"Terrain Simple" Terrain Lit template with its sample nodes, groups, notes and HDRP target removed, and one Custom
Function node (File mode, m_SourceType 0: StatecraftTerrain.hlsl, function StatecraftTerrain; the graph and every added
node at single precision) that takes the terrain UV, the absolute world position and normal and three blackboard
-textures (_ScBakeTex, _ScCoastTex, _ScAoTex) and feeds every fragment block. All shading lives in the HLSL file;
+textures (_ScBakeTex, _ScCoastTex, _ScAoTex, _ScLandTex) and feeds every fragment block. All shading lives in the HLSL file;
re-run this only when the node's inputs or outputs change. Slot objects are copied from the template's own slots, so
they match the installed Shader Graph version. Object ids are UUID5s: the output is deterministic.
@@ -30,10 +30,11 @@ SINGLE = 1 # Precision.Single (node precision)
GRAPH_SINGLE = 0 # GraphPrecision.Single (the template's is Half, 2: an inheriting node would run at mediump on GLES3)
URP = "UnityEditor.Rendering.Universal."
FILE_MODE = 0 # HlslSourceType.File (Shader Graph: enum HlslSourceType { File, String })
-# display name, reference, function slot; the AO is its own uncompressed texture (Task 6 fix round 1: BC1 banded it)
-TEXTURES = [("ScBakeTex", "_ScBakeTex", 3), ("ScCoastTex", "_ScCoastTex", 4), ("ScAoTex", "_ScAoTex", 5)]
+# display name, reference, function slot; the AO is its own uncompressed texture (Task 6 fix round 1: BC1 banded it); the
+# land use (tools/land_bake.py, issue #33) came later, so its slot id follows the outputs' and those stay unchanged
+TEXTURES = [("ScBakeTex", "_ScBakeTex", 3), ("ScCoastTex", "_ScCoastTex", 4), ("ScAoTex", "_ScAoTex", 5), ("ScLandTex", "_ScLandTex", 12)]
INPUTS = [(0, "UV", "Vector2"), (1, "PositionWS", "Vector3"), (2, "NormalWS", "Vector3"),
- (3, "Bake", "Texture2DInput"), (4, "Coast", "Texture2DInput"), (5, "Ao", "Texture2DInput")]
+ (3, "Bake", "Texture2DInput"), (4, "Coast", "Texture2DInput"), (5, "Ao", "Texture2DInput"), (12, "Land", "Texture2DInput")]
OUTPUTS = [(6, "BaseColor", "Vector3", "SurfaceDescription.BaseColor"), (7, "NormalOut", "Vector3", "SurfaceDescription.NormalWS"),
(8, "Occlusion", "Vector1", "SurfaceDescription.Occlusion"), (9, "Smoothness", "Vector1", "SurfaceDescription.Smoothness"),
(10, "Metallic", "Vector1", "SurfaceDescription.Metallic"), (11, "Emission", "Vector3", "SurfaceDescription.Emission")]
diff --git a/tools/tests/test_land_bake.py b/tools/tests/test_land_bake.py
new file mode 100644
index 000000000..51b2aea08
--- /dev/null
+++ b/tools/tests/test_land_bake.py
@@ -0,0 +1,64 @@
+import numpy as np
+import pytest
+from PIL import Image
+
+import land_bake as lb
+
+
+def test_the_hash_is_deterministic_uniform_and_seeded():
+ i = np.arange(-500, 500)
+ h = lb.hash01(i, i * 3, 7)
+ assert np.array_equal(h, lb.hash01(i, i * 3, 7)) and not np.array_equal(h, lb.hash01(i, i * 3, 8))
+ assert h.min() >= 0.0 and h.max() < 1.0 and abs(h.mean() - 0.5) < 0.05
+
+
+def test_the_painted_land_is_weighted_by_the_masks_and_holds_every_crop():
+ x, y = np.meshgrid(np.arange(0, 20000, 50.0), np.arange(0, 20000, 50.0))
+ zero, one = np.zeros_like(x), np.ones_like(x)
+ _, w = lb.paint_samples(x, y, zero, zero, zero, zero + 50.0, zero)
+ assert w.max() == 0.0 # no fields, not wet: the biome's ground
+ c, w = lb.paint_samples(x, y, one, zero, zero, zero + 50.0, zero)
+ assert w.mean() > 0.8 and np.isfinite(c).all() # farmed: parcels nearly everywhere
+ # Each crop covers a share of the ground (its colour, give or take the rows and the parcel's shade).
+ for name, share in (("green", 0.10), ("ochre", 0.08), ("plough", 0.06), ("fallow", 0.04)):
+ ref = lb.linear(lb.SRGB[name])
+ near = np.linalg.norm(c / np.maximum(c.mean(axis=-1, keepdims=True), 1e-6) - ref / ref.mean(), axis=-1) < 0.06
+ assert near.mean() > share, name
+
+
+def test_empty_texels_take_the_neighbouring_land_colour():
+ rgb = np.zeros((8, 8, 3)); filled = np.zeros((8, 8), dtype=bool)
+ rgb[:, :2] = (0.5, 0.4, 0.2); filled[:, :2] = True
+ out = lb.dilate_colour(rgb, filled, passes=8)
+ assert np.allclose(out, (0.5, 0.4, 0.2)), "no black spreads into the mips"
+
+
+def test_the_land_reaches_into_the_water_and_avoids_the_rock():
+ x, y = np.meshgrid(np.arange(0, 5000, 50.0), np.arange(0, 5000, 50.0))
+ zero, one = np.zeros_like(x), np.ones_like(x)
+ _, w_flat = lb.paint_samples(x, y, zero, zero, one, zero + 400.0, zero)
+ _, w_cliff = lb.paint_samples(x, y, zero, zero, one, zero + 400.0, zero + 1.0) # rise 1 per metre: rock
+ assert w_flat.mean() > 0.5 and w_cliff.max() < 0.01
+
+
[email protected](scope="module")
+def baked():
+ return lb.bake()
+
+
+def test_the_committed_texture_is_the_bake(baked):
+ # Review M11: the committed PNG must be what tools/land_bake.py makes from today's inputs (about 20 s).
+ assert np.array_equal(np.asarray(Image.open(lb.OUT)), baked), "landuse.png is stale: run uv run tools/land_bake.py"
+
+
+def test_the_committed_texture_has_its_size_and_follows_the_ground():
+ land = np.asarray(Image.open(lb.OUT))
+ assert land.shape == (lb.COLOUR_H, lb.COLOUR_W, 4)
+
+ def weight(lon, lat):
+ r, c = int((33.35 - lat) / 3.9 * land.shape[0]), int((lon - 34.2) / 1.7 * land.shape[1])
+ return land[r - 6:r + 7, c - 6:c + 7, 3].mean() / 255
+ assert weight(34.84, 31.92) > 0.8 and weight(35.30, 32.62) > 0.8 # the coastal plain and the Jezreel valley farmed
+ assert weight(34.90, 30.60) < 0.02 and weight(35.50, 31.50) < 0.02 # the central Negev and the Dead Sea untouched
+ assert weight(35.15, 31.78) > 0.4 # garrigue and terraces on the Judean hills
+ assert land[..., :3][land[..., 3] == 0].min(axis=0).max() > 0, "the empty texels hold land colour, not black"
diff --git a/tools/tests/test_terrain_graph.py b/tools/tests/test_terrain_graph.py
index 3a9ef4c08..45751ffa5 100644
--- a/tools/tests/test_terrain_graph.py
+++ b/tools/tests/test_terrain_graph.py
@@ -93,7 +93,7 @@ def test_the_textures_are_blackboard_properties_with_the_shaders_names():
objs, by_id = built()
graph = objs[0]
props = [by_id[p["m_Id"]] for p in graph["m_Properties"]]
- assert [p["m_DefaultReferenceName"] for p in props] == ["_ScBakeTex", "_ScCoastTex", "_ScAoTex"]
+ assert [p["m_DefaultReferenceName"] for p in props] == ["_ScBakeTex", "_ScCoastTex", "_ScAoTex", "_ScLandTex"]
cat = next(o for o in objs if tg.kind(o) == "CategoryData")
assert [c["m_Id"] for c in cat["m_ChildObjectList"]] == [p["m_ObjectId"] for p in props]
assert next(o for o in objs if tg.kind(o) == "UniversalTarget")["m_CastShadows"] is True
diff --git a/unity/Assets/Editor/Build.cs b/unity/Assets/Editor/Build.cs
index ef6e43a9b..76e6fa01f 100644
--- a/unity/Assets/Editor/Build.cs
+++ b/unity/Assets/Editor/Build.cs
@@ -12,7 +12,9 @@ namespace Statecraft.Game.EditorTools
/// <summary>Headless player builds. Map.unity is the boot scene; ContentSync copies content/ into StreamingAssets
/// first (IPreprocessBuildWithReport). Exits non-zero on failure.
/// Web: Unity -batchmode -CI false -GITHUB_ACTIONS false -TF_BUILD false -quit -projectPath unity -buildTarget WebGL -executeMethod Statecraft.Game.EditorTools.Build.Web
- /// [-compression disabled|gzip|brotli] [-out Builds/Web-disabled]
+ /// [-compression disabled|gzip|brotli] [-out Builds/Web-disabled] [-textureSubtarget dxt|etc2|astc]
+ /// (-textureSubtarget: the compressed format of every automatic texture; the default build is DXT, for desktop
+ /// browsers; astc or etc2 makes a build for browsers without S3TC, as on phones)
/// Mac: Unity -batchmode -CI false -GITHUB_ACTIONS false -TF_BUILD false -quit -projectPath unity -buildTarget OSXUniversal -executeMethod Statecraft.Game.EditorTools.Build.Mac
/// [-out Builds/Mac/Statecraft.app] [-ffp-contract-off]</summary>
public static class Build
@@ -34,6 +36,16 @@ namespace Statecraft.Game.EditorTools
_ => throw new ArgumentException($"-compression must be disabled, gzip or brotli (got '{name}')"),
};
+ /// <summary>The WebGL texture subtarget named by -textureSubtarget (Unity's own default when absent).</summary>
+ public static WebGLTextureSubtarget? TextureSubtarget(string? name) => name switch
+ {
+ null => null,
+ "dxt" => WebGLTextureSubtarget.DXT,
+ "etc2" => WebGLTextureSubtarget.ETC2,
+ "astc" => WebGLTextureSubtarget.ASTC,
+ _ => throw new ArgumentException($"-textureSubtarget must be dxt, etc2 or astc (got '{name}')"),
+ };
+
/// <summary>Why a shareable build may not be made, or null: every event with a sensitive tag needs the owner's
/// sensitivity review first (status sensitivity-reviewed; docs/m3-release.md, M3 final review I4).</summary>
public static string? ShareableRefusal(Statecraft.Sim.Content c)
@@ -66,9 +78,12 @@ namespace Statecraft.Game.EditorTools
ProjectSetup.Apply();
PlayerSettings.WebGL.compressionFormat = Compression(name);
PlayerSettings.WebGL.decompressionFallback = false; // itch.io serves .br/.gz with Content-Encoding
+ var savedSubtarget = EditorUserBuildSettings.webGLBuildSubtarget;
+ var sub = TextureSubtarget(Arg("-textureSubtarget"));
+ if (sub.HasValue) EditorUserBuildSettings.webGLBuildSubtarget = sub.Value;
bool ok;
- try { ok = Run(BuildTarget.WebGL, Arg("-out") ?? "Builds/Web-" + name); }
- finally { ProjectSetup.Apply(); } // back to the committed settings (compression Disabled)
+ try { ok = Run(BuildTarget.WebGL, Arg("-out") ?? "Builds/Web-" + name, sub.HasValue ? (int)sub.Value : 0); }
+ finally { EditorUserBuildSettings.webGLBuildSubtarget = savedSubtarget; ProjectSetup.Apply(); } // back to the committed settings
ExitIfFailed(ok);
}
@@ -94,11 +109,12 @@ namespace Statecraft.Game.EditorTools
return Directory.Exists(path) ? new DirectoryInfo(path).EnumerateFiles("*", SearchOption.AllDirectories).Sum(f => f.Length) / 1048576.0 : 0;
}
- static bool Run(BuildTarget target, string location)
+ static bool Run(BuildTarget target, string location, int subtarget = 0)
{
var report = BuildPipeline.BuildPlayer(new BuildPlayerOptions
{
scenes = new[] { ProjectSetup.BootScene }, locationPathName = location, target = target, options = BuildOptions.None,
+ subtarget = subtarget, // WebGL: the texture subtarget (0, Generic: the project's own setting)
});
var s = report.summary;
Debug.Log($"BUILD {s.result} {target} -> {location}: {OutputMegabytes(location):0.0} MB on disk, {s.totalErrors} errors, {s.totalTime.TotalSeconds:0}s");
diff --git a/unity/Assets/Editor/MapCapture.cs b/unity/Assets/Editor/MapCapture.cs
index 0d7ae1a3f..bb73a4a4a 100644
--- a/unity/Assets/Editor/MapCapture.cs
+++ b/unity/Assets/Editor/MapCapture.cs
@@ -1,4 +1,6 @@
+using System.Collections.Generic;
using System.IO;
+using System.Linq;
using Statecraft.Game;
using Statecraft.Game.EditorTools;
using Statecraft.Game.Boot;
@@ -150,7 +152,7 @@ public static class MapCapture
for (int level = 0; level < QualitySettings.names.Length; level++)
{
QualitySettings.SetQualityLevel(level, true);
- foreach (var pose in PromoPose.All)
+ foreach (var pose in Poses(args))
{
pose.Apply(rig, map.Frame);
Save(Camera.main, 1920, 1080, Path.Combine(dir, $"{QualitySettings.names[level]}-{pose.Name}.png"));
@@ -160,6 +162,37 @@ public static class MapCapture
finally { QualitySettings.SetQualityLevel(saved, true); }
}
+ /// <summary>PromoPose.All, plus any "-extraPose name:lon:lat:distanceM:yaw" given (close looks while tuning the art, for
+ /// example the terraces at 20 km; not promo matches). All are parsed before any capture, so a bad one fails first.</summary>
+ static List<PromoPose> Poses(string[] args)
+ {
+ var poses = new List<PromoPose>(PromoPose.All);
+ for (int i = 0; i < args.Length; i++)
+ if (args[i] == "-extraPose")
+ poses.Add(ParseExtraPose(i + 1 < args.Length ? args[i + 1] : ""));
+ return poses;
+ }
+
+ /// <summary>One -extraPose value: name (letters, digits, '-' and '_', not a promo pose's name, so it never overwrites
+ /// that capture), longitude and latitude inside the map, distance (m) and yaw (degrees). Throws ArgumentException
+ /// naming the expected form.</summary>
+ public static PromoPose ParseExtraPose(string value)
+ {
+ const string form = "-extraPose name:lon:lat:distanceM:yaw, e.g. judea20:35.15:31.80:20000:0";
+ var f = (value ?? "").Split(':');
+ if (f.Length != 5) throw new System.ArgumentException($"'{value}': expected 5 fields ({form})");
+ if (!System.Text.RegularExpressions.Regex.IsMatch(f[0], "^[A-Za-z0-9_-]{1,40}$"))
+ throw new System.ArgumentException($"'{f[0]}': a pose name is letters, digits, '-' and '_' ({form})");
+ if (PromoPose.All.Any(p => p.Name == f[0])) throw new System.ArgumentException($"'{f[0]}' is a promo pose's name: its capture would be overwritten");
+ var inv = System.Globalization.CultureInfo.InvariantCulture; const System.Globalization.NumberStyles num = System.Globalization.NumberStyles.Float;
+ if (!double.TryParse(f[1], num, inv, out var lon) || !double.TryParse(f[2], num, inv, out var lat)
+ || !float.TryParse(f[3], num, inv, out var dist) || !float.TryParse(f[4], num, inv, out var yaw))
+ throw new System.ArgumentException($"'{value}': lon, lat, distance and yaw must be numbers ({form})");
+ if (lon < 34.2 || lon > 35.9 || lat < 29.45 || lat > 33.35) throw new System.ArgumentException($"'{value}': lon/lat outside the map (34.2-35.9 E, 29.45-33.35 N)");
+ if (!(dist > 0f)) throw new System.ArgumentException($"'{value}': distance must be > 0 m");
+ return new PromoPose(f[0], lon, lat, dist, yaw);
+ }
+
/// <summary>Art-track iteration renders (editor, WebGL tier = quality level 0): the promo poses plus a 30 km look at the
/// promo 03 ground (Jaffa to Ramla), at the symbolic scale given by -kitScale (city blocks), -houseScale and -treeScale (default:
/// the ruling's KitScale defaults), into -captureDir as kits-&lt;pose&gt;.png. Logs the kit numbers (KITS ...).</summary>
diff --git a/unity/Assets/Editor/MapMaterials.cs b/unity/Assets/Editor/MapMaterials.cs
index 346388d66..084c26dcd 100644
--- a/unity/Assets/Editor/MapMaterials.cs
+++ b/unity/Assets/Editor/MapMaterials.cs
@@ -26,6 +26,7 @@ namespace Statecraft.Game.EditorTools
terrain.SetTexture("_ScBakeTex", Tex(Statecraft.Game.Map.MapTexturePaths.Bake));
terrain.SetTexture("_ScCoastTex", Tex(Statecraft.Game.Map.MapTexturePaths.Coast));
terrain.SetTexture("_ScAoTex", Tex(Statecraft.Game.Map.MapTexturePaths.Ao));
+ terrain.SetTexture("_ScLandTex", Tex(Statecraft.Game.Map.MapTexturePaths.Land)); // land use (tools/land_bake.py)
EditorUtility.SetDirty(terrain);
// Settlement boxes: matte URP Lit; SettlementPlacer sets the per-type _BaseColor through a MaterialPropertyBlock.
var marker = Make(MarkerPath, "Universal Render Pipeline/Lit", Color.white);
diff --git a/unity/Assets/Editor/MapTextures.cs b/unity/Assets/Editor/MapTextures.cs
index 3c8110e64..bd24777f7 100644
--- a/unity/Assets/Editor/MapTextures.cs
+++ b/unity/Assets/Editor/MapTextures.cs
@@ -8,7 +8,7 @@ namespace Statecraft.Game.EditorTools
/// <summary>Import settings of the baked map textures: linear data (not sRGB), clamped, mipmapped, trilinear, 2048. The
/// shading bake (curvature, sky-view) is block-compressed; the coast distance and the AO are each one uncompressed 8-bit
/// channel (R8): compression blocks would show in the 350 m foam band, and BC1 stepped the AO on broad slopes (Task 6
- /// fix round 1). Idempotent; MapMaterials.Create calls it.</summary>
+ /// fix round 1). The land (2048 x 4096, sRGB colour + weight, tools/land_bake.py) is block-compressed too. Idempotent; MapMaterials.Create calls it.</summary>
public static class MapTextures
{
public static void Configure()
@@ -16,6 +16,18 @@ namespace Statecraft.Game.EditorTools
Set(MapTexturePaths.Bake, singleChannel: false);
Set(MapTexturePaths.Coast, singleChannel: true);
Set(MapTexturePaths.Ao, singleChannel: true);
+ Set(MapTexturePaths.Land, singleChannel: false); // the land's colour and weight, block-compressed
+ // The land: sRGB colour (the sampler decodes it; alpha, the weight, stays linear), 4096 rows on every platform
+ // (the platforms' own 2048 caps would halve it: hedges and rims blur, -21% local detail at gameplay03), and an
+ // automatic compressed format, so the WebGL build's texture subtarget picks it: DXT5 for the desktop build,
+ // ASTC 6x6 or ETC2 for a mobile one (Build.Web -textureSubtarget; docs/visual-v1.md, "Promo track: land use").
+ var land = (TextureImporter)AssetImporter.GetAtPath(MapTexturePaths.Land);
+ land.sRGBTexture = true;
+ foreach (var platform in new[] { "Standalone", "WebGL" })
+ land.SetPlatformTextureSettings(new TextureImporterPlatformSettings
+ { name = platform, overridden = true, maxTextureSize = 4096, format = TextureImporterFormat.Automatic,
+ textureCompression = TextureImporterCompression.Compressed });
+ land.SaveAndReimport();
}
static void Set(string path, bool singleChannel)
@@ -30,8 +42,8 @@ namespace Statecraft.Game.EditorTools
}
imp.sRGBTexture = false; imp.mipmapEnabled = true; imp.isReadable = false;
imp.wrapMode = TextureWrapMode.Clamp; imp.filterMode = FilterMode.Trilinear; // no mip seams across the pitched view
- imp.anisoLevel = path == MapTexturePaths.Bake ? 2 : 1; // the shading is seen at a grazing angle
- imp.maxTextureSize = 2048;
+ imp.anisoLevel = path == MapTexturePaths.Bake || path == MapTexturePaths.Land ? 2 : 1; // seen at a grazing angle
+ imp.maxTextureSize = path == MapTexturePaths.Land ? 4096 : 2048;
imp.textureCompression = singleChannel ? TextureImporterCompression.Uncompressed : TextureImporterCompression.Compressed;
imp.SaveAndReimport();
}
diff --git a/unity/Assets/Materials/Terrain.mat b/unity/Assets/Materials/Terrain.mat
index fdb58d5b6..cca4c9027 100644
--- a/unity/Assets/Materials/Terrain.mat
+++ b/unity/Assets/Materials/Terrain.mat
@@ -87,6 +87,10 @@ Material:
m_Texture: {fileID: 2800000, guid: ac04311e70bde4db0a5e4129f5d58af1, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
+ - _ScLandTex:
+ m_Texture: {fileID: 2800000, guid: f4c67647f4d1e46dc9fa627580da19dd, type: 3}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
- _Splat0:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
diff --git a/unity/Assets/Scripts/Map/MapShaderGlobals.cs b/unity/Assets/Scripts/Map/MapShaderGlobals.cs
index 643df83b9..ac1196412 100644
--- a/unity/Assets/Scripts/Map/MapShaderGlobals.cs
+++ b/unity/Assets/Scripts/Map/MapShaderGlobals.cs
@@ -11,7 +11,7 @@ namespace Statecraft.Game.Map
public static readonly int Map = Shader.PropertyToID("_ScMap"), MapOrigin = Shader.PropertyToID("_ScMapOrigin"),
Biome = Shader.PropertyToID("_ScBiomeTex"), Haze = Shader.PropertyToID("_ScHaze"), HazeWater = Shader.PropertyToID("_ScHazeWater"),
HazeRange = Shader.PropertyToID("_ScHazeRange"), WaterOn = Shader.PropertyToID("_ScWaterOn"), Grid = Shader.PropertyToID("_ScGrid"),
- WaterTime = Shader.PropertyToID("_ScWaterTime");
+ WaterTime = Shader.PropertyToID("_ScWaterTime"), LandOn = Shader.PropertyToID("_ScLandOn");
/// <summary>Pins the water's clock (waves, surf) to the given seconds, or back to Unity's time with null: for tests and
/// frame captures that must render chosen moments (promo-sea review I2, M5).</summary>
@@ -57,6 +57,9 @@ namespace Statecraft.Game.Map
Shader.SetGlobalVector(HazeRange, new Vector4(Y(RiftHazeTopM), Y(RiftHazeFullM), HazeDistanceM, HazeStartM));
Shader.SetGlobalVector(Grid, new Vector4(GridLandOpacity, GridWaterOpacity, GridWidthPx, 1f));
assets.OnTeardown(VisualToggles.Register("grid", on => Shader.SetGlobalVector(Grid, new Vector4(GridLandOpacity, GridWaterOpacity, GridWidthPx, on ? 1f : 0f))));
+ // Land use (issue #33, StatecraftLand.hlsl): fields, farm tracks, terraces and scrub; off = the bare biome ground.
+ Shader.SetGlobalFloat(LandOn, 1f);
+ assets.OnTeardown(VisualToggles.Register("land", on => Shader.SetGlobalFloat(LandOn, on ? 1f : 0f)));
Shader.SetGlobalFloat(WaterOn, 1f);
assets.OnTeardown(VisualToggles.Register("water", on => Shader.SetGlobalFloat(WaterOn, on ? 1f : 0f)));
assets.OnTeardown(VisualToggles.Register("haze", on =>
@@ -74,5 +77,7 @@ namespace Statecraft.Game.Map
public const string Coast = "Assets/Textures/Map/coast.png";
/// <summary>The ambient occlusion on its own, uncompressed (R8): BC1 stepped it on broad slopes (Task 6 fix round 1).</summary>
public const string Ao = "Assets/Textures/Map/ao.png";
+ /// <summary>The land (tools/land_bake.py, issue #33): rgb its linear colour, a its weight over the biome ground.</summary>
+ public const string Land = "Assets/Textures/Map/landuse.png";
}
}
diff --git a/unity/Assets/Shaders/StatecraftLand.hlsl b/unity/Assets/Shaders/StatecraftLand.hlsl
new file mode 100644
index 000000000..c954909e0
--- /dev/null
+++ b/unity/Assets/Shaders/StatecraftLand.hlsl
@@ -0,0 +1,22 @@
+#ifndef STATECRAFT_LAND_INCLUDED
+#define STATECRAFT_LAND_INCLUDED
+// Land use on the ground (issue #33, promo-land): the patchwork of the promo's gameplay zoom (promo/final/03, 02), laid
+// over the biome colour between ScGroundBase and ScGroundShade, so the relief still shades it. tools/land_bake.py bakes
+// it all into landuse.png: the land's colour (field parcels with soft rims and hedges, farm tracks along the blocks'
+// edges, garrigue, terraces, scrub) and its weight in alpha, placed by real data (slope, rainfall, towns). The roads and
+// railways are not here: they are the real 1948 network, drawn by the roads track.
+// Kept to a lerp on purpose: the same pattern as procedural shader code (about 150 instructions) cost about 5 ms a
+// frame at gameplay03 in WebGL on the development Mac even where a branch skipped it, most likely register pressure /
+// occupancy from the shader's size rather than its arithmetic (docs/visual-v1.md, "Promo track: land use").
+
+float _ScLandOn; // 1 = land use drawn, 0 = the bare biome ground (the "land" toggle)
+
+// land: landuse.png (rgb the land's colour, linear once the sampler decodes the sRGB texture; a its weight). The land
+// reaches the waterline (coast 0.5): promo-sea's beach band (ScShore, drawn after) covers it where there is a beach, and
+// fields run to the water where there is none (the Sea of Galilee, cliffs).
+float3 ScLandUse(float3 g, float4 land, float coast)
+{
+ return lerp(g, land.rgb, land.a * smoothstep(0.499, 0.503, coast));
+}
+
+#endif
diff --git a/unity/Assets/Shaders/StatecraftLand.hlsl.meta b/unity/Assets/Shaders/StatecraftLand.hlsl.meta
new file mode 100644
index 000000000..bdefe0817
--- /dev/null
+++ b/unity/Assets/Shaders/StatecraftLand.hlsl.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: d9434be48846d4d53a34eec6b1f71d69
+ShaderIncludeImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/unity/Assets/Shaders/StatecraftMap.hlsl b/unity/Assets/Shaders/StatecraftMap.hlsl
index 395996e65..487b33c9f 100644
--- a/unity/Assets/Shaders/StatecraftMap.hlsl
+++ b/unity/Assets/Shaders/StatecraftMap.hlsl
@@ -191,7 +191,7 @@ float3 ScShore(float3 ground, float coast, float elevM, float3 n, float2 mapM)
// The painted ground: biome colour, warmer stone high up, a dusty rift floor, rock on steep slopes, two octaves of
// breakup, curvature (ridges light, hollows dark) and the baked occlusion (bake: r AO from ao.png, g curvature, b sky-view).
-float3 ScGround(float2 uv, float2 mapM, float3 n, float3 positionWS, float4 bake)
+float3 ScGroundBase(float2 uv, float2 mapM, float3 n, float3 positionWS)
{
float elevM = (positionWS.y - _ScMap.z) / _ScMap.w; // real metres above sea level
float slope = 1.0 - saturate(n.y); // 0 flat, 1 vertical
@@ -200,6 +200,12 @@ float3 ScGround(float2 uv, float2 mapM, float3 n, float3 positionWS, float4 bake
g = lerp(g, g * float3(1.10, 1.04, 0.92), 1.0 - smoothstep(-350.0, -150.0, elevM));
float rock = smoothstep(0.22, 0.45, slope + (ScNoise(mapM / 900.0) - 0.5) * 0.12);
g = lerp(g, SRGBToLinear(float3(0.56, 0.49, 0.41)), rock);
+ return g;
+}
+
+// ScGround's shading, split from its colour so the terrain can paint land use in between (StatecraftLand.hlsl).
+float3 ScGroundShade(float3 g, float2 mapM, float4 bake)
+{
// The fine octave fades to its mean as a pixel's footprint nears its 520 m period, so it never aliases into shimmer.
float fine = lerp(0.5, ScNoise(mapM / 520.0), 1.0 - saturate(length(fwidth(mapM)) / 520.0));
g *= 0.93 + 0.14 * (ScNoise(mapM / 2600.0) * 0.6 + fine * 0.4);
@@ -208,6 +214,11 @@ float3 ScGround(float2 uv, float2 mapM, float3 n, float3 positionWS, float4 bake
return g;
}
+float3 ScGround(float2 uv, float2 mapM, float3 n, float3 positionWS, float4 bake)
+{
+ return ScGroundShade(ScGroundBase(uv, mapM, n, positionWS), mapM, bake);
+}
+
// Distance (m) from p to the nearest edge of its hex: tools/hexgrid.py's pointy-top axial layout, (0, 0) at the north-west
// corner, p.x east and p.y south (HexGrid.EdgeDistance is the C# twin). n is that edge's outward unit normal (constant over
// each sixth of a hex).
diff --git a/unity/Assets/Shaders/StatecraftTerrain.hlsl b/unity/Assets/Shaders/StatecraftTerrain.hlsl
index fe55766f0..0933721eb 100644
--- a/unity/Assets/Shaders/StatecraftTerrain.hlsl
+++ b/unity/Assets/Shaders/StatecraftTerrain.hlsl
@@ -1,12 +1,15 @@
#ifndef STATECRAFT_TERRAIN_INCLUDED
#define STATECRAFT_TERRAIN_INCLUDED
#include "Assets/Shaders/StatecraftMap.hlsl"
+#include "Assets/Shaders/StatecraftLand.hlsl"
// The Custom Function of StatecraftTerrain.shadergraph (written by tools/terrain_graph.py; keep this signature in step with
// its INPUTS and OUTPUTS). UV is the terrain UV (0..1 over the map); PositionWS and NormalWS are absolute world space;
// Bake is terrain_bake.png (g curvature, b sky-view; its r is not read); Coast is coast.png (0.5 = shore, lower = water);
-// Ao is ao.png, the ambient occlusion on its own, uncompressed (BC1 banded it: Task 6 fix round 1).
-void StatecraftTerrain_float(float2 UV, float3 PositionWS, float3 NormalWS, UnityTexture2D Bake, UnityTexture2D Coast, UnityTexture2D Ao,
+// Ao is ao.png, the ambient occlusion on its own, uncompressed (BC1 banded it: Task 6 fix round 1); Land is landuse.png
+// (tools/land_bake.py: rgb the land's colour, sRGB-decoded by the sampler, a its weight), read by ScLandUse
+// (StatecraftLand.hlsl).
+void StatecraftTerrain_float(float2 UV, float3 PositionWS, float3 NormalWS, UnityTexture2D Bake, UnityTexture2D Coast, UnityTexture2D Ao, UnityTexture2D Land,
out float3 BaseColor, out float3 NormalOut, out float Occlusion, out float Smoothness, out float Metallic, out float3 Emission)
{
float3 n = normalize(NormalWS);
@@ -14,7 +17,15 @@ void StatecraftTerrain_float(float2 UV, float3 PositionWS, float3 NormalWS, Unit
bake.r = SAMPLE_TEXTURE2D(Ao.tex, Ao.samplerstate, UV).r;
float coast = SAMPLE_TEXTURE2D(Coast.tex, Coast.samplerstate, UV).r;
float2 mapM = UV * _ScMap.xy;
- float3 ground = ScGround(UV, mapM, n, PositionWS, bake);
+ // The pixel's footprint (m), for the water's chop and breakers, taken here in uniform
+ // control flow (derivatives are undefined inside the water branch).
+ float footprintM = max(length(ddx(mapM)), length(ddy(mapM)));
+ // ScGround with the land use (StatecraftLand.hlsl) laid between its colour and its shading: curvature, AO and breakup
+ // shade the fields too. The "land" toggle lerps it away (it does not skip the sample: a visual switch, not a price).
+ float4 land = SAMPLE_TEXTURE2D(Land.tex, Land.samplerstate, UV);
+ float3 ground = ScGroundBase(UV, mapM, n, PositionWS);
+ ground = lerp(ground, ScLandUse(ground, land, coast), _ScLandOn);
+ ground = ScGroundShade(ground, mapM, bake);
float h = _ScHaze.a * ScHazeAmount(PositionWS); // land haze, applied after lighting via Emission
float ao = bake.r * lerp(0.6, 1.0, bake.b);
float water = ScWater(coast);
@@ -24,9 +35,6 @@ void StatecraftTerrain_float(float2 UV, float3 PositionWS, float3 NormalWS, Unit
float elevM = (PositionWS.y - _ScMap.z) / _ScMap.w;
// Land pixels (water 0, spatially coherent) skip the water shading: its noise and second shadow lookup would only be
// multiplied away (Task 7 fix round 1, M3).
- // The pixel's footprint for the water's chop and breakers, taken here in uniform control flow (derivatives are
- // undefined inside the branch).
- float footprintM = max(length(ddx(mapM)), length(ddy(mapM)));
float2 breakers = ScBreakers(coast, mapM);
float3 waterColour = 0;
[branch] if (water > 0.0) waterColour = ScHazeWater(ScWaterShade(coast, elevM, PositionWS, mapM, footprintM, breakers), PositionWS);
diff --git a/unity/Assets/Shaders/StatecraftTerrain.shadergraph b/unity/Assets/Shaders/StatecraftTerrain.shadergraph
index 7a4623484..4c834e1a8 100644
--- a/unity/Assets/Shaders/StatecraftTerrain.shadergraph
+++ b/unity/Assets/Shaders/StatecraftTerrain.shadergraph
@@ -11,6 +11,9 @@
},
{
"m_Id": "b88f877cf9865c24bc626b97cf41ff89"
+ },
+ {
+ "m_Id": "381f2961f9eb5167ac569d12f1851588"
}
],
"m_Keywords": [],
@@ -60,6 +63,9 @@
{
"m_Id": "459d970584a0580e866734ec5e367cae"
},
+ {
+ "m_Id": "8777bb7ce1aa52ebbc6efbe44551bc3e"
+ },
{
"m_Id": "0c721d24051f5765970882f281b1f92f"
}
@@ -151,6 +157,20 @@
"m_SlotId": 5
}
},
+ {
+ "m_OutputSlot": {
+ "m_Node": {
+ "m_Id": "8777bb7ce1aa52ebbc6efbe44551bc3e"
+ },
+ "m_SlotId": 0
+ },
+ "m_InputSlot": {
+ "m_Node": {
+ "m_Id": "0c721d24051f5765970882f281b1f92f"
+ },
+ "m_SlotId": 12
+ }
+ },
{
"m_OutputSlot": {
"m_Node": {
@@ -345,6 +365,9 @@
},
{
"m_Id": "b88f877cf9865c24bc626b97cf41ff89"
+ },
+ {
+ "m_Id": "381f2961f9eb5167ac569d12f1851588"
}
]
}
@@ -1163,6 +1186,88 @@
"m_BareResource": false
}
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.ShaderGraph.Internal.Texture2DShaderProperty",
+ "m_ObjectId": "381f2961f9eb5167ac569d12f1851588",
+ "m_Guid": {
+ "m_GuidSerialized": "99a23710-f7ec-5cac-96e6-84fa1f5e0e0d"
+ },
+ "m_Name": "ScLandTex",
+ "m_DefaultRefNameVersion": 1,
+ "m_RefNameGeneratedByDisplayName": "ScLandTex",
+ "m_DefaultReferenceName": "_ScLandTex",
+ "m_OverrideReferenceName": "",
+ "m_GeneratePropertyBlock": true,
+ "m_UseCustomSlotLabel": false,
+ "m_CustomSlotLabel": "",
+ "m_DismissedVersion": 0,
+ "m_Precision": 0,
+ "overrideHLSLDeclaration": false,
+ "hlslDeclarationOverride": 0,
+ "m_Hidden": false,
+ "m_PerRendererData": false,
+ "m_customAttributes": [],
+ "m_Value": {
+ "m_SerializedTexture": "{\"texture\":{\"instanceID\":0}}",
+ "m_Guid": ""
+ },
+ "isMainTexture": false,
+ "useTilingAndOffset": false,
+ "useTexelSize": false,
+ "m_Modifiable": true,
+ "m_DefaultType": 0
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.ShaderGraph.PropertyNode",
+ "m_ObjectId": "8777bb7ce1aa52ebbc6efbe44551bc3e",
+ "m_Group": {
+ "m_Id": ""
+ },
+ "m_Name": "ScLandTex",
+ "m_DrawState": {
+ "m_Expanded": true,
+ "m_Position": {
+ "serializedVersion": "2",
+ "x": -900,
+ "y": 810,
+ "width": 220.0,
+ "height": 130.0
+ }
+ },
+ "m_Slots": [
+ {
+ "m_Id": "b3cccb496adf5b9aa19a44d616229b65"
+ }
+ ],
+ "synonyms": [],
+ "m_Precision": 1,
+ "m_PreviewExpanded": false,
+ "m_DismissedVersion": 0,
+ "m_PreviewMode": 0,
+ "m_CustomColors": {
+ "m_SerializableColors": []
+ },
+ "m_Property": {
+ "m_Id": "381f2961f9eb5167ac569d12f1851588"
+ }
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.ShaderGraph.Texture2DMaterialSlot",
+ "m_ObjectId": "b3cccb496adf5b9aa19a44d616229b65",
+ "m_Id": 0,
+ "m_DisplayName": "Out",
+ "m_SlotType": 1,
+ "m_Hidden": false,
+ "m_ShaderOutputName": "Out",
+ "m_StageCapability": 3,
+ "m_BareResource": false
+}
+
{
"m_SGVersion": 1,
"m_Type": "UnityEditor.ShaderGraph.CustomFunctionNode",
@@ -1200,6 +1305,9 @@
{
"m_Id": "8990932a9fe95bfabd3d5e645cf3bc58"
},
+ {
+ "m_Id": "c91f4d03290652b78049177e85d694ee"
+ },
{
"m_Id": "87a7dd817fad59ecb1f11eb968ed2567"
},
@@ -1355,6 +1463,24 @@
"m_DefaultType": 0
}
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.ShaderGraph.Texture2DInputMaterialSlot",
+ "m_ObjectId": "c91f4d03290652b78049177e85d694ee",
+ "m_Id": 12,
+ "m_DisplayName": "Land",
+ "m_SlotType": 0,
+ "m_Hidden": false,
+ "m_ShaderOutputName": "Land",
+ "m_StageCapability": 3,
+ "m_BareResource": false,
+ "m_Texture": {
+ "m_SerializedTexture": "",
+ "m_Guid": ""
+ },
+ "m_DefaultType": 0
+}
+
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
diff --git a/unity/Assets/Tests/EditMode/LandUseTests.cs b/unity/Assets/Tests/EditMode/LandUseTests.cs
new file mode 100644
index 000000000..a47bd21ca
--- /dev/null
+++ b/unity/Assets/Tests/EditMode/LandUseTests.cs
@@ -0,0 +1,152 @@
+#nullable enable
+using System.Collections;
+using NUnit.Framework;
+using Statecraft.Game;
+using Statecraft.Game.Map;
+using UnityEditor;
+using UnityEditor.SceneManagement;
+using UnityEngine;
+using UnityEngine.TestTools;
+
+/// <summary>Issue #33 (promo-land): the land-use texture (tools/land_bake.py) and the fields, terraces and farm tracks the terrain
+/// shader paints from it (StatecraftLand.hlsl).</summary>
+public class LandUseTests
+{
+ const string TerrainMatPath = "Assets/Materials/Terrain.mat";
+
+ [TearDown]
+ public void Reset()
+ {
+ RenderSample.TiltShift(true);
+ VisualToggles.SetAll(true); // review M10: Clear alone left the global _ScLandOn at 0 for the next test
+ EditorSceneManager.NewScene(NewSceneSetup.EmptyScene, NewSceneMode.Single); VisualToggles.Clear();
+ }
+
+ /// <summary>The map built for measuring the ground itself (integration bug B4): without the settlement kits, whose
+ /// blocks, trees and paved town ground stand on the sampled plain once promo-art is merged. By name and by reflection,
+ /// as SeaTests does (promo-art 689880d), so this compiles and runs where the kits do not exist yet.</summary>
+ static MapScene OpenMapWithoutKits()
+ {
+ EditorSceneManager.OpenScene("Assets/Map.unity", OpenSceneMode.Single); // the scene is not saved
+ var map = Object.FindFirstObjectByType<MapScene>();
+ typeof(MapScene).GetMethod("ConfigureKits")?.Invoke(map, new object?[] { null, null });
+ map.Build();
+ foreach (var n in new[] { "kits", "trees" }) if (System.Linq.Enumerable.Contains(VisualToggles.Names, n)) VisualToggles.Set(n, false);
+ return map;
+ }
+
+ static Texture2D Read(string path)
+ {
+ var png = new Texture2D(2, 2, TextureFormat.RGBA32, false, true);
+ Assert.IsTrue(png.LoadImage(System.IO.File.ReadAllBytes(path)));
+ return png;
+ }
+
+
+ static HeightmapMeta Meta() =>
+ JsonUtility.FromJson<HeightmapMeta>(System.IO.File.ReadAllText(System.IO.Path.Combine(Paths.StreamingMap, "heightmap.json")));
+
+ /// <summary>The texel at (lon, lat), from the source PNG (Texture2D row 0 is south).</summary>
+ static Color MaskAt(Texture2D png, HeightmapMeta m, double lon, double lat) =>
+ png.GetPixel((int)((lon - m.lon0) / (m.lon1 - m.lon0) * png.width), (int)((lat - m.lat0) / (m.lat1 - m.lat0) * png.height));
+
+ /// <summary>The land weight (alpha) averaged over the 13 x 13 texels (about 1 x 1.4 km) round (lon, lat): parcels left
+ /// as grass and hedges vary it texel by texel.</summary>
+ static float WeightAround(Texture2D png, HeightmapMeta m, double lon, double lat)
+ {
+ int x = (int)((lon - m.lon0) / (m.lon1 - m.lon0) * png.width), y = (int)((lat - m.lat0) / (m.lat1 - m.lat0) * png.height);
+ float sum = 0; for (int dy = -6; dy <= 6; dy++) for (int dx = -6; dx <= 6; dx++) sum += png.GetPixel(x + dx, y + dy).a;
+ return sum / 169f;
+ }
+
+ [Test]
+ public void TheTexturesImportForTheShaderAndEveryWebBuild()
+ {
+ var land = AssetDatabase.LoadAssetAtPath<Texture2D>(MapTexturePaths.Land);
+ Assert.AreEqual((2048, 4096), (land.width, land.height), "about 79 x 105 m per texel");
+ Assert.AreEqual(TextureWrapMode.Clamp, land.wrapMode);
+ Assert.IsTrue(land.isDataSRGB, "sRGB colour: 8 bits and BC3 endpoints where the eye needs them (review M3)");
+ Assert.AreEqual(FilterMode.Trilinear, land.filterMode); Assert.Greater(land.mipmapCount, 1); Assert.AreEqual(2, land.anisoLevel);
+ Assert.AreEqual(TextureFormat.DXT5, land.format, "colour and weight block-compressed (BC3) on the desktop platforms");
+ // Review I4: the WebGL override keeps the 4096 rows and lets the build's texture subtarget choose the format (DXT5 in
+ // the desktop build, ASTC 6x6 / ETC2 in a mobile one), instead of pinning DXT5, which phones decompress on the CPU.
+ var web = ((TextureImporter)AssetImporter.GetAtPath(MapTexturePaths.Land)).GetPlatformTextureSettings("WebGL");
+ Assert.IsTrue(web.overridden); Assert.AreEqual(4096, web.maxTextureSize);
+ Assert.Less((int)web.format, 0, $"WebGL format {web.format}: an automatic format (the negative enum values), not a pinned one");
+ Assert.AreEqual(TextureImporterCompression.Compressed, web.textureCompression);
+ var mat = AssetDatabase.LoadAssetAtPath<Material>(TerrainMatPath);
+ Assert.AreEqual(land, mat.GetTexture("_ScLandTex"));
+ }
+
+ /// <summary>Build.Web -textureSubtarget names the WebGL texture subtarget (desktop DXT, mobile ASTC or ETC2), and
+ /// refuses anything else. Build lives in the predefined editor assembly: reached by reflection.</summary>
+ [Test]
+ public void TheWebBuildTakesATextureSubtarget()
+ {
+ var build = System.Type.GetType("Statecraft.Game.EditorTools.Build, Assembly-CSharp-Editor");
+ Assert.IsNotNull(build);
+ var parse = build!.GetMethod("TextureSubtarget"); Assert.IsNotNull(parse);
+ Assert.AreEqual(WebGLTextureSubtarget.ASTC, parse!.Invoke(null, new object?[] { "astc" }));
+ Assert.AreEqual(WebGLTextureSubtarget.DXT, parse.Invoke(null, new object?[] { "dxt" }));
+ Assert.AreEqual(WebGLTextureSubtarget.ETC2, parse.Invoke(null, new object?[] { "etc2" }));
+ Assert.IsNull(parse.Invoke(null, new object?[] { null }));
+ var ex = Assert.Throws<System.Reflection.TargetInvocationException>(() => parse.Invoke(null, new object?[] { "pvrtc" }));
+ Assert.IsInstanceOf<System.ArgumentException>(ex!.InnerException);
+ }
+
+ /// <summary>Review M9: MapCapture -extraPose checks its value: five fields, a safe name that is not a promo pose's,
+ /// numbers, a point on the map and a positive distance.</summary>
+ [Test]
+ public void AnExtraCapturePoseIsValidated()
+ {
+ var capture = System.Type.GetType("MapCapture, Assembly-CSharp-Editor");
+ Assert.IsNotNull(capture);
+ var parse = capture!.GetMethod("ParseExtraPose"); Assert.IsNotNull(parse);
+ var pose = (PromoPose)parse!.Invoke(null, new object[] { "judea20:35.15:31.80:20000:0" })!;
+ Assert.AreEqual(("judea20", 35.15, 31.80, 20000f, 0f), (pose.Name, pose.Lon, pose.Lat, pose.Distance, pose.Yaw));
+ foreach (var bad in new[] { "judea20:35.15:31.80:20000", "../x:35.15:31.80:20000:0", "a/b:35.15:31.80:20000:0",
+ "gameplay03:35.15:31.80:20000:0", "x:east:31.80:20000:0", "x:30.0:31.80:20000:0", "x:35.15:31.80:0:0" })
+ {
+ var ex = Assert.Throws<System.Reflection.TargetInvocationException>(() => parse.Invoke(null, new object[] { bad }), bad);
+ Assert.IsInstanceOf<System.ArgumentException>(ex!.InnerException, bad);
+ }
+ }
+
+ /// <summary>The land follows the real ground: it covers the coastal plain by Rehovot, the Jezreel valley and (as
+ /// garrigue and terraces) the Judean hills, and leaves the central Negev and the Dead Sea to the biome and the water.</summary>
+ [Test]
+ public void TheLandFollowsSlopeRainAndTowns()
+ {
+ var png = Read(MapTexturePaths.Land); var m = Meta();
+ try
+ {
+ float plain = WeightAround(png, m, 34.84, 31.92), jezreel = WeightAround(png, m, 35.30, 32.62);
+ float negev = WeightAround(png, m, 34.90, 30.60), deadSea = WeightAround(png, m, 35.50, 31.50), judea = WeightAround(png, m, 35.15, 31.78);
+ TestContext.WriteLine($"land weight: plain {plain:0.000}, Jezreel {jezreel:0.000}, Negev {negev:0.000}, Dead Sea {deadSea:0.000}, Judea {judea:0.000}");
+ Assert.Greater(plain, 0.8f, "fields on the coastal plain"); Assert.Greater(jezreel, 0.8f, "fields in the Jezreel valley");
+ Assert.Less(negev, 0.02f, "the central Negev stays desert"); Assert.Less(deadSea, 0.02f, "water");
+ Assert.Greater(judea, 0.4f, "garrigue and terraces on the Judean hills");
+ }
+ finally { Object.DestroyImmediate(png); }
+ }
+
+ /// <summary>Rendered at the gameplay pose: the fields, hedges and farm tracks add local detail to the plain (the flat
+ /// mustard ground had little): the gradient energy of the frame's lower half rises by at least 15% against the bare
+ /// biome ground (the "land" toggle off), and the mean colour stays the same ground (saturation within 0.06).</summary>
+ [UnityTest]
+ public IEnumerator TheFieldsAddDetailToThePlainWithoutChangingItsColour()
+ {
+ var map = OpenMapWithoutKits();
+ RenderSample.TiltShift(false);
+ yield return null;
+ var cam = Camera.main; var rig = cam.GetComponent<CameraRig>();
+ PromoPose.Gameplay03.Apply(rig, map.Frame); rig.TopInset = 0; rig.Apply();
+ var farmed = RenderSample.Render(cam, 960, 540);
+ VisualToggles.Set("land", false);
+ var bare = RenderSample.Render(cam, 960, 540);
+ TestContext.WriteLine($"gradient {bare.GradientEnergy(0f, 0.5f):0.0000} -> {farmed.GradientEnergy(0f, 0.5f):0.0000}; " +
+ $"saturation {bare.MeanSaturation():0.000} -> {farmed.MeanSaturation():0.000}");
+ Assert.Greater(farmed.GradientEnergy(0f, 0.5f), bare.GradientEnergy(0f, 0.5f) * 1.15f);
+ Assert.AreEqual(bare.MeanSaturation(), farmed.MeanSaturation(), 0.06f);
+ }
+}
diff --git a/unity/Assets/Tests/EditMode/LandUseTests.cs.meta b/unity/Assets/Tests/EditMode/LandUseTests.cs.meta
new file mode 100644
index 000000000..530b3a702
--- /dev/null
+++ b/unity/Assets/Tests/EditMode/LandUseTests.cs.meta
@@ -0,0 +1,2 @@
+fileFormatVersion: 2
+guid: 9d1eff8b3dbd64e769436d635cd9d52d
\ No newline at end of file
diff --git a/unity/Assets/Tests/EditMode/TerrainShaderTests.cs b/unity/Assets/Tests/EditMode/TerrainShaderTests.cs
index 8046cf18d..b395470c9 100644
--- a/unity/Assets/Tests/EditMode/TerrainShaderTests.cs
+++ b/unity/Assets/Tests/EditMode/TerrainShaderTests.cs
@@ -51,6 +51,8 @@ public class TerrainShaderTests
$"pass '{sub.GetPass(p).Name}' computes the terrain UV at half precision");
}
var map = OpenMap();
+ // The ground itself: Lod's settlement kit (promo-art) stands on this plain point; off by name, so this runs on main too.
+ foreach (var n in new[] { "kits", "trees" }) if (VisualToggles.Names.Contains(n)) VisualToggles.Set(n, false);
yield return null;
var cam = Camera.main; var rig = cam.GetComponent<CameraRig>();
// A flat coastal-plain point (review N7): no rock blend and no stone tint can stand between the texture and the screen.
@@ -58,8 +60,11 @@ public class TerrainShaderTests
rig.LookAt = plain; rig.Distance = 30000f; rig.Yaw = 0; rig.TopInset = 0; rig.Apply();
var magenta = new Texture2D(1, 1, TextureFormat.RGBA32, false); magenta.SetPixel(0, 0, Color.magenta); magenta.Apply();
var real = Shader.GetGlobalTexture(MapShaderGlobals.Biome);
+ // The land use (fields, issue #33) paints over the plain: with an empty mask the biome colour is what remains.
+ var mat = AssetDatabase.LoadAssetAtPath<Material>(TerrainMatPath); var realLand = mat.GetTexture("_ScLandTex");
try
{
+ mat.SetTexture("_ScLandTex", Texture2D.blackTexture);
Shader.SetGlobalTexture(MapShaderGlobals.Biome, magenta);
var px = new Vector2[1];
var s = RenderSample.Render(cam, 480, 270, new[] { plain }, px);
@@ -68,7 +73,7 @@ public class TerrainShaderTests
Assert.Greater(c.r + c.g + c.b, 0.15f, "not black");
Assert.Greater(Mathf.Min(c.r, c.b), c.g + 0.1f, "magenta: the biome texture reaches the screen through the HLSL");
}
- finally { Shader.SetGlobalTexture(MapShaderGlobals.Biome, real); Object.DestroyImmediate(magenta); }
+ finally { Shader.SetGlobalTexture(MapShaderGlobals.Biome, real); mat.SetTexture("_ScLandTex", realLand); Object.DestroyImmediate(magenta); }
}
[Test]
@@ -80,6 +85,7 @@ public class TerrainShaderTests
Assert.AreEqual(AssetDatabase.LoadAssetAtPath<Texture2D>(MapTexturePaths.Bake), mat.GetTexture("_ScBakeTex"));
Assert.AreEqual(AssetDatabase.LoadAssetAtPath<Texture2D>(MapTexturePaths.Coast), mat.GetTexture("_ScCoastTex"));
Assert.AreEqual(AssetDatabase.LoadAssetAtPath<Texture2D>(MapTexturePaths.Ao), mat.GetTexture("_ScAoTex"));
+ Assert.AreEqual(AssetDatabase.LoadAssetAtPath<Texture2D>(MapTexturePaths.Land), mat.GetTexture("_ScLandTex"));
CollectionAssert.AreEquivalent(MapBuilder.BiomeColours.Keys, MapPalette.Ground.Keys, "a ground colour for every biome");
}
diff --git a/unity/Assets/Textures/Map/landuse.png b/unity/Assets/Textures/Map/landuse.png
new file mode 100644
index 000000000..5af88ed3c
Binary files /dev/null and b/unity/Assets/Textures/Map/landuse.png differ
diff --git a/unity/Assets/Textures/Map/landuse.png.meta b/unity/Assets/Textures/Map/landuse.png.meta
new file mode 100644
index 000000000..39f0565c9
--- /dev/null
+++ b/unity/Assets/Textures/Map/landuse.png.meta
@@ -0,0 +1,130 @@
+fileFormatVersion: 2
+guid: f4c67647f4d1e46dc9fa627580da19dd
+TextureImporter:
+ internalIDToNameTable: []
+ externalObjects: {}
+ serializedVersion: 13
+ mipmaps:
+ mipMapMode: 0
+ enableMipMap: 1
+ sRGBTexture: 1
+ linearTexture: 0
+ fadeOut: 0
+ borderMipMap: 0
+ mipMapsPreserveCoverage: 0
+ alphaTestReferenceValue: 0.5
+ mipMapFadeDistanceStart: 1
+ mipMapFadeDistanceEnd: 3
+ bumpmap:
+ convertToNormalMap: 0
+ externalNormalMap: 0
+ heightScale: 0.25
+ normalMapFilter: 0
+ flipGreenChannel: 0
+ isReadable: 0
+ streamingMipmaps: 0
+ streamingMipmapsPriority: 0
+ vTOnly: 0
+ ignoreMipmapLimit: 0
+ grayScaleToAlpha: 0
+ generateCubemap: 6
+ cubemapConvolution: 0
+ seamlessCubemap: 0
+ textureFormat: 1
+ maxTextureSize: 2048
+ textureSettings:
+ serializedVersion: 2
+ filterMode: 2
+ aniso: 2
+ mipBias: 0
+ wrapU: 1
+ wrapV: 1
+ wrapW: 1
+ nPOTScale: 1
+ lightmap: 0
+ compressionQuality: 50
+ spriteMode: 0
+ spriteExtrude: 1
+ spriteMeshType: 1
+ alignment: 0
+ spritePivot: {x: 0.5, y: 0.5}
+ spritePixelsToUnits: 100
+ spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+ spriteGenerateFallbackPhysicsShape: 1
+ alphaUsage: 1
+ alphaIsTransparency: 0
+ spriteTessellationDetail: -1
+ textureType: 0
+ textureShape: 1
+ singleChannelComponent: 0
+ flipbookRows: 1
+ flipbookColumns: 1
+ maxTextureSizeSet: 0
+ compressionQualitySet: 0
+ textureFormatSet: 0
+ ignorePngGamma: 0
+ applyGammaDecoding: 0
+ swizzle: 50462976
+ cookieLightType: 0
+ platformSettings:
+ - serializedVersion: 4
+ buildTarget: DefaultTexturePlatform
+ maxTextureSize: 4096
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 1
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ ignorePlatformSupport: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
+ - serializedVersion: 4
+ buildTarget: Standalone
+ maxTextureSize: 4096
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 1
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 1
+ ignorePlatformSupport: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
+ - serializedVersion: 4
+ buildTarget: WebGL
+ maxTextureSize: 4096
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 1
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 1
+ ignorePlatformSupport: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
+ spriteSheet:
+ serializedVersion: 2
+ sprites: []
+ outline: []
+ customData:
+ physicsShape: []
+ bones: []
+ spriteID:
+ internalID: 0
+ vertices: []
+ indices:
+ edges: []
+ weights: []
+ secondaryTextures: []
+ spriteCustomMetadata:
+ entries: []
+ nameFileIdTable: {}
+ mipmapLimitGroupName:
+ pSDRemoveMatte: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant: