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.

feat(visual): the Statecraft Terrain Lit Shader Graph: biome colour, height, slope rock, breakup, curvature, baked AO/sky-view, haze

eyalgolan676d1e1d188d
diff --git a/docs/visual-v1.md b/docs/visual-v1.md
index b34d23d8d..04d17f331 100644
--- a/docs/visual-v1.md
+++ b/docs/visual-v1.md
@@ -72,7 +72,24 @@ pillow 12.3.0 on the same machine gives byte-identical PNGs. Another platform ma
1-ulp `sin`/`arctan` results. Compare decoded pixels (`np.array_equal`), not file bytes; R and B may then differ by
one level here and there.
+## Task 6: terrain
+The Statecraft Terrain Lit Shader Graph (`tools/terrain_graph.py` + `StatecraftTerrain.hlsl`): one terrain layer (one
+pass) instead of seven, no basemap fallback. WebGL build (`-compression disabled`): `BUILD Succeeded WebGL ->
+Builds/Web-disabled: 73.4 MB on disk, 0 errors` (Task 1: 70.9 MB; +2.5 MB, the two baked textures), no `Shader error`.
+GLES3 check: `ShaderChecks.Gles3Errors` is empty for `Statecraft/StatecraftTerrain` (no `#extension ... : require`;
+`AllowedRequires` not needed).
+
+| Run | Lines |
+|---|---|
+| headless | `PROFILE summary visual=all pose=gameplay03 runs=3 median_avg_ms=1.58 spread_ms=0.93 median_p95_ms=2.00`<br>`PROFILE summary visual=-haze pose=gameplay03 runs=3 median_avg_ms=1.88 spread_ms=0.87 median_p95_ms=4.00`<br>`PROFILE summary visual=none pose=gameplay03 runs=3 median_avg_ms=1.67 spread_ms=0.40 median_p95_ms=3.00`<br>`PROFILE summary visual=all pose=diorama02 runs=3 median_avg_ms=7.25 spread_ms=0.47 median_p95_ms=8.00`<br>`PROFILE summary visual=-haze pose=diorama02 runs=3 median_avg_ms=7.13 spread_ms=0.11 median_p95_ms=8.00`<br>`PROFILE summary visual=none pose=diorama02 runs=3 median_avg_ms=7.16 spread_ms=0.20 median_p95_ms=8.00` |
+| boot, `--cpu 1` | `BOOT map_build_ms median=509 runs=3 cpu=1`<br>`BOOT first_frame_ms median=3851 runs=3 cpu=1` (budgets 743 / 5321 ms: within) |
+
+Against the Task 1 baseline (`all`): gameplay03 2.29 -> 1.58 ms, diorama02 6.84 -> 7.25 ms (+0.41 ms, inside 2.5 ms plus
+the spread). Haze costs nothing measurable (`all` - `-haze`: -0.30 / +0.12 ms, both inside the spreads). The boot phase
+`biome texture baked` takes 94-106 ms (it replaces Task 1's `biome colours blended`).
+
## Checkpoints
| Task | Name | Images | Owner verdict |
|---|---|---|---|
| 1 | t01-before | captures/visual/t01-before/*-compare*.png | (owner) |
+| 6 | t06-terrain | captures/visual/t06-terrain/*-compare*.png, editor/*-compare*.png | (owner) |
diff --git a/tools/README.md b/tools/README.md
index a49eb349b..806c57975 100644
--- a/tools/README.md
+++ b/tools/README.md
@@ -19,6 +19,8 @@ Offline data tools (uv inline-script Python). Run from the repo root.
- `terrain_bake.py` writes `unity/Assets/Textures/Map/terrain_bake.png` (AO, curvature, sky-view) 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.
+- `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
logs rough colour numbers; `art_checkpoint.sh [--no-build] <name>` builds WebGL, takes the screenshots
(`web_check.py --shots`) and runs it (docs/visual-v1.md).
@@ -37,7 +39,7 @@ Run from the repo root; this installs every pinned dependency (rasterio included
uv run --with pytest==9.1.1 --with rasterio==1.5.2 --with numpy==2.5.3 --with pyyaml==6.0.3 --with pillow==12.3.0 --with requests==2.32.5 pytest tools/tests -q
```
-Expected: `164 passed, 1 skipped` (the skipped one is the headed browser check; add `--headed` and `--with websockets==15.0.1` to run it). Omitting a dependency (e.g. rasterio) silently drops tests or fails collection.
+Expected: `169 passed, 1 skipped` (the skipped one is the headed browser check; add `--headed` and `--with websockets==15.0.1` to run it). Omitting a dependency (e.g. rasterio) silently drops tests or fails collection.
## Required attribution (Copernicus DEM licence, modified data)
diff --git a/tools/terrain_graph.py b/tools/terrain_graph.py
new file mode 100644
index 000000000..f02e6da97
--- /dev/null
+++ b/tools/terrain_graph.py
@@ -0,0 +1,168 @@
+# /// script
+# requires-python = ">=3.11"
+# dependencies = []
+# ///
+"""Writes unity/Assets/Shaders/StatecraftTerrain.shadergraph (shader "Statecraft/StatecraftTerrain"): Unity's own
+"Terrain Simple" Terrain Lit template with its sample nodes, groups and notes removed, and one Custom Function node
+(File mode, m_SourceType 0: StatecraftTerrain.hlsl, function StatecraftTerrain, single precision) that takes the terrain UV, the absolute
+world position and normal and two blackboard textures (_ScBakeTex, _ScCoastTex) 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.
+
+Usage: uv run tools/terrain_graph.py
+Needs unity/Library/PackageCache (open the project in Unity once) and unity/Assets/Shaders/StatecraftTerrain.hlsl.meta."""
+import json
+import re
+import sys
+import uuid
+from pathlib import Path
+
+ROOT = Path(__file__).resolve().parents[1]
+TEMPLATE_GLOB = "unity/Library/PackageCache/com.unity.shadergraph@*/GraphTemplates/Cross Pipeline/Terrain Simple.shadergraph"
+HLSL_META = ROOT / "unity" / "Assets" / "Shaders" / "StatecraftTerrain.hlsl.meta"
+OUT = ROOT / "unity" / "Assets" / "Shaders" / "StatecraftTerrain.shadergraph"
+GRAPH_PATH = "Statecraft"
+FUNCTION = "StatecraftTerrain"
+NS = uuid.UUID("5b0c1f7e-2f61-4c3a-9a57-7a1d1e0c6f42")
+SG = "UnityEditor.ShaderGraph."
+SINGLE = 1 # Precision.Single
+FILE_MODE = 0 # HlslSourceType.File (Shader Graph: enum HlslSourceType { File, String })
+TEXTURES = [("ScBakeTex", "_ScBakeTex", 3), ("ScCoastTex", "_ScCoastTex", 4)] # display name, reference, function slot
+INPUTS = [(0, "UV", "Vector2"), (1, "PositionWS", "Vector3"), (2, "NormalWS", "Vector3"),
+ (3, "Bake", "Texture2DInput"), (4, "Coast", "Texture2DInput")]
+OUTPUTS = [(5, "BaseColor", "Vector3", "SurfaceDescription.BaseColor"), (6, "NormalOut", "Vector3", "SurfaceDescription.NormalWS"),
+ (7, "Occlusion", "Vector1", "SurfaceDescription.Occlusion"), (8, "Smoothness", "Vector1", "SurfaceDescription.Smoothness"),
+ (9, "Metallic", "Vector1", "SurfaceDescription.Metallic"), (10, "Emission", "Vector3", "SurfaceDescription.Emission")]
+SLOT_KINDS = {"Vector1MaterialSlot", "Vector2MaterialSlot", "Vector3MaterialSlot", "Vector4MaterialSlot",
+ "Texture2DMaterialSlot", "Texture2DInputMaterialSlot"}
+
+
+def oid(name: str) -> str:
+ return uuid.uuid5(NS, name).hex
+
+
+def split(text: str) -> list[dict]:
+ return [json.loads(o) for o in re.split(r"\n\n(?=\{)", text.strip())]
+
+
+def join(objs: list[dict]) -> str:
+ return "\n\n".join(json.dumps(o, indent=4) for o in objs) + "\n"
+
+
+def kind(o: dict) -> str:
+ return o["m_Type"].rsplit(".", 1)[-1]
+
+
+def make_slot(protos: dict, k: str, sid: int, name: str, direction: int, owner: str) -> dict:
+ o = json.loads(json.dumps(protos[k + "MaterialSlot"]))
+ o.update({"m_ObjectId": oid(f"slot:{owner}:{sid}"), "m_Id": sid, "m_DisplayName": name, "m_SlotType": direction,
+ "m_ShaderOutputName": name, "m_Hidden": False})
+ for key in ("m_Value", "m_DefaultValue"):
+ if isinstance(o.get(key), dict):
+ o[key] = {c: 0.0 for c in o[key]}
+ elif isinstance(o.get(key), (int, float)):
+ o[key] = 0.0
+ return o
+
+
+def make_node(type_name: str, name: str, slots: list[dict], extra: dict, x: float, y: float, version: int = 0, precision: int = 0) -> dict:
+ return {"m_SGVersion": version, "m_Type": SG + type_name, "m_ObjectId": oid("node:" + name), "m_Group": {"m_Id": ""},
+ "m_Name": name, "m_DrawState": {"m_Expanded": True, "m_Position": {"serializedVersion": "2", "x": x, "y": y,
+ "width": 220.0, "height": 130.0}},
+ "m_Slots": [{"m_Id": s["m_ObjectId"]} for s in slots], "synonyms": [], "m_Precision": precision,
+ "m_PreviewExpanded": False, "m_DismissedVersion": 0, "m_PreviewMode": 0,
+ "m_CustomColors": {"m_SerializableColors": []}, **extra}
+
+
+def edge(a: dict, a_slot: int, b: dict, b_slot: int) -> dict:
+ return {"m_OutputSlot": {"m_Node": {"m_Id": a["m_ObjectId"]}, "m_SlotId": a_slot},
+ "m_InputSlot": {"m_Node": {"m_Id": b["m_ObjectId"]}, "m_SlotId": b_slot}}
+
+
+def build(template_text: str, hlsl_guid: str) -> str:
+ objs = split(template_text)
+ by_id = {o["m_ObjectId"]: o for o in objs}
+ graph = objs[0]
+ if kind(graph) != "GraphData":
+ raise ValueError("the template's first object is not its GraphData")
+ protos: dict[str, dict] = {}
+ for o in objs:
+ if kind(o) in SLOT_KINDS:
+ protos.setdefault(kind(o), o)
+ if SLOT_KINDS - protos.keys():
+ raise ValueError(f"the template lacks slot prototypes: {sorted(SLOT_KINDS - protos.keys())}")
+ block_ids = [b["m_Id"] for ctx in ("m_VertexContext", "m_FragmentContext") for b in graph[ctx]["m_Blocks"]]
+ blocks = {by_id[i]["m_SerializedDescriptor"]: by_id[i] for i in block_ids}
+
+ keep = [graph] + [o for o in objs[1:] if ".Rendering." in o["m_Type"] or kind(o) == "CategoryData"]
+ for i in block_ids:
+ keep.append(by_id[i])
+ keep += [by_id[s["m_Id"]] for s in by_id[i]["m_Slots"]]
+ for o in keep:
+ if kind(o) == "UniversalTarget":
+ o["m_CastShadows"] = True # the relief casts the map-scale shadows (plan Task 2)
+ o["m_ReceiveShadows"] = True
+
+ uv_out = make_slot(protos, "Vector4", 0, "Out", 1, "uv")
+ uv = make_node("UVNode", "UV", [uv_out], {"m_OutputChannel": 0}, -900, 0)
+ pos_out = make_slot(protos, "Vector3", 0, "Out", 1, "position")
+ pos = make_node("PositionNode", "Position", [pos_out], {"m_Space": 4, "m_PositionSource": 0}, -900, 150, version=1, precision=SINGLE)
+ nrm_out = make_slot(protos, "Vector3", 0, "Out", 1, "normal")
+ nrm = make_node("NormalVectorNode", "Normal Vector", [nrm_out], {"m_Space": 2}, -900, 300, precision=SINGLE)
+ added = [uv, uv_out, pos, pos_out, nrm, nrm_out]
+ props, prop_nodes = [], []
+ for display, ref, _ in TEXTURES:
+ p = {"m_SGVersion": 0, "m_Type": SG + "Internal.Texture2DShaderProperty", "m_ObjectId": oid("prop:" + ref),
+ "m_Guid": {"m_GuidSerialized": str(uuid.uuid5(NS, "guid:" + ref))}, "m_Name": display,
+ "m_DefaultRefNameVersion": 1, "m_RefNameGeneratedByDisplayName": display, "m_DefaultReferenceName": ref,
+ "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}
+ out = make_slot(protos, "Texture2D", 0, "Out", 1, "prop:" + ref)
+ pn = make_node("PropertyNode", display, [out], {"m_Property": {"m_Id": p["m_ObjectId"]}}, -900, 450 + 120 * len(props))
+ props.append(p)
+ prop_nodes.append(pn)
+ added += [p, pn, out]
+ cf_slots = [make_slot(protos, k, sid, name, 0, "cf") for sid, name, k in INPUTS] + \
+ [make_slot(protos, k, sid, name, 1, "cf") for sid, name, k, _ in OUTPUTS]
+ cf = make_node("CustomFunctionNode", "StatecraftTerrain (Custom Function)", cf_slots,
+ {"m_SourceType": FILE_MODE, "m_FunctionName": FUNCTION, "m_FunctionSource": hlsl_guid,
+ "m_FunctionSourceUsePragmas": True, "m_FunctionBody": ""}, -450, 100, version=1, precision=SINGLE)
+ added += [cf, *cf_slots]
+
+ edges = [edge(uv, 0, cf, 0), edge(pos, 0, cf, 1), edge(nrm, 0, cf, 2)]
+ edges += [edge(pn, 0, cf, sid) for pn, (_, _, sid) in zip(prop_nodes, TEXTURES)]
+ for sid, _, _, descriptor in OUTPUTS:
+ if descriptor not in blocks:
+ raise ValueError(f"the template has no {descriptor} block")
+ block = blocks[descriptor]
+ edges.append(edge(cf, sid, block, by_id[block["m_Slots"][0]["m_Id"]]["m_Id"]))
+
+ graph.update(m_Path=GRAPH_PATH, m_Properties=[{"m_Id": p["m_ObjectId"]} for p in props], m_Keywords=[], m_Dropdowns=[],
+ m_GroupDatas=[], m_StickyNoteDatas=[], m_Edges=edges,
+ m_Nodes=[{"m_Id": i} for i in block_ids] + [{"m_Id": n["m_ObjectId"]} for n in (uv, pos, nrm, *prop_nodes, cf)])
+ for o in keep:
+ if kind(o) == "CategoryData":
+ o["m_ChildObjectList"] = [{"m_Id": p["m_ObjectId"]} for p in props]
+ return join(keep + added)
+
+
+def main() -> int:
+ templates = sorted(ROOT.glob(TEMPLATE_GLOB))
+ if not templates:
+ print(f"no template at {TEMPLATE_GLOB}: open the project in Unity once so the package cache exists")
+ return 1
+ m = re.search(r"^guid: ([0-9a-f]{32})$", HLSL_META.read_text(), re.M) if HLSL_META.exists() else None
+ if m is None:
+ print(f"{HLSL_META} missing: import StatecraftTerrain.hlsl in Unity first")
+ return 1
+ OUT.write_text(build(templates[-1].read_text(), m.group(1)))
+ print(f"wrote {OUT} from {templates[-1].relative_to(ROOT)} (function {FUNCTION} in {m.group(1)})")
+ return 0
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/tools/tests/test_terrain_graph.py b/tools/tests/test_terrain_graph.py
new file mode 100644
index 000000000..ec9d7fd5c
--- /dev/null
+++ b/tools/tests/test_terrain_graph.py
@@ -0,0 +1,113 @@
+import json
+
+import pytest
+
+import terrain_graph as tg
+
+SG = "UnityEditor.ShaderGraph."
+
+
+def obj(t, oid, **kw):
+ return {"m_SGVersion": 0, "m_Type": t, "m_ObjectId": oid, **kw}
+
+
+def slot(kind, oid, sid, name, direction):
+ o = obj(SG + kind + "MaterialSlot", oid, m_Id=sid, m_DisplayName=name, m_SlotType=direction, m_Hidden=False,
+ m_ShaderOutputName=name, m_StageCapability=3)
+ if kind.startswith("Vector"):
+ n = int(kind[6]) if kind != "Vector1" else 1
+ o["m_Value"] = 0.0 if n == 1 else {c: 0.0 for c in "xyzw"[:n]}
+ o["m_DefaultValue"] = o["m_Value"]
+ return o
+
+
+def fixture() -> str:
+ """A small stand-in for Terrain Simple.shadergraph: the same object kinds and links, fewer of them."""
+ descriptors = ["VertexDescription.Position", "SurfaceDescription.BaseColor", "SurfaceDescription.NormalWS",
+ "SurfaceDescription.Metallic", "SurfaceDescription.Smoothness", "SurfaceDescription.Occlusion",
+ "SurfaceDescription.Emission"]
+ objs, blocks = [], []
+ for i, d in enumerate(descriptors):
+ s = slot("Vector3" if i < 3 or i == 6 else "Vector1", f"bs{i}", i, d, 0)
+ b = obj(SG + "BlockNode", f"b{i}", m_Name=d, m_Slots=[{"m_Id": s["m_ObjectId"]}], m_SerializedDescriptor=d)
+ objs += [b, s]; blocks.append(b)
+ extra_slots = [slot("Vector2", "x1", 0, "In", 0), slot("Vector4", "x2", 1, "Out", 1),
+ slot("Texture2D", "x3", 2, "Tex", 1), slot("Texture2DInput", "x4", 3, "TexIn", 0)]
+ add = obj(SG + "AddNode", "add", m_Name="Add", m_Slots=[{"m_Id": s["m_ObjectId"]} for s in extra_slots])
+ sticky = obj(SG + "StickyNoteData", "note", m_Title="sample")
+ target = obj("UnityEditor.Rendering.Universal.ShaderGraph.UniversalTarget", "urp", m_ActiveSubTarget={"m_Id": "terrain"},
+ m_CastShadows=False, m_ReceiveShadows=True)
+ sub = obj("UnityEditor.Rendering.Universal.ShaderGraph.UniversalTerrainLitSubTarget", "terrain")
+ cat = obj(SG + "CategoryData", "cat", m_Name="", m_ChildObjectList=[])
+ graph = obj(SG + "GraphData", "graph", m_Properties=[], m_Keywords=[], m_Dropdowns=[], m_CategoryData=[{"m_Id": "cat"}],
+ m_Nodes=[{"m_Id": b["m_ObjectId"]} for b in blocks] + [{"m_Id": "add"}], m_GroupDatas=[],
+ m_StickyNoteDatas=[{"m_Id": "note"}],
+ m_Edges=[{"m_OutputSlot": {"m_Node": {"m_Id": "add"}, "m_SlotId": 1}, "m_InputSlot": {"m_Node": {"m_Id": "b1"}, "m_SlotId": 1}}],
+ m_VertexContext={"m_Position": {"x": 0, "y": 0}, "m_Blocks": [{"m_Id": "b0"}]},
+ m_FragmentContext={"m_Position": {"x": 0, "y": 100}, "m_Blocks": [{"m_Id": f"b{i}"} for i in range(1, 7)]},
+ m_Path="Terrain", m_ActiveTargets=[{"m_Id": "urp"}])
+ return "\n\n".join(json.dumps(o, indent=4) for o in [graph, cat, target, sub, add, *extra_slots, sticky, *objs]) + "\n"
+
+
+GUID = "0123456789abcdef0123456789abcdef"
+
+
+def built():
+ objs = tg.split(tg.build(fixture(), GUID))
+ return objs, {o["m_ObjectId"]: o for o in objs}
+
+
+def test_sample_nodes_and_notes_go_and_the_blocks_stay():
+ objs, by_id = built()
+ graph = objs[0]
+ kinds = [tg.kind(by_id[n["m_Id"]]) for n in graph["m_Nodes"]]
+ assert kinds.count("BlockNode") == 7 and "AddNode" not in kinds
+ assert sorted(set(kinds) - {"BlockNode"}) == ["CustomFunctionNode", "NormalVectorNode", "PositionNode", "PropertyNode", "UVNode"]
+ assert graph["m_StickyNoteDatas"] == [] and "note" not in by_id and "add" not in by_id
+ assert graph["m_Path"] == "Statecraft"
+
+
+def test_every_fragment_block_is_fed_by_the_custom_function():
+ objs, by_id = built()
+ graph = objs[0]
+ cf = next(o for o in objs if tg.kind(o) == "CustomFunctionNode")
+ fed = {e["m_InputSlot"]["m_Node"]["m_Id"]: e for e in graph["m_Edges"] if e["m_OutputSlot"]["m_Node"]["m_Id"] == cf["m_ObjectId"]}
+ for sid, _, _, descriptor in tg.OUTPUTS:
+ block = next(o for o in objs if o.get("m_SerializedDescriptor") == descriptor)
+ e = fed[block["m_ObjectId"]]
+ assert e["m_OutputSlot"]["m_SlotId"] == sid
+ assert e["m_InputSlot"]["m_SlotId"] == by_id[block["m_Slots"][0]["m_Id"]]["m_Id"]
+
+
+def test_the_function_is_the_hlsl_file_by_guid_and_name_with_single_precision():
+ objs, _ = built()
+ cf = next(o for o in objs if tg.kind(o) == "CustomFunctionNode")
+ # m_SourceType 0 is File (Shader Graph's HlslSourceType is { File, String }); String with an empty body would compile
+ # to zero outputs without an error (review C1).
+ assert (cf["m_SourceType"], cf["m_FunctionName"], cf["m_FunctionSource"], cf["m_Precision"]) == (0, "StatecraftTerrain", GUID, 1)
+ assert tg.FILE_MODE == 0
+ assert next(o for o in objs if tg.kind(o) == "PositionNode")["m_Precision"] == 1
+
+
+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"]
+ 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
+
+
+def test_every_edge_is_wired_to_existing_slots_and_the_output_is_deterministic():
+ text = tg.build(fixture(), GUID)
+ assert text == tg.build(fixture(), GUID)
+ objs = tg.split(text)
+ by_id = {o["m_ObjectId"]: o for o in objs}
+ assert len(by_id) == len(objs), "object ids are unique"
+ for e in objs[0]["m_Edges"]:
+ for end in ("m_OutputSlot", "m_InputSlot"):
+ node = by_id[e[end]["m_Node"]["m_Id"]]
+ assert e[end]["m_SlotId"] in [by_id[s["m_Id"]]["m_Id"] for s in node["m_Slots"]]
+ with pytest.raises(ValueError, match="slot prototypes"):
+ tg.build(fixture().replace("Texture2DInputMaterialSlot", "SomethingElse"), GUID)
diff --git a/unity/Assets/Editor/MapMaterials.cs b/unity/Assets/Editor/MapMaterials.cs
index d004d069b..f57502bfd 100644
--- a/unity/Assets/Editor/MapMaterials.cs
+++ b/unity/Assets/Editor/MapMaterials.cs
@@ -19,10 +19,11 @@ namespace Statecraft.Game.EditorTools
public static void Create()
{
if (!AssetDatabase.IsValidFolder(Folder)) AssetDatabase.CreateFolder("Assets", "Materials");
- var terrain = Make(TerrainPath, "Universal Render Pipeline/Terrain/Lit", null);
- // Matte defaults. The terrain overrides these from each TerrainLayer (MapBuilder sets 0 there too); URP Terrain/Lit
- // exposes no specular-highlight or environment-reflection toggle.
- for (int i = 0; i < 4; i++) { terrain.SetFloat("_Smoothness" + i, 0f); terrain.SetFloat("_Metallic" + i, 0f); }
+ MapTextures.Configure();
+ // The Statecraft terrain graph (tools/terrain_graph.py + StatecraftTerrain.hlsl) with the baked textures.
+ var terrain = Make(TerrainPath, "Statecraft/StatecraftTerrain", null);
+ terrain.SetTexture("_ScBakeTex", Tex(Statecraft.Game.Map.MapTexturePaths.Bake));
+ terrain.SetTexture("_ScCoastTex", Tex(Statecraft.Game.Map.MapTexturePaths.Coast));
EditorUtility.SetDirty(terrain);
Make(OverlayPath, "Universal Render Pipeline/Unlit", new Color(0.15f, 0.12f, 0.08f, 1f));
// Settlement boxes: matte URP Lit; SettlementPlacer sets the per-type _BaseColor through a MaterialPropertyBlock.
@@ -60,5 +61,8 @@ namespace Statecraft.Game.EditorTools
EditorUtility.SetDirty(mat);
return mat;
}
+
+ static Texture2D Tex(string path) =>
+ AssetDatabase.LoadAssetAtPath<Texture2D>(path) ?? throw new System.IO.FileNotFoundException("texture missing (tools/terrain_bake.py)", path);
}
}
diff --git a/unity/Assets/Editor/MapTextures.cs b/unity/Assets/Editor/MapTextures.cs
new file mode 100644
index 000000000..6433f5cc0
--- /dev/null
+++ b/unity/Assets/Editor/MapTextures.cs
@@ -0,0 +1,35 @@
+#nullable enable
+using Statecraft.Game.Map;
+using UnityEditor;
+using UnityEngine;
+
+namespace Statecraft.Game.EditorTools
+{
+ /// <summary>Import settings of the baked map textures: linear data (not sRGB), clamped, mipmapped, 2048. The shading bake
+ /// is block-compressed (smooth fields compress well); the coast distance is one uncompressed 8-bit channel (R8), since
+ /// compression blocks would show in the 350 m foam band. Idempotent; MapMaterials.Create calls it.</summary>
+ public static class MapTextures
+ {
+ public static void Configure()
+ {
+ Set(MapTexturePaths.Bake, singleChannel: false);
+ Set(MapTexturePaths.Coast, singleChannel: true);
+ }
+
+ static void Set(string path, bool singleChannel)
+ {
+ var imp = AssetImporter.GetAtPath(path) as TextureImporter ?? throw new System.IO.FileNotFoundException("run tools/terrain_bake.py", path);
+ imp.textureType = singleChannel ? TextureImporterType.SingleChannel : TextureImporterType.Default;
+ if (singleChannel)
+ {
+ var s = new TextureImporterSettings(); imp.ReadTextureSettings(s);
+ s.singleChannelComponent = TextureImporterSingleChannelComponent.Red;
+ imp.SetTextureSettings(s);
+ }
+ imp.sRGBTexture = false; imp.mipmapEnabled = true; imp.isReadable = false;
+ imp.wrapMode = TextureWrapMode.Clamp; imp.filterMode = FilterMode.Bilinear; imp.maxTextureSize = 2048;
+ imp.textureCompression = singleChannel ? TextureImporterCompression.Uncompressed : TextureImporterCompression.Compressed;
+ imp.SaveAndReimport();
+ }
+ }
+}
diff --git a/unity/Assets/Editor/MapTextures.cs.meta b/unity/Assets/Editor/MapTextures.cs.meta
new file mode 100644
index 000000000..bcdd993e7
--- /dev/null
+++ b/unity/Assets/Editor/MapTextures.cs.meta
@@ -0,0 +1,2 @@
+fileFormatVersion: 2
+guid: 0f3a85d5e22254958a98281afcb31aeb
\ No newline at end of file
diff --git a/unity/Assets/Materials/Terrain.mat b/unity/Assets/Materials/Terrain.mat
index 16e63b056..5be2d908f 100644
--- a/unity/Assets/Materials/Terrain.mat
+++ b/unity/Assets/Materials/Terrain.mat
@@ -8,7 +8,7 @@ Material:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Terrain
- m_Shader: {fileID: 4800000, guid: 69c1f799e772cb6438f56c23efccb782, type: 3}
+ m_Shader: {fileID: -6465566751694194690, guid: fec8cf14a4bb541acbf4f191315aec66, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
@@ -23,10 +23,18 @@ Material:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
+ - _BlackTex:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
- _Control:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
+ - _DefaultWhiteTex:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
@@ -63,6 +71,18 @@ Material:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
+ - _NormalBlank:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _ScBakeTex:
+ m_Texture: {fileID: 2800000, guid: 2170c5371eef64cf0ae3a9de5631722c, type: 3}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _ScCoastTex:
+ m_Texture: {fileID: 2800000, guid: ac04311e70bde4db0a5e4129f5d58af1, 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}
@@ -83,6 +103,18 @@ Material:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
+ - unity_Lightmaps:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - unity_LightmapsInd:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - unity_ShadowMasks:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _EnableHeightBlend: 0
diff --git a/unity/Assets/Scripts/Map/MapBuilder.cs b/unity/Assets/Scripts/Map/MapBuilder.cs
index ea7ec804a..5aa4d09fb 100644
--- a/unity/Assets/Scripts/Map/MapBuilder.cs
+++ b/unity/Assets/Scripts/Map/MapBuilder.cs
@@ -12,7 +12,10 @@ namespace Statecraft.Game.Map
public static class MapBuilder
{
public const float VerticalExaggeration = 3f; // diorama look; real relief would read flat at 400 km scale
- public const int AlphamapResolution = 1024; // ~158 m (E-W) x ~421 m (N-S) per texel
+ public const int BiomeTextureResolution = 1024; // ~158 m (E-W) x ~421 m (N-S) per texel
+ /// <summary>Terrain.basemapDistance: farther than the camera ever is, so the terrain is always drawn by the Statecraft
+ /// graph, never by its low-resolution baked basemap (Unity's default switches at 1 km).</summary>
+ public const float NoBasemapDistanceM = 1e7f;
public const float BiomeLayerTileSizeM = 1000f; // layers are flat colours, so the tiling only needs to be finite
public const int OverlaySegmentsPerEdge = 10; // ~500 m sub-segments on a 5 km hex edge, each draped on the terrain
public const float OverlayClearanceM = 40f * VerticalExaggeration; // above the (exaggerated) terrain surface
@@ -76,8 +79,11 @@ namespace Statecraft.Game.Map
var terrain = terrainGo.GetComponent<Terrain>();
terrain.materialTemplate = terrainMaterial;
terrain.heightmapPixelError = TerrainPixelError;
- ApplyBiomeColours(data, frame, hexFile, assets);
- Boot.DiagLog.BootPhase("biome colours blended");
+ terrain.basemapDistance = NoBasemapDistanceM;
+ data.terrainLayers = new[] { NeutralLayer(assets) }; // one layer, one pass: the graph paints from the biome texture
+ data.alphamapResolution = 16;
+ MapShaderGlobals.Apply(terrain, meta, hexFile.hex_size_km * 1000f, BakeBiomeTexture(frame, hexFile, assets), assets);
+ Boot.DiagLog.BootPhase("biome texture baked");
var overlay = BuildHexOverlay(frame, hexFile, data, overlayMaterial, assets);
overlay.transform.SetParent(terrainGo.transform, false);
@@ -118,39 +124,47 @@ namespace Statecraft.Game.Map
$"hexes.json bounds (lon {b?.lon0}..{b?.lon1}, lat {b?.lat0}..{b?.lat1}) differ from heightmap.json (lon {meta.lon0}..{meta.lon1}, lat {meta.lat0}..{meta.lat1}) by more than {BoundsTolerance}"));
}
- /// <summary>One terrain layer per biome; each alphamap texel blends the biomes of nearby hex centres (BiomeBlender).</summary>
- static void ApplyBiomeColours(TerrainData data, GeoFrame frame, HexFile hexes, MapRuntimeAssets assets)
+ /// <summary>The single terrain layer the Terrain Lit target needs; the graph ignores its colour.</summary>
+ static TerrainLayer NeutralLayer(MapRuntimeAssets assets)
{
- var names = new List<string>(Biome.Keys);
- var layers = new TerrainLayer[names.Count];
- for (int i = 0; i < names.Count; i++)
+ var tex = assets.Own(new Texture2D(1, 1, TextureFormat.RGB24, false) { name = "TerrainLayerNeutral" }); // no alpha: no smoothness
+ tex.SetPixel(0, 0, Color.grey); tex.Apply();
+ return assets.Own(new TerrainLayer
{
- var tex = assets.Own(new Texture2D(1, 1, TextureFormat.RGB24, false) { name = "Biome_" + names[i] }); // no alpha: Terrain/Lit would read it as smoothness 1
- tex.SetPixel(0, 0, Biome[names[i]]); tex.Apply();
- layers[i] = assets.Own(new TerrainLayer
- {
- name = names[i], diffuseTexture = tex, tileSize = new Vector2(BiomeLayerTileSizeM, BiomeLayerTileSizeM),
- smoothness = 0f, metallic = 0f, // matte: URP Terrain/Lit's default 0.5 smoothness gives white streaks on slopes
- });
- }
- data.terrainLayers = layers;
- int res = AlphamapResolution; data.alphamapResolution = res;
+ name = "neutral", diffuseTexture = tex, tileSize = new Vector2(BiomeLayerTileSizeM, BiomeLayerTileSizeM),
+ smoothness = 0f, metallic = 0f,
+ });
+ }
+ /// <summary>The ground colour of every point, blended from the biomes of nearby hex centres (BiomeBlender) in the
+ /// MapPalette.Ground colours, baked once into an sRGB texture over the whole map (texel row 0 = south) that the
+ /// terrain shader samples as _ScBiomeTex. Owned by the map.</summary>
+ static Texture2D BakeBiomeTexture(GeoFrame frame, HexFile hexes, MapRuntimeAssets assets)
+ {
+ var names = new List<string>(Biome.Keys);
+ var colours = new Color[names.Count];
+ for (int i = 0; i < names.Count; i++) colours[i] = MapPalette.Ground[names[i]];
var centres = new List<Vector2>(hexes.hexes.Length); var layerOf = new List<int>(hexes.hexes.Length);
foreach (var h in hexes.hexes)
{
- int idx = names.IndexOf(h.biome); // validated in LoadHexes, before any object exists
- var w = frame.ToWorld(h.lon, h.lat, 0); centres.Add(new Vector2(w.x, w.z)); layerOf.Add(idx);
+ var w = frame.ToWorld(h.lon, h.lat, 0); centres.Add(new Vector2(w.x, w.z)); layerOf.Add(names.IndexOf(h.biome));
}
var blender = new BiomeBlender(centres, layerOf, hexes.hex_size_km * 1000f, names.Count);
- var a = new float[res, res, names.Count]; var wts = new float[names.Count];
+ int res = BiomeTextureResolution;
+ var tex = assets.Own(new Texture2D(res, res, TextureFormat.RGBA32, true, false)
+ { name = "BiomeColour", wrapMode = TextureWrapMode.Clamp, filterMode = FilterMode.Bilinear });
+ var px = new Color32[res * res]; var wts = new float[names.Count];
for (int y = 0; y < res; y++)
for (int x = 0; x < res; x++)
{
blender.Weights(new Vector2((x + 0.5f) / res * frame.WidthM, (y + 0.5f) / res * frame.LengthM), wts);
- for (int l = 0; l < wts.Length; l++) a[y, x, l] = wts[l];
+ var c = Color.clear;
+ for (int l = 0; l < wts.Length; l++) c += colours[l] * wts[l];
+ c.a = 1f;
+ px[y * res + x] = c;
}
- data.SetAlphamaps(0, 0, a);
+ tex.SetPixels32(px); tex.Apply(true, false);
+ return tex;
}
/// <summary>Distances (m) of the border skirt's rings from the map's edge: land falls from the edge's height to sea
diff --git a/unity/Assets/Scripts/Map/MapPalette.cs b/unity/Assets/Scripts/Map/MapPalette.cs
new file mode 100644
index 000000000..26f4fd9e8
--- /dev/null
+++ b/unity/Assets/Scripts/Map/MapPalette.cs
@@ -0,0 +1,21 @@
+#nullable enable
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace Statecraft.Game.Map
+{
+ /// <summary>The ground colours the terrain shader paints per biome (sRGB; MapBuilder bakes them, blended between hexes,
+ /// into the biome texture). Warmer and more saturated than MapBuilder.BiomeColours, which the minimap keeps: dry-grass
+ /// gold on the coastal plain, olive-ochre hills, sand-amber desert (research notes §1, promo 03). "sea" and "lake" are
+ /// only seen where a lake or sea hex's blend reaches the shore; the water itself is shaded from the coast texture.</summary>
+ public static class MapPalette
+ {
+ public static IReadOnlyDictionary<string, Color> Ground { get; } = new Dictionary<string, Color>
+ {
+ ["sea"] = new Color(0.62f, 0.60f, 0.42f), ["lake"] = new Color(0.60f, 0.58f, 0.42f),
+ ["coastal_plain"] = new Color(0.64f, 0.62f, 0.36f), ["hills"] = new Color(0.66f, 0.58f, 0.38f),
+ ["mountains"] = new Color(0.62f, 0.53f, 0.40f), ["valley"] = new Color(0.58f, 0.58f, 0.37f),
+ ["desert"] = new Color(0.84f, 0.70f, 0.48f),
+ };
+ }
+}
diff --git a/unity/Assets/Scripts/Map/MapPalette.cs.meta b/unity/Assets/Scripts/Map/MapPalette.cs.meta
new file mode 100644
index 000000000..a9bee06e8
--- /dev/null
+++ b/unity/Assets/Scripts/Map/MapPalette.cs.meta
@@ -0,0 +1,2 @@
+fileFormatVersion: 2
+guid: c8288e17384174f06ad21e849bc05dcb
\ No newline at end of file
diff --git a/unity/Assets/Scripts/Map/MapShaderGlobals.cs b/unity/Assets/Scripts/Map/MapShaderGlobals.cs
new file mode 100644
index 000000000..3644e7ffb
--- /dev/null
+++ b/unity/Assets/Scripts/Map/MapShaderGlobals.cs
@@ -0,0 +1,59 @@
+#nullable enable
+using UnityEngine;
+
+namespace Statecraft.Game.Map
+{
+ /// <summary>The global shader values StatecraftMap.hlsl reads, set when the map is built (MapBuilder.Build): the map's
+ /// size, sea level and exaggeration, its origin and hex size, the biome colour texture and the haze. Globals, not
+ /// material values, so the shared editor-made materials are never changed or instanced at run time.</summary>
+ public static class MapShaderGlobals
+ {
+ 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");
+
+ /// <summary>A warm, dusty haze over land (sRGB).</summary>
+ public static readonly Color HazeColour = new Color(0.80f, 0.76f, 0.68f);
+ public const float HazeMax = 0.6f;
+ /// <summary>A cooler, weaker haze over water (review I2), so the sea stays the promo's saturated blue towards the
+ /// horizon: 0.4 of the land's strength.</summary>
+ public static readonly Color WaterHazeColour = new Color(0.62f, 0.74f, 0.86f);
+ public const float WaterHazeMax = HazeMax * 0.4f;
+ /// <summary>Distance scale of the aerial haze: 1 - exp(-d / scale); at the gameplay pose's far edge (about 85 km) 19%.</summary>
+ public const float HazeDistanceM = 400000f;
+ /// <summary>Real elevations between which the haze thickens, low in the Jordan rift.</summary>
+ // Whole metres, written as integer literals: HudTests.NoScriptRescalesADisplayedNumberItself would read the float
+ // literal of a hundred as a percent rescale.
+ public const float RiftHazeTopM = -100, RiftHazeFullM = -400;
+
+ static Vector4 haze, hazeWater;
+
+ public static void Apply(Terrain terrain, HeightmapMeta meta, float hexSizeM, Texture2D biome, MapRuntimeAssets assets)
+ {
+ var size = terrain.terrainData.size; var o = terrain.transform.position;
+ float Y(float elevM) => o.y + (elevM - meta.elev_min_m) * MapBuilder.VerticalExaggeration;
+ Shader.SetGlobalVector(Map, new Vector4(size.x, size.z, Y(0f), MapBuilder.VerticalExaggeration));
+ Shader.SetGlobalVector(MapOrigin, new Vector4(o.x, o.y, o.z, hexSizeM));
+ Shader.SetGlobalTexture(Biome, biome);
+ var c = HazeColour.linear;
+ haze = new Vector4(c.r, c.g, c.b, HazeMax);
+ var w = WaterHazeColour.linear;
+ hazeWater = new Vector4(w.r, w.g, w.b, WaterHazeMax);
+ Shader.SetGlobalVector(Haze, haze);
+ Shader.SetGlobalVector(HazeWater, hazeWater);
+ Shader.SetGlobalVector(HazeRange, new Vector4(Y(RiftHazeTopM), Y(RiftHazeFullM), HazeDistanceM, 0f));
+ assets.OnTeardown(VisualToggles.Register("haze", on =>
+ {
+ Shader.SetGlobalVector(Haze, on ? haze : new Vector4(haze.x, haze.y, haze.z, 0f));
+ Shader.SetGlobalVector(HazeWater, on ? hazeWater : new Vector4(hazeWater.x, hazeWater.y, hazeWater.z, 0f));
+ }));
+ }
+ }
+
+ /// <summary>The baked map textures (tools/terrain_bake.py), shared by the editor scripts and the tests.</summary>
+ public static class MapTexturePaths
+ {
+ public const string Bake = "Assets/Textures/Map/terrain_bake.png";
+ public const string Coast = "Assets/Textures/Map/coast.png";
+ }
+}
diff --git a/unity/Assets/Scripts/Map/MapShaderGlobals.cs.meta b/unity/Assets/Scripts/Map/MapShaderGlobals.cs.meta
new file mode 100644
index 000000000..a4c86badc
--- /dev/null
+++ b/unity/Assets/Scripts/Map/MapShaderGlobals.cs.meta
@@ -0,0 +1,2 @@
+fileFormatVersion: 2
+guid: b115a7748f085495397e436a5bb5a2c5
\ No newline at end of file
diff --git a/unity/Assets/Shaders/StatecraftMap.hlsl b/unity/Assets/Shaders/StatecraftMap.hlsl
new file mode 100644
index 000000000..bf540d480
--- /dev/null
+++ b/unity/Assets/Shaders/StatecraftMap.hlsl
@@ -0,0 +1,63 @@
+#ifndef STATECRAFT_MAP_INCLUDED
+#define STATECRAFT_MAP_INCLUDED
+// Shared by the terrain graph's Custom Function (StatecraftTerrain.hlsl) and the sea (Sea.shader). The globals are set by
+// MapShaderGlobals.Apply (C#) whenever the map is built. Colours are linear; SRGBToLinear converts the authored sRGB values.
+
+float4 _ScMap; // x width (m, east), y length (m, north), z sea level (world y), w vertical exaggeration
+float4 _ScMapOrigin; // xyz terrain origin (world), w hex circumradius (m)
+float4 _ScHaze; // rgb land haze colour (linear), a strongest land haze (0..1)
+float4 _ScHazeWater; // rgb water haze colour (linear, cooler), a strongest water haze (weaker: the sea keeps its blue)
+float4 _ScHazeRange; // x rift haze begins (world y), y rift haze is full (world y), z aerial distance scale (m)
+TEXTURE2D(_ScBiomeTex); SAMPLER(sampler_ScBiomeTex);
+
+float ScHash(float2 p)
+{
+ p = frac(p * float2(0.1031, 0.1030));
+ p += dot(p, p.yx + 33.33);
+ return frac((p.x + p.y) * p.x);
+}
+
+float ScNoise(float2 p)
+{
+ float2 i = floor(p), f = frac(p);
+ float2 u = f * f * (3.0 - 2.0 * f);
+ return lerp(lerp(ScHash(i), ScHash(i + float2(1, 0)), u.x), lerp(ScHash(i + float2(0, 1)), ScHash(i + float2(1, 1)), u.x), u.y);
+}
+
+// Aerial perspective, 0..1 before each surface's strength: grows with distance (1 - exp(-d / scale)) and up to 2.5x low in
+// the rift. It is applied after lighting on both surfaces (review I2): land outputs BaseColor x (1 - h) plus Emission =
+// haze colour x h, so Lit's result is lerp(lit ground, haze, h); water lerps its final colour (ScHazeWater).
+float ScHazeAmount(float3 positionWS)
+{
+ float dist = length(_WorldSpaceCameraPos - positionWS);
+ float aerial = 1.0 - exp(-dist / max(_ScHazeRange.z, 1.0));
+ float low = saturate((_ScHazeRange.x - positionWS.y) / max(_ScHazeRange.x - _ScHazeRange.y, 1.0));
+ return saturate(aerial * (1.0 + 1.5 * low));
+}
+
+float3 ScHazeWater(float3 colour, float3 positionWS)
+{
+ return lerp(colour, _ScHazeWater.rgb, _ScHazeWater.a * ScHazeAmount(positionWS));
+}
+
+// 1 in water, 0 on land; coast is the signed distance texture (0.5 at the shore, tools/terrain_bake.py).
+float ScWater(float coast) { return 1.0 - smoothstep(0.497, 0.503, coast); }
+
+// 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, g curvature, b sky-view).
+float3 ScGround(float2 uv, float2 mapM, float3 n, float3 positionWS, float4 bake)
+{
+ float elevM = (positionWS.y - _ScMap.z) / _ScMap.w; // real metres above sea level
+ float slope = 1.0 - saturate(n.y); // 0 flat, 1 vertical
+ float3 g = SAMPLE_TEXTURE2D(_ScBiomeTex, sampler_ScBiomeTex, uv).rgb;
+ g = lerp(g, g * float3(1.08, 1.00, 0.86), smoothstep(500.0, 1100.0, elevM));
+ 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);
+ g *= 0.93 + 0.14 * (ScNoise(mapM / 2600.0) * 0.6 + ScNoise(mapM / 520.0) * 0.4);
+ g *= 1.0 + 0.30 * (bake.g - 0.5) * 2.0;
+ g *= lerp(1.0, bake.r * lerp(0.6, 1.0, bake.b), 0.45);
+ return g;
+}
+
+#endif
diff --git a/unity/Assets/Shaders/StatecraftMap.hlsl.meta b/unity/Assets/Shaders/StatecraftMap.hlsl.meta
new file mode 100644
index 000000000..08aefebbc
--- /dev/null
+++ b/unity/Assets/Shaders/StatecraftMap.hlsl.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 2ffc4c56ae06841f58bb51f722acceec
+ShaderIncludeImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/unity/Assets/Shaders/StatecraftTerrain.hlsl b/unity/Assets/Shaders/StatecraftTerrain.hlsl
new file mode 100644
index 000000000..98c03102c
--- /dev/null
+++ b/unity/Assets/Shaders/StatecraftTerrain.hlsl
@@ -0,0 +1,29 @@
+#ifndef STATECRAFT_TERRAIN_INCLUDED
+#define STATECRAFT_TERRAIN_INCLUDED
+#include "Assets/Shaders/StatecraftMap.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 (r AO, g curvature, b sky-view); Coast is coast.png (0.5 = shore, lower = water).
+void StatecraftTerrain_float(float2 UV, float3 PositionWS, float3 NormalWS, UnityTexture2D Bake, UnityTexture2D Coast,
+ out float3 BaseColor, out float3 NormalOut, out float Occlusion, out float Smoothness, out float Metallic, out float3 Emission)
+{
+ float3 n = normalize(NormalWS);
+ float4 bake = SAMPLE_TEXTURE2D(Bake.tex, Bake.samplerstate, UV);
+ float coast = SAMPLE_TEXTURE2D(Coast.tex, Coast.samplerstate, UV).r;
+ float2 mapM = UV * _ScMap.xy;
+ float3 ground = ScGround(UV, mapM, n, PositionWS, 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);
+ // Water: the flat sea colour, lit like the skirt's URP Lit Sea.mat so the map's edge shows no seam (Task 7 replaces
+ // both sides with ScWaterShade together). No haze on water yet: the skirt's URP Lit sea has none either.
+ BaseColor = lerp(ground * (1.0 - h), SRGBToLinear(float3(0.16, 0.42, 0.55)), water);
+ NormalOut = normalize(lerp(n, float3(0, 1, 0), water));
+ Occlusion = lerp(lerp(1.0, ao, 0.8), 1.0, water);
+ Smoothness = 0.0;
+ Metallic = 0.0;
+ Emission = _ScHaze.rgb * h * (1.0 - water);
+}
+
+#endif
diff --git a/unity/Assets/Shaders/StatecraftTerrain.hlsl.meta b/unity/Assets/Shaders/StatecraftTerrain.hlsl.meta
new file mode 100644
index 000000000..d763f5fbc
--- /dev/null
+++ b/unity/Assets/Shaders/StatecraftTerrain.hlsl.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 2ffabe5c4710a4e518d5f81ca5c4fa46
+ShaderIncludeImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/unity/Assets/Shaders/StatecraftTerrain.shadergraph b/unity/Assets/Shaders/StatecraftTerrain.shadergraph
new file mode 100644
index 000000000..29f67c9d8
--- /dev/null
+++ b/unity/Assets/Shaders/StatecraftTerrain.shadergraph
@@ -0,0 +1,2215 @@
+{
+ "m_SGVersion": 3,
+ "m_Type": "UnityEditor.ShaderGraph.GraphData",
+ "m_ObjectId": "d5b4bead42e54d299ea50d11f4806039",
+ "m_Properties": [
+ {
+ "m_Id": "f4227b0694b35d8c89b0cc59542ea231"
+ },
+ {
+ "m_Id": "6c3b295f2d98598598e0245ee0a38e65"
+ }
+ ],
+ "m_Keywords": [],
+ "m_Dropdowns": [],
+ "m_CategoryData": [
+ {
+ "m_Id": "6832e70254074076b2f9f8afdebe738b"
+ }
+ ],
+ "m_Nodes": [
+ {
+ "m_Id": "95f386bd83ab4ea991e4bae0f72b3401"
+ },
+ {
+ "m_Id": "3e11b3447e3b4b959b3242f811d2f317"
+ },
+ {
+ "m_Id": "3f64231908584ca8aeb831d5c0683197"
+ },
+ {
+ "m_Id": "04032cb76dc74acc9b49ba73e2321dbf"
+ },
+ {
+ "m_Id": "4862224b0573442291394dafefab7c54"
+ },
+ {
+ "m_Id": "097e106dbe064cf49f1d0052befedaea"
+ },
+ {
+ "m_Id": "a1f5c0089d7e4280a8118c875f837457"
+ },
+ {
+ "m_Id": "71407d15f06753b89c0b98e3450ff436"
+ },
+ {
+ "m_Id": "763a77e708035709ac25714684151d99"
+ },
+ {
+ "m_Id": "f4f0c1872db55a8aa50643addb74b9e8"
+ },
+ {
+ "m_Id": "9bed353632ae55ba96bcd2c3c3ee2275"
+ },
+ {
+ "m_Id": "a3e15ab001b759f6b126319858f4b91e"
+ },
+ {
+ "m_Id": "0c721d24051f5765970882f281b1f92f"
+ }
+ ],
+ "m_GroupDatas": [],
+ "m_StickyNoteDatas": [],
+ "m_Edges": [
+ {
+ "m_OutputSlot": {
+ "m_Node": {
+ "m_Id": "71407d15f06753b89c0b98e3450ff436"
+ },
+ "m_SlotId": 0
+ },
+ "m_InputSlot": {
+ "m_Node": {
+ "m_Id": "0c721d24051f5765970882f281b1f92f"
+ },
+ "m_SlotId": 0
+ }
+ },
+ {
+ "m_OutputSlot": {
+ "m_Node": {
+ "m_Id": "763a77e708035709ac25714684151d99"
+ },
+ "m_SlotId": 0
+ },
+ "m_InputSlot": {
+ "m_Node": {
+ "m_Id": "0c721d24051f5765970882f281b1f92f"
+ },
+ "m_SlotId": 1
+ }
+ },
+ {
+ "m_OutputSlot": {
+ "m_Node": {
+ "m_Id": "f4f0c1872db55a8aa50643addb74b9e8"
+ },
+ "m_SlotId": 0
+ },
+ "m_InputSlot": {
+ "m_Node": {
+ "m_Id": "0c721d24051f5765970882f281b1f92f"
+ },
+ "m_SlotId": 2
+ }
+ },
+ {
+ "m_OutputSlot": {
+ "m_Node": {
+ "m_Id": "9bed353632ae55ba96bcd2c3c3ee2275"
+ },
+ "m_SlotId": 0
+ },
+ "m_InputSlot": {
+ "m_Node": {
+ "m_Id": "0c721d24051f5765970882f281b1f92f"
+ },
+ "m_SlotId": 3
+ }
+ },
+ {
+ "m_OutputSlot": {
+ "m_Node": {
+ "m_Id": "a3e15ab001b759f6b126319858f4b91e"
+ },
+ "m_SlotId": 0
+ },
+ "m_InputSlot": {
+ "m_Node": {
+ "m_Id": "0c721d24051f5765970882f281b1f92f"
+ },
+ "m_SlotId": 4
+ }
+ },
+ {
+ "m_OutputSlot": {
+ "m_Node": {
+ "m_Id": "0c721d24051f5765970882f281b1f92f"
+ },
+ "m_SlotId": 5
+ },
+ "m_InputSlot": {
+ "m_Node": {
+ "m_Id": "3e11b3447e3b4b959b3242f811d2f317"
+ },
+ "m_SlotId": 0
+ }
+ },
+ {
+ "m_OutputSlot": {
+ "m_Node": {
+ "m_Id": "0c721d24051f5765970882f281b1f92f"
+ },
+ "m_SlotId": 6
+ },
+ "m_InputSlot": {
+ "m_Node": {
+ "m_Id": "a1f5c0089d7e4280a8118c875f837457"
+ },
+ "m_SlotId": 0
+ }
+ },
+ {
+ "m_OutputSlot": {
+ "m_Node": {
+ "m_Id": "0c721d24051f5765970882f281b1f92f"
+ },
+ "m_SlotId": 7
+ },
+ "m_InputSlot": {
+ "m_Node": {
+ "m_Id": "04032cb76dc74acc9b49ba73e2321dbf"
+ },
+ "m_SlotId": 0
+ }
+ },
+ {
+ "m_OutputSlot": {
+ "m_Node": {
+ "m_Id": "0c721d24051f5765970882f281b1f92f"
+ },
+ "m_SlotId": 8
+ },
+ "m_InputSlot": {
+ "m_Node": {
+ "m_Id": "3f64231908584ca8aeb831d5c0683197"
+ },
+ "m_SlotId": 0
+ }
+ },
+ {
+ "m_OutputSlot": {
+ "m_Node": {
+ "m_Id": "0c721d24051f5765970882f281b1f92f"
+ },
+ "m_SlotId": 9
+ },
+ "m_InputSlot": {
+ "m_Node": {
+ "m_Id": "4862224b0573442291394dafefab7c54"
+ },
+ "m_SlotId": 0
+ }
+ },
+ {
+ "m_OutputSlot": {
+ "m_Node": {
+ "m_Id": "0c721d24051f5765970882f281b1f92f"
+ },
+ "m_SlotId": 10
+ },
+ "m_InputSlot": {
+ "m_Node": {
+ "m_Id": "097e106dbe064cf49f1d0052befedaea"
+ },
+ "m_SlotId": 0
+ }
+ }
+ ],
+ "m_VertexContext": {
+ "m_Position": {
+ "x": 128.66664123535156,
+ "y": 3.3333349227905273
+ },
+ "m_Blocks": [
+ {
+ "m_Id": "95f386bd83ab4ea991e4bae0f72b3401"
+ }
+ ]
+ },
+ "m_FragmentContext": {
+ "m_Position": {
+ "x": 128.66664123535156,
+ "y": 119.33334350585938
+ },
+ "m_Blocks": [
+ {
+ "m_Id": "3e11b3447e3b4b959b3242f811d2f317"
+ },
+ {
+ "m_Id": "3f64231908584ca8aeb831d5c0683197"
+ },
+ {
+ "m_Id": "04032cb76dc74acc9b49ba73e2321dbf"
+ },
+ {
+ "m_Id": "4862224b0573442291394dafefab7c54"
+ },
+ {
+ "m_Id": "097e106dbe064cf49f1d0052befedaea"
+ },
+ {
+ "m_Id": "a1f5c0089d7e4280a8118c875f837457"
+ }
+ ]
+ },
+ "m_PreviewData": {
+ "serializedMesh": {
+ "m_SerializedMesh": "{\"mesh\":{\"instanceID\":0}}",
+ "m_Guid": ""
+ },
+ "preventRotation": false
+ },
+ "m_Path": "Statecraft",
+ "m_GraphPrecision": 2,
+ "m_PreviewMode": 2,
+ "m_OutputNode": {
+ "m_Id": ""
+ },
+ "m_SubDatas": [],
+ "m_ActiveTargets": [
+ {
+ "m_Id": "fae0956ffbe844049ecc902ae2d3a790"
+ },
+ {
+ "m_Id": "36f0c9c016e64fe09de33416739d5bde"
+ }
+ ]
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.LightingData",
+ "m_ObjectId": "01362e5f3582451daae9e107d6ab8251",
+ "m_NormalDropOffSpace": 0,
+ "m_BlendPreserveSpecular": true,
+ "m_ReceiveDecals": true,
+ "m_ReceiveSSR": true,
+ "m_ReceiveSSRTransparent": false,
+ "m_SpecularAA": false,
+ "m_SpecularOcclusionMode": 1,
+ "m_OverrideBakedGI": false
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.LightingData",
+ "m_ObjectId": "04b39b25d8cf4a209bfaacef8f49806c",
+ "m_NormalDropOffSpace": 2,
+ "m_BlendPreserveSpecular": true,
+ "m_ReceiveDecals": true,
+ "m_ReceiveSSR": true,
+ "m_ReceiveSSRTransparent": false,
+ "m_SpecularAA": false,
+ "m_SpecularOcclusionMode": 0,
+ "m_OverrideBakedGI": false
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.BuiltinData",
+ "m_ObjectId": "068ba20301984c44b9e5e1028b0be9ec",
+ "m_Distortion": false,
+ "m_DistortionMode": 0,
+ "m_DistortionDepthTest": true,
+ "m_AddPrecomputedVelocity": false,
+ "m_TransparentWritesMotionVec": false,
+ "m_DepthOffset": false,
+ "m_ConservativeDepthOffset": false,
+ "m_TransparencyFog": true,
+ "m_AlphaTestShadow": false,
+ "m_BackThenFrontRendering": false,
+ "m_TransparentDepthPrepass": false,
+ "m_TransparentDepthPostpass": false,
+ "m_TransparentPerPixelSorting": false,
+ "m_SupportLodCrossFade": false
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.TerrainLitSubTarget",
+ "m_ObjectId": "0b5f3cd0d4284616a338d139bbc192fe"
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.SystemData",
+ "m_ObjectId": "0eb7f72acf3f49a6902e08bb6b942511",
+ "m_MaterialNeedsUpdateHash": 0,
+ "m_SurfaceType": 0,
+ "m_RenderingPass": 1,
+ "m_BlendMode": 0,
+ "m_ZTest": 4,
+ "m_ZWrite": false,
+ "m_TransparentCullMode": 2,
+ "m_OpaqueCullMode": 2,
+ "m_SortPriority": 0,
+ "m_AlphaTest": false,
+ "m_ExcludeFromTUAndAA": false,
+ "m_TransparentDepthPrepass": false,
+ "m_TransparentDepthPostpass": false,
+ "m_SupportLodCrossFade": false,
+ "m_DoubleSidedMode": 0,
+ "m_DOTSInstancing": false,
+ "m_CustomVelocity": false,
+ "m_Tessellation": false,
+ "m_TessellationMode": 0,
+ "m_TessellationFactorMinDistance": 20.0,
+ "m_TessellationFactorMaxDistance": 50.0,
+ "m_TessellationFactorTriangleSize": 100.0,
+ "m_TessellationShapeFactor": 0.75,
+ "m_TessellationBackFaceCullEpsilon": -0.25,
+ "m_TessellationMaxDisplacement": 0.009999999776482582,
+ "m_DebugSymbols": false,
+ "m_Version": 2,
+ "inspectorFoldoutMask": 0
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.TerrainLitData",
+ "m_ObjectId": "14de12e84a754ddc85b4044a5f06a6f6",
+ "m_EnableHeightBlened": false,
+ "m_HeightTransition": 0.0,
+ "m_EnableInstancedPerPixelNormal": true,
+ "m_RayTracing": false
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.TerrainLitData",
+ "m_ObjectId": "153f998865404f90b7545c132060f0cb",
+ "m_EnableHeightBlened": false,
+ "m_HeightTransition": 0.0,
+ "m_EnableInstancedPerPixelNormal": true
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.SystemData",
+ "m_ObjectId": "262a16b1f12f425f9438e6a956593999",
+ "m_MaterialNeedsUpdateHash": 0,
+ "m_SurfaceType": 0,
+ "m_RenderingPass": 1,
+ "m_BlendMode": 0,
+ "m_ZTest": 4,
+ "m_ZWrite": false,
+ "m_TransparentCullMode": 2,
+ "m_OpaqueCullMode": 2,
+ "m_SortPriority": 0,
+ "m_AlphaTest": false,
+ "m_ExcludeFromTUAndAA": false,
+ "m_TransparentDepthPrepass": false,
+ "m_TransparentDepthPostpass": false,
+ "m_SupportLodCrossFade": false,
+ "m_DoubleSidedMode": 0,
+ "m_DOTSInstancing": false,
+ "m_CustomVelocity": false,
+ "m_Tessellation": false,
+ "m_TessellationMode": 0,
+ "m_TessellationFactorMinDistance": 20.0,
+ "m_TessellationFactorMaxDistance": 50.0,
+ "m_TessellationFactorTriangleSize": 100.0,
+ "m_TessellationShapeFactor": 0.75,
+ "m_TessellationBackFaceCullEpsilon": -0.25,
+ "m_TessellationMaxDisplacement": 0.009999999776482582,
+ "m_DebugSymbols": false,
+ "m_Version": 2,
+ "inspectorFoldoutMask": 0
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.BuiltinData",
+ "m_ObjectId": "281a8f77e71a488cb2a1dba2d375d754",
+ "m_Distortion": false,
+ "m_DistortionMode": 0,
+ "m_DistortionDepthTest": true,
+ "m_AddPrecomputedVelocity": false,
+ "m_TransparentWritesMotionVec": false,
+ "m_DepthOffset": false,
+ "m_ConservativeDepthOffset": false,
+ "m_TransparencyFog": true,
+ "m_AlphaTestShadow": false,
+ "m_BackThenFrontRendering": false,
+ "m_TransparentDepthPrepass": false,
+ "m_TransparentDepthPostpass": false,
+ "m_TransparentPerPixelSorting": false,
+ "m_SupportLodCrossFade": false
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.BuiltinData",
+ "m_ObjectId": "2b09475c5ab449eb988b2b3d528000c4",
+ "m_Distortion": false,
+ "m_DistortionMode": 0,
+ "m_DistortionDepthTest": true,
+ "m_AddPrecomputedVelocity": false,
+ "m_TransparentWritesMotionVec": false,
+ "m_DepthOffset": false,
+ "m_ConservativeDepthOffset": false,
+ "m_TransparencyFog": true,
+ "m_AlphaTestShadow": false,
+ "m_BackThenFrontRendering": false,
+ "m_TransparentDepthPrepass": false,
+ "m_TransparentDepthPostpass": false,
+ "m_TransparentPerPixelSorting": false,
+ "m_SupportLodCrossFade": false
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.TerrainLitSubTarget",
+ "m_ObjectId": "3281eb9c8f24472abe6c9a0f4171920d"
+}
+
+{
+ "m_SGVersion": 1,
+ "m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalTerrainLitSubTarget",
+ "m_ObjectId": "33bb7a2102f54f5fb3ca878a425b1a02",
+ "m_EnableHeightBlend": false,
+ "m_HeightTransition": 0.0,
+ "m_EnableInstancedPerPixelNormal": false,
+ "m_NormalDropOffSpace": 0,
+ "m_BlendModePreserveSpecular": true
+}
+
+{
+ "m_SGVersion": 1,
+ "m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalTarget",
+ "m_ObjectId": "36f0c9c016e64fe09de33416739d5bde",
+ "m_Datas": [],
+ "m_ActiveSubTarget": {
+ "m_Id": "33bb7a2102f54f5fb3ca878a425b1a02"
+ },
+ "m_AllowMaterialOverride": false,
+ "m_SurfaceType": 0,
+ "m_ZTestMode": 4,
+ "m_ZWriteControl": 0,
+ "m_AlphaMode": 0,
+ "m_RenderFace": 2,
+ "m_AlphaClip": false,
+ "m_CastShadows": true,
+ "m_ReceiveShadows": true,
+ "m_DisableTint": false,
+ "m_Sort3Das2DCompatible": false,
+ "m_AdditionalMotionVectorMode": 0,
+ "m_AlembicMotionVectors": false,
+ "m_SupportsLODCrossFade": false,
+ "m_CustomEditorGUI": "",
+ "m_SupportVFX": false
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.SystemData",
+ "m_ObjectId": "376c08cf30604cca875694fe7edbc7ec",
+ "m_MaterialNeedsUpdateHash": 0,
+ "m_SurfaceType": 0,
+ "m_RenderingPass": 1,
+ "m_BlendMode": 0,
+ "m_ZTest": 4,
+ "m_ZWrite": false,
+ "m_TransparentCullMode": 2,
+ "m_OpaqueCullMode": 2,
+ "m_SortPriority": 0,
+ "m_AlphaTest": false,
+ "m_ExcludeFromTUAndAA": false,
+ "m_TransparentDepthPrepass": false,
+ "m_TransparentDepthPostpass": false,
+ "m_SupportLodCrossFade": false,
+ "m_DoubleSidedMode": 0,
+ "m_DOTSInstancing": false,
+ "m_CustomVelocity": false,
+ "m_Tessellation": false,
+ "m_TessellationMode": 0,
+ "m_TessellationFactorMinDistance": 20.0,
+ "m_TessellationFactorMaxDistance": 50.0,
+ "m_TessellationFactorTriangleSize": 100.0,
+ "m_TessellationShapeFactor": 0.75,
+ "m_TessellationBackFaceCullEpsilon": -0.25,
+ "m_TessellationMaxDisplacement": 0.009999999776482582,
+ "m_DebugSymbols": false,
+ "m_Version": 2,
+ "inspectorFoldoutMask": 0
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.TerrainLitSubTarget",
+ "m_ObjectId": "39e38063d9c245d38cb1b53142c0a90c"
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.LightingData",
+ "m_ObjectId": "39f89452995e4b3f83f51fb317a21332",
+ "m_NormalDropOffSpace": 0,
+ "m_BlendPreserveSpecular": true,
+ "m_ReceiveDecals": true,
+ "m_ReceiveSSR": true,
+ "m_ReceiveSSRTransparent": false,
+ "m_SpecularAA": false,
+ "m_SpecularOcclusionMode": 1,
+ "m_OverrideBakedGI": false
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.BuiltinData",
+ "m_ObjectId": "444c7c70b4a94a098abe529ac9d59655",
+ "m_Distortion": false,
+ "m_DistortionMode": 0,
+ "m_DistortionDepthTest": true,
+ "m_AddPrecomputedVelocity": false,
+ "m_TransparentWritesMotionVec": false,
+ "m_DepthOffset": false,
+ "m_ConservativeDepthOffset": false,
+ "m_TransparencyFog": true,
+ "m_AlphaTestShadow": false,
+ "m_BackThenFrontRendering": false,
+ "m_TransparentDepthPrepass": false,
+ "m_TransparentDepthPostpass": false,
+ "m_TransparentPerPixelSorting": false,
+ "m_SupportLodCrossFade": false
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.SystemData",
+ "m_ObjectId": "4a3fa0f005304f75a4b3cd7ae452c751",
+ "m_MaterialNeedsUpdateHash": 0,
+ "m_SurfaceType": 0,
+ "m_RenderingPass": 1,
+ "m_BlendMode": 0,
+ "m_ZTest": 4,
+ "m_ZWrite": false,
+ "m_TransparentCullMode": 2,
+ "m_OpaqueCullMode": 2,
+ "m_SortPriority": 0,
+ "m_AlphaTest": false,
+ "m_ExcludeFromTUAndAA": false,
+ "m_TransparentDepthPrepass": false,
+ "m_TransparentDepthPostpass": false,
+ "m_SupportLodCrossFade": false,
+ "m_DoubleSidedMode": 0,
+ "m_DOTSInstancing": false,
+ "m_CustomVelocity": false,
+ "m_Tessellation": false,
+ "m_TessellationMode": 0,
+ "m_TessellationFactorMinDistance": 20.0,
+ "m_TessellationFactorMaxDistance": 50.0,
+ "m_TessellationFactorTriangleSize": 100.0,
+ "m_TessellationShapeFactor": 0.75,
+ "m_TessellationBackFaceCullEpsilon": -0.25,
+ "m_TessellationMaxDisplacement": 0.009999999776482582,
+ "m_DebugSymbols": false,
+ "m_Version": 2,
+ "inspectorFoldoutMask": 0
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.BuiltinData",
+ "m_ObjectId": "5651a258420f4a8082e597f2286efe9f",
+ "m_Distortion": false,
+ "m_DistortionMode": 0,
+ "m_DistortionDepthTest": true,
+ "m_AddPrecomputedVelocity": false,
+ "m_TransparentWritesMotionVec": false,
+ "m_DepthOffset": false,
+ "m_ConservativeDepthOffset": false,
+ "m_TransparencyFog": true,
+ "m_AlphaTestShadow": false,
+ "m_BackThenFrontRendering": false,
+ "m_TransparentDepthPrepass": false,
+ "m_TransparentDepthPostpass": false,
+ "m_TransparentPerPixelSorting": false,
+ "m_SupportLodCrossFade": false
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.LightingData",
+ "m_ObjectId": "59cd7c40c3ca463691f1ee29f93dfa93",
+ "m_NormalDropOffSpace": 0,
+ "m_BlendPreserveSpecular": true,
+ "m_ReceiveDecals": true,
+ "m_ReceiveSSR": true,
+ "m_ReceiveSSRTransparent": false,
+ "m_SpecularAA": false,
+ "m_SpecularOcclusionMode": 1,
+ "m_OverrideBakedGI": false
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.BuiltinData",
+ "m_ObjectId": "62766492890547c3bf6ba57262dd0b1e",
+ "m_Distortion": false,
+ "m_DistortionMode": 0,
+ "m_DistortionDepthTest": true,
+ "m_AddPrecomputedVelocity": false,
+ "m_TransparentWritesMotionVec": false,
+ "m_DepthOffset": false,
+ "m_ConservativeDepthOffset": false,
+ "m_TransparencyFog": true,
+ "m_AlphaTestShadow": false,
+ "m_BackThenFrontRendering": false,
+ "m_TransparentDepthPrepass": false,
+ "m_TransparentDepthPostpass": false,
+ "m_TransparentPerPixelSorting": false,
+ "m_SupportLodCrossFade": false
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.ShaderGraph.CategoryData",
+ "m_ObjectId": "6832e70254074076b2f9f8afdebe738b",
+ "m_Name": "",
+ "m_ChildObjectList": [
+ {
+ "m_Id": "f4227b0694b35d8c89b0cc59542ea231"
+ },
+ {
+ "m_Id": "6c3b295f2d98598598e0245ee0a38e65"
+ }
+ ]
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.TerrainLitData",
+ "m_ObjectId": "7613bde247b745d08a129a9681acaf49",
+ "m_EnableHeightBlened": false,
+ "m_HeightTransition": 0.0,
+ "m_EnableInstancedPerPixelNormal": true,
+ "m_RayTracing": false
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.LightingData",
+ "m_ObjectId": "7830a014364540369f4e725f1eb9f5ed",
+ "m_NormalDropOffSpace": 0,
+ "m_BlendPreserveSpecular": true,
+ "m_ReceiveDecals": true,
+ "m_ReceiveSSR": true,
+ "m_ReceiveSSRTransparent": false,
+ "m_SpecularAA": false,
+ "m_SpecularOcclusionMode": 1,
+ "m_OverrideBakedGI": false
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.TerrainLitData",
+ "m_ObjectId": "7cb10bd1ba1f4efe99caca400f8d27dd",
+ "m_EnableHeightBlened": false,
+ "m_HeightTransition": 0.0,
+ "m_EnableInstancedPerPixelNormal": true,
+ "m_RayTracing": false
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.BuiltinData",
+ "m_ObjectId": "7da39c63cf9e4a41892cb6baaf70c020",
+ "m_Distortion": false,
+ "m_DistortionMode": 0,
+ "m_DistortionDepthTest": true,
+ "m_AddPrecomputedVelocity": false,
+ "m_TransparentWritesMotionVec": false,
+ "m_DepthOffset": false,
+ "m_ConservativeDepthOffset": false,
+ "m_TransparencyFog": true,
+ "m_AlphaTestShadow": false,
+ "m_BackThenFrontRendering": false,
+ "m_TransparentDepthPrepass": false,
+ "m_TransparentDepthPostpass": false,
+ "m_TransparentPerPixelSorting": false,
+ "m_SupportLodCrossFade": false
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.TerrainLitSubTarget",
+ "m_ObjectId": "8010fb853be345ddb0fffc78e49deb2a"
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.TerrainLitData",
+ "m_ObjectId": "8c065b7dad1d4985844821e5ba4b03e5",
+ "m_EnableHeightBlened": false,
+ "m_HeightTransition": 0.0,
+ "m_EnableInstancedPerPixelNormal": true,
+ "m_RayTracing": false
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.SystemData",
+ "m_ObjectId": "9267ca2c7c734d49b96521a9d02d940a",
+ "m_MaterialNeedsUpdateHash": 0,
+ "m_SurfaceType": 0,
+ "m_RenderingPass": 1,
+ "m_BlendMode": 0,
+ "m_ZTest": 4,
+ "m_ZWrite": false,
+ "m_TransparentCullMode": 2,
+ "m_OpaqueCullMode": 2,
+ "m_SortPriority": 0,
+ "m_AlphaTest": false,
+ "m_ExcludeFromTUAndAA": false,
+ "m_TransparentDepthPrepass": false,
+ "m_TransparentDepthPostpass": false,
+ "m_SupportLodCrossFade": false,
+ "m_DoubleSidedMode": 0,
+ "m_DOTSInstancing": false,
+ "m_CustomVelocity": false,
+ "m_Tessellation": false,
+ "m_TessellationMode": 0,
+ "m_TessellationFactorMinDistance": 20.0,
+ "m_TessellationFactorMaxDistance": 50.0,
+ "m_TessellationFactorTriangleSize": 100.0,
+ "m_TessellationShapeFactor": 0.75,
+ "m_TessellationBackFaceCullEpsilon": -0.25,
+ "m_TessellationMaxDisplacement": 0.009999999776482582,
+ "m_DebugSymbols": false,
+ "m_Version": 2,
+ "inspectorFoldoutMask": 9
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.LightingData",
+ "m_ObjectId": "964f8b6a72d64d848e72f72e89bfa580",
+ "m_NormalDropOffSpace": 0,
+ "m_BlendPreserveSpecular": true,
+ "m_ReceiveDecals": true,
+ "m_ReceiveSSR": true,
+ "m_ReceiveSSRTransparent": false,
+ "m_SpecularAA": false,
+ "m_SpecularOcclusionMode": 1,
+ "m_OverrideBakedGI": false
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.TerrainLitSubTarget",
+ "m_ObjectId": "a2f8234609584f19bc8d92c913fc6735"
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.TerrainLitData",
+ "m_ObjectId": "a3b2bdb1447943c284e8690a37d94da8",
+ "m_EnableHeightBlened": false,
+ "m_HeightTransition": 0.0,
+ "m_EnableInstancedPerPixelNormal": true,
+ "m_RayTracing": false
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.LightingData",
+ "m_ObjectId": "a655831097ad413d890304239acc6084",
+ "m_NormalDropOffSpace": 0,
+ "m_BlendPreserveSpecular": true,
+ "m_ReceiveDecals": true,
+ "m_ReceiveSSR": true,
+ "m_ReceiveSSRTransparent": false,
+ "m_SpecularAA": false,
+ "m_SpecularOcclusionMode": 1,
+ "m_OverrideBakedGI": false
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.SystemData",
+ "m_ObjectId": "a948a7d33e1b49b380b1bc6f82c15f35",
+ "m_MaterialNeedsUpdateHash": 0,
+ "m_SurfaceType": 0,
+ "m_RenderingPass": 1,
+ "m_BlendMode": 0,
+ "m_ZTest": 4,
+ "m_ZWrite": false,
+ "m_TransparentCullMode": 2,
+ "m_OpaqueCullMode": 2,
+ "m_SortPriority": 0,
+ "m_AlphaTest": false,
+ "m_ExcludeFromTUAndAA": false,
+ "m_TransparentDepthPrepass": false,
+ "m_TransparentDepthPostpass": false,
+ "m_SupportLodCrossFade": false,
+ "m_DoubleSidedMode": 0,
+ "m_DOTSInstancing": false,
+ "m_CustomVelocity": false,
+ "m_Tessellation": false,
+ "m_TessellationMode": 0,
+ "m_TessellationFactorMinDistance": 20.0,
+ "m_TessellationFactorMaxDistance": 50.0,
+ "m_TessellationFactorTriangleSize": 100.0,
+ "m_TessellationShapeFactor": 0.75,
+ "m_TessellationBackFaceCullEpsilon": -0.25,
+ "m_TessellationMaxDisplacement": 0.009999999776482582,
+ "m_DebugSymbols": false,
+ "m_Version": 2,
+ "inspectorFoldoutMask": 0
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.TerrainLitData",
+ "m_ObjectId": "a9e5f341d62644a9b8822d1e80bec354",
+ "m_EnableHeightBlened": false,
+ "m_HeightTransition": 0.0,
+ "m_EnableInstancedPerPixelNormal": true,
+ "m_RayTracing": false
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.SystemData",
+ "m_ObjectId": "ae3851f4471e48ce986c42c608ad6083",
+ "m_MaterialNeedsUpdateHash": 0,
+ "m_SurfaceType": 0,
+ "m_RenderingPass": 1,
+ "m_BlendMode": 0,
+ "m_ZTest": 4,
+ "m_ZWrite": false,
+ "m_TransparentCullMode": 2,
+ "m_OpaqueCullMode": 2,
+ "m_SortPriority": 0,
+ "m_AlphaTest": false,
+ "m_ExcludeFromTUAndAA": false,
+ "m_TransparentDepthPrepass": false,
+ "m_TransparentDepthPostpass": false,
+ "m_SupportLodCrossFade": false,
+ "m_DoubleSidedMode": 0,
+ "m_DOTSInstancing": false,
+ "m_CustomVelocity": false,
+ "m_Tessellation": false,
+ "m_TessellationMode": 0,
+ "m_TessellationFactorMinDistance": 20.0,
+ "m_TessellationFactorMaxDistance": 50.0,
+ "m_TessellationFactorTriangleSize": 100.0,
+ "m_TessellationShapeFactor": 0.75,
+ "m_TessellationBackFaceCullEpsilon": -0.25,
+ "m_TessellationMaxDisplacement": 0.009999999776482582,
+ "m_DebugSymbols": false,
+ "m_Version": 2,
+ "inspectorFoldoutMask": 0
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.SystemData",
+ "m_ObjectId": "af9c871ef30c4751adee4315ea348701",
+ "m_MaterialNeedsUpdateHash": 0,
+ "m_SurfaceType": 0,
+ "m_RenderingPass": 1,
+ "m_BlendMode": 0,
+ "m_ZTest": 4,
+ "m_ZWrite": false,
+ "m_TransparentCullMode": 2,
+ "m_OpaqueCullMode": 2,
+ "m_SortPriority": 0,
+ "m_AlphaTest": false,
+ "m_ExcludeFromTUAndAA": false,
+ "m_TransparentDepthPrepass": false,
+ "m_TransparentDepthPostpass": false,
+ "m_SupportLodCrossFade": false,
+ "m_DoubleSidedMode": 0,
+ "m_DOTSInstancing": false,
+ "m_CustomVelocity": false,
+ "m_Tessellation": false,
+ "m_TessellationMode": 0,
+ "m_TessellationFactorMinDistance": 20.0,
+ "m_TessellationFactorMaxDistance": 50.0,
+ "m_TessellationFactorTriangleSize": 100.0,
+ "m_TessellationShapeFactor": 0.75,
+ "m_TessellationBackFaceCullEpsilon": -0.25,
+ "m_TessellationMaxDisplacement": 0.009999999776482582,
+ "m_DebugSymbols": false,
+ "m_Version": 2,
+ "inspectorFoldoutMask": 0
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.TerrainLitData",
+ "m_ObjectId": "b2e9508056f641ab858939665713138e",
+ "m_EnableHeightBlened": false,
+ "m_HeightTransition": 0.0,
+ "m_EnableInstancedPerPixelNormal": true,
+ "m_RayTracing": false
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.TerrainLitData",
+ "m_ObjectId": "b7170e0507ab4c6eaaba42164634a575",
+ "m_EnableHeightBlened": false,
+ "m_HeightTransition": 0.0,
+ "m_EnableInstancedPerPixelNormal": true,
+ "m_RayTracing": false
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.TerrainLitSubTarget",
+ "m_ObjectId": "b758094cb6d340d8bca9fdc1a52e3295"
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.BuiltinData",
+ "m_ObjectId": "c3a3b4429181426dbba913e05f25e287",
+ "m_Distortion": false,
+ "m_DistortionMode": 0,
+ "m_DistortionDepthTest": true,
+ "m_AddPrecomputedVelocity": false,
+ "m_TransparentWritesMotionVec": false,
+ "m_DepthOffset": false,
+ "m_ConservativeDepthOffset": false,
+ "m_TransparencyFog": true,
+ "m_AlphaTestShadow": false,
+ "m_BackThenFrontRendering": false,
+ "m_TransparentDepthPrepass": false,
+ "m_TransparentDepthPostpass": false,
+ "m_TransparentPerPixelSorting": false,
+ "m_SupportLodCrossFade": false
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.BuiltinData",
+ "m_ObjectId": "c3ea601afbcf44179bc869232b6f8b9b",
+ "m_Distortion": false,
+ "m_DistortionMode": 0,
+ "m_DistortionDepthTest": true,
+ "m_AddPrecomputedVelocity": false,
+ "m_TransparentWritesMotionVec": false,
+ "m_DepthOffset": false,
+ "m_ConservativeDepthOffset": false,
+ "m_TransparencyFog": true,
+ "m_AlphaTestShadow": false,
+ "m_BackThenFrontRendering": false,
+ "m_TransparentDepthPrepass": false,
+ "m_TransparentDepthPostpass": false,
+ "m_TransparentPerPixelSorting": false,
+ "m_SupportLodCrossFade": false
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.TerrainLitSubTarget",
+ "m_ObjectId": "ccee7f5c3e1e44e99f64aa526d66d35b"
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.LightingData",
+ "m_ObjectId": "d2e44104eebc4432aab804025bbcc4e3",
+ "m_NormalDropOffSpace": 0,
+ "m_BlendPreserveSpecular": true,
+ "m_ReceiveDecals": true,
+ "m_ReceiveSSR": true,
+ "m_ReceiveSSRTransparent": false,
+ "m_SpecularAA": false,
+ "m_SpecularOcclusionMode": 1,
+ "m_OverrideBakedGI": false
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.LightingData",
+ "m_ObjectId": "e47f712290094d04a76c4371977e08c7",
+ "m_NormalDropOffSpace": 0,
+ "m_BlendPreserveSpecular": true,
+ "m_ReceiveDecals": true,
+ "m_ReceiveSSR": true,
+ "m_ReceiveSSRTransparent": false,
+ "m_SpecularAA": false,
+ "m_SpecularOcclusionMode": 1,
+ "m_OverrideBakedGI": false
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.TerrainLitSubTarget",
+ "m_ObjectId": "ebea0ef64d95450f8b04fc9256d022a1"
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.LightingData",
+ "m_ObjectId": "ecd9dbaa6d2a4675ae1300b3416a1043",
+ "m_NormalDropOffSpace": 0,
+ "m_BlendPreserveSpecular": true,
+ "m_ReceiveDecals": true,
+ "m_ReceiveSSR": true,
+ "m_ReceiveSSRTransparent": false,
+ "m_SpecularAA": false,
+ "m_SpecularOcclusionMode": 1,
+ "m_OverrideBakedGI": false
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.SystemData",
+ "m_ObjectId": "eee3afb7f90c4726a7849dd710fe7dfa",
+ "m_MaterialNeedsUpdateHash": 0,
+ "m_SurfaceType": 0,
+ "m_RenderingPass": 1,
+ "m_BlendMode": 0,
+ "m_ZTest": 4,
+ "m_ZWrite": false,
+ "m_TransparentCullMode": 2,
+ "m_OpaqueCullMode": 2,
+ "m_SortPriority": 0,
+ "m_AlphaTest": false,
+ "m_ExcludeFromTUAndAA": false,
+ "m_TransparentDepthPrepass": false,
+ "m_TransparentDepthPostpass": false,
+ "m_SupportLodCrossFade": false,
+ "m_DoubleSidedMode": 0,
+ "m_DOTSInstancing": false,
+ "m_CustomVelocity": false,
+ "m_Tessellation": false,
+ "m_TessellationMode": 0,
+ "m_TessellationFactorMinDistance": 20.0,
+ "m_TessellationFactorMaxDistance": 50.0,
+ "m_TessellationFactorTriangleSize": 100.0,
+ "m_TessellationShapeFactor": 0.75,
+ "m_TessellationBackFaceCullEpsilon": -0.25,
+ "m_TessellationMaxDisplacement": 0.009999999776482582,
+ "m_DebugSymbols": false,
+ "m_Version": 2,
+ "inspectorFoldoutMask": 0
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.SystemData",
+ "m_ObjectId": "f432006b28c44b6ead72243ae2e8e41f",
+ "m_MaterialNeedsUpdateHash": 0,
+ "m_SurfaceType": 0,
+ "m_RenderingPass": 1,
+ "m_BlendMode": 0,
+ "m_ZTest": 4,
+ "m_ZWrite": false,
+ "m_TransparentCullMode": 2,
+ "m_OpaqueCullMode": 2,
+ "m_SortPriority": 0,
+ "m_AlphaTest": false,
+ "m_ExcludeFromTUAndAA": false,
+ "m_TransparentDepthPrepass": false,
+ "m_TransparentDepthPostpass": false,
+ "m_SupportLodCrossFade": false,
+ "m_DoubleSidedMode": 0,
+ "m_DOTSInstancing": false,
+ "m_CustomVelocity": false,
+ "m_Tessellation": false,
+ "m_TessellationMode": 0,
+ "m_TessellationFactorMinDistance": 20.0,
+ "m_TessellationFactorMaxDistance": 50.0,
+ "m_TessellationFactorTriangleSize": 100.0,
+ "m_TessellationShapeFactor": 0.75,
+ "m_TessellationBackFaceCullEpsilon": -0.25,
+ "m_TessellationMaxDisplacement": 0.009999999776482582,
+ "m_DebugSymbols": false,
+ "m_Version": 2,
+ "inspectorFoldoutMask": 0
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.TerrainLitSubTarget",
+ "m_ObjectId": "f78263900b9a449fb0048b6e6eaae6da"
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.BuiltinData",
+ "m_ObjectId": "f85b8bfcea3c439481ba7aab5cff3d00",
+ "m_Distortion": false,
+ "m_DistortionMode": 0,
+ "m_DistortionDepthTest": true,
+ "m_AddPrecomputedVelocity": false,
+ "m_TransparentWritesMotionVec": false,
+ "m_DepthOffset": false,
+ "m_ConservativeDepthOffset": false,
+ "m_TransparencyFog": true,
+ "m_AlphaTestShadow": false,
+ "m_BackThenFrontRendering": false,
+ "m_TransparentDepthPrepass": false,
+ "m_TransparentDepthPostpass": false,
+ "m_TransparentPerPixelSorting": false,
+ "m_SupportLodCrossFade": false
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.TerrainLitData",
+ "m_ObjectId": "f8c5588f5c2b4aa3b5b7c2464952737f",
+ "m_EnableHeightBlened": false,
+ "m_HeightTransition": 0.0,
+ "m_EnableInstancedPerPixelNormal": true,
+ "m_RayTracing": false
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.HDTarget",
+ "m_ObjectId": "fae0956ffbe844049ecc902ae2d3a790",
+ "m_ActiveSubTarget": {
+ "m_Id": "b758094cb6d340d8bca9fdc1a52e3295"
+ },
+ "m_Datas": [
+ {
+ "m_Id": "04b39b25d8cf4a209bfaacef8f49806c"
+ },
+ {
+ "m_Id": "c3a3b4429181426dbba913e05f25e287"
+ },
+ {
+ "m_Id": "9267ca2c7c734d49b96521a9d02d940a"
+ },
+ {
+ "m_Id": "153f998865404f90b7545c132060f0cb"
+ }
+ ],
+ "m_CustomEditorGUI": "",
+ "m_SupportVFX": false,
+ "m_SupportLineRendering": false
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.Rendering.HighDefinition.ShaderGraph.TerrainLitSubTarget",
+ "m_ObjectId": "fc0756cde95049dd8b0c7608337c3c9f"
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.ShaderGraph.BlockNode",
+ "m_ObjectId": "95f386bd83ab4ea991e4bae0f72b3401",
+ "m_Group": {
+ "m_Id": ""
+ },
+ "m_Name": "VertexDescription.Position",
+ "m_DrawState": {
+ "m_Expanded": true,
+ "m_Position": {
+ "serializedVersion": "2",
+ "x": 0.0,
+ "y": 0.0,
+ "width": 0.0,
+ "height": 0.0
+ }
+ },
+ "m_Slots": [
+ {
+ "m_Id": "80a8066e55684b3893a3068c66bdbd6b"
+ }
+ ],
+ "synonyms": [],
+ "m_Precision": 0,
+ "m_PreviewExpanded": true,
+ "m_DismissedVersion": 0,
+ "m_PreviewMode": 0,
+ "m_CustomColors": {
+ "m_SerializableColors": []
+ },
+ "m_SerializedDescriptor": "VertexDescription.Position"
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.ShaderGraph.PositionMaterialSlot",
+ "m_ObjectId": "80a8066e55684b3893a3068c66bdbd6b",
+ "m_Id": 0,
+ "m_DisplayName": "Position",
+ "m_SlotType": 0,
+ "m_Hidden": false,
+ "m_ShaderOutputName": "Position",
+ "m_StageCapability": 1,
+ "m_Value": {
+ "x": 0.0,
+ "y": 0.0,
+ "z": 0.0
+ },
+ "m_DefaultValue": {
+ "x": 0.0,
+ "y": 0.0,
+ "z": 0.0
+ },
+ "m_Labels": [],
+ "m_Space": 0
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.ShaderGraph.BlockNode",
+ "m_ObjectId": "3e11b3447e3b4b959b3242f811d2f317",
+ "m_Group": {
+ "m_Id": ""
+ },
+ "m_Name": "SurfaceDescription.BaseColor",
+ "m_DrawState": {
+ "m_Expanded": true,
+ "m_Position": {
+ "serializedVersion": "2",
+ "x": 0.0,
+ "y": 0.0,
+ "width": 0.0,
+ "height": 0.0
+ }
+ },
+ "m_Slots": [
+ {
+ "m_Id": "1b3a8a58f3814f1ebf5285ef55a602c6"
+ }
+ ],
+ "synonyms": [],
+ "m_Precision": 0,
+ "m_PreviewExpanded": true,
+ "m_DismissedVersion": 0,
+ "m_PreviewMode": 0,
+ "m_CustomColors": {
+ "m_SerializableColors": []
+ },
+ "m_SerializedDescriptor": "SurfaceDescription.BaseColor"
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.ShaderGraph.ColorRGBMaterialSlot",
+ "m_ObjectId": "1b3a8a58f3814f1ebf5285ef55a602c6",
+ "m_Id": 0,
+ "m_DisplayName": "Base Color",
+ "m_SlotType": 0,
+ "m_Hidden": false,
+ "m_ShaderOutputName": "BaseColor",
+ "m_StageCapability": 2,
+ "m_Value": {
+ "x": 0.5,
+ "y": 0.5,
+ "z": 0.5
+ },
+ "m_DefaultValue": {
+ "x": 0.0,
+ "y": 0.0,
+ "z": 0.0
+ },
+ "m_Labels": [],
+ "m_ColorMode": 0,
+ "m_DefaultColor": {
+ "r": 0.5,
+ "g": 0.5,
+ "b": 0.5,
+ "a": 1.0
+ }
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.ShaderGraph.BlockNode",
+ "m_ObjectId": "3f64231908584ca8aeb831d5c0683197",
+ "m_Group": {
+ "m_Id": ""
+ },
+ "m_Name": "SurfaceDescription.Smoothness",
+ "m_DrawState": {
+ "m_Expanded": true,
+ "m_Position": {
+ "serializedVersion": "2",
+ "x": 0.0,
+ "y": 0.0,
+ "width": 0.0,
+ "height": 0.0
+ }
+ },
+ "m_Slots": [
+ {
+ "m_Id": "47d79753d68f4a3691be5a79c763169a"
+ }
+ ],
+ "synonyms": [],
+ "m_Precision": 0,
+ "m_PreviewExpanded": true,
+ "m_DismissedVersion": 0,
+ "m_PreviewMode": 0,
+ "m_CustomColors": {
+ "m_SerializableColors": []
+ },
+ "m_SerializedDescriptor": "SurfaceDescription.Smoothness"
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
+ "m_ObjectId": "47d79753d68f4a3691be5a79c763169a",
+ "m_Id": 0,
+ "m_DisplayName": "Smoothness",
+ "m_SlotType": 0,
+ "m_Hidden": false,
+ "m_ShaderOutputName": "Smoothness",
+ "m_StageCapability": 2,
+ "m_Value": 0.0,
+ "m_DefaultValue": 0.5,
+ "m_Labels": [],
+ "m_LiteralMode": false
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.ShaderGraph.BlockNode",
+ "m_ObjectId": "04032cb76dc74acc9b49ba73e2321dbf",
+ "m_Group": {
+ "m_Id": ""
+ },
+ "m_Name": "SurfaceDescription.Occlusion",
+ "m_DrawState": {
+ "m_Expanded": true,
+ "m_Position": {
+ "serializedVersion": "2",
+ "x": 0.0,
+ "y": 0.0,
+ "width": 0.0,
+ "height": 0.0
+ }
+ },
+ "m_Slots": [
+ {
+ "m_Id": "bbafac2c6bc14f599370c4e54c139ee6"
+ }
+ ],
+ "synonyms": [],
+ "m_Precision": 0,
+ "m_PreviewExpanded": true,
+ "m_DismissedVersion": 0,
+ "m_PreviewMode": 0,
+ "m_CustomColors": {
+ "m_SerializableColors": []
+ },
+ "m_SerializedDescriptor": "SurfaceDescription.Occlusion"
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
+ "m_ObjectId": "bbafac2c6bc14f599370c4e54c139ee6",
+ "m_Id": 0,
+ "m_DisplayName": "Ambient Occlusion",
+ "m_SlotType": 0,
+ "m_Hidden": false,
+ "m_ShaderOutputName": "Occlusion",
+ "m_StageCapability": 2,
+ "m_Value": 1.0,
+ "m_DefaultValue": 1.0,
+ "m_Labels": [],
+ "m_LiteralMode": false
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.ShaderGraph.BlockNode",
+ "m_ObjectId": "4862224b0573442291394dafefab7c54",
+ "m_Group": {
+ "m_Id": ""
+ },
+ "m_Name": "SurfaceDescription.Metallic",
+ "m_DrawState": {
+ "m_Expanded": true,
+ "m_Position": {
+ "serializedVersion": "2",
+ "x": 0.0,
+ "y": 0.0,
+ "width": 0.0,
+ "height": 0.0
+ }
+ },
+ "m_Slots": [
+ {
+ "m_Id": "1c1e75f6116e450d96a1637c3fd91162"
+ }
+ ],
+ "synonyms": [],
+ "m_Precision": 0,
+ "m_PreviewExpanded": true,
+ "m_DismissedVersion": 0,
+ "m_PreviewMode": 0,
+ "m_CustomColors": {
+ "m_SerializableColors": []
+ },
+ "m_SerializedDescriptor": "SurfaceDescription.Metallic"
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
+ "m_ObjectId": "1c1e75f6116e450d96a1637c3fd91162",
+ "m_Id": 0,
+ "m_DisplayName": "Metallic",
+ "m_SlotType": 0,
+ "m_Hidden": false,
+ "m_ShaderOutputName": "Metallic",
+ "m_StageCapability": 2,
+ "m_Value": 0.0,
+ "m_DefaultValue": 0.0,
+ "m_Labels": [],
+ "m_LiteralMode": false
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.ShaderGraph.BlockNode",
+ "m_ObjectId": "097e106dbe064cf49f1d0052befedaea",
+ "m_Group": {
+ "m_Id": ""
+ },
+ "m_Name": "SurfaceDescription.Emission",
+ "m_DrawState": {
+ "m_Expanded": true,
+ "m_Position": {
+ "serializedVersion": "2",
+ "x": 0.0,
+ "y": 0.0,
+ "width": 0.0,
+ "height": 0.0
+ }
+ },
+ "m_Slots": [
+ {
+ "m_Id": "ba957b56d3c04322bc646fe6cf798a8f"
+ }
+ ],
+ "synonyms": [],
+ "m_Precision": 0,
+ "m_PreviewExpanded": true,
+ "m_DismissedVersion": 0,
+ "m_PreviewMode": 0,
+ "m_CustomColors": {
+ "m_SerializableColors": []
+ },
+ "m_SerializedDescriptor": "SurfaceDescription.Emission"
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.ShaderGraph.ColorRGBMaterialSlot",
+ "m_ObjectId": "ba957b56d3c04322bc646fe6cf798a8f",
+ "m_Id": 0,
+ "m_DisplayName": "Emission",
+ "m_SlotType": 0,
+ "m_Hidden": false,
+ "m_ShaderOutputName": "Emission",
+ "m_StageCapability": 2,
+ "m_Value": {
+ "x": 0.0,
+ "y": 0.0,
+ "z": 0.0
+ },
+ "m_DefaultValue": {
+ "x": 0.0,
+ "y": 0.0,
+ "z": 0.0
+ },
+ "m_Labels": [],
+ "m_ColorMode": 1,
+ "m_DefaultColor": {
+ "r": 0.0,
+ "g": 0.0,
+ "b": 0.0,
+ "a": 1.0
+ }
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.ShaderGraph.BlockNode",
+ "m_ObjectId": "a1f5c0089d7e4280a8118c875f837457",
+ "m_Group": {
+ "m_Id": ""
+ },
+ "m_Name": "SurfaceDescription.NormalWS",
+ "m_DrawState": {
+ "m_Expanded": true,
+ "m_Position": {
+ "serializedVersion": "2",
+ "x": 0.0,
+ "y": 0.0,
+ "width": 0.0,
+ "height": 0.0
+ }
+ },
+ "m_Slots": [
+ {
+ "m_Id": "bed5d3e0f1964cc9b95fbdd6ec8ee871"
+ }
+ ],
+ "synonyms": [],
+ "m_Precision": 0,
+ "m_PreviewExpanded": true,
+ "m_DismissedVersion": 0,
+ "m_PreviewMode": 0,
+ "m_CustomColors": {
+ "m_SerializableColors": []
+ },
+ "m_SerializedDescriptor": "SurfaceDescription.NormalWS"
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.ShaderGraph.NormalMaterialSlot",
+ "m_ObjectId": "bed5d3e0f1964cc9b95fbdd6ec8ee871",
+ "m_Id": 0,
+ "m_DisplayName": "Normal (World Space)",
+ "m_SlotType": 0,
+ "m_Hidden": false,
+ "m_ShaderOutputName": "NormalWS",
+ "m_StageCapability": 2,
+ "m_Value": {
+ "x": 0.0,
+ "y": 0.0,
+ "z": 0.0
+ },
+ "m_DefaultValue": {
+ "x": 0.0,
+ "y": 0.0,
+ "z": 0.0
+ },
+ "m_Labels": [],
+ "m_Space": 2
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.ShaderGraph.UVNode",
+ "m_ObjectId": "71407d15f06753b89c0b98e3450ff436",
+ "m_Group": {
+ "m_Id": ""
+ },
+ "m_Name": "UV",
+ "m_DrawState": {
+ "m_Expanded": true,
+ "m_Position": {
+ "serializedVersion": "2",
+ "x": -900,
+ "y": 0,
+ "width": 220.0,
+ "height": 130.0
+ }
+ },
+ "m_Slots": [
+ {
+ "m_Id": "78d60df48e9956f1a482fa25f18feef4"
+ }
+ ],
+ "synonyms": [],
+ "m_Precision": 0,
+ "m_PreviewExpanded": false,
+ "m_DismissedVersion": 0,
+ "m_PreviewMode": 0,
+ "m_CustomColors": {
+ "m_SerializableColors": []
+ },
+ "m_OutputChannel": 0
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot",
+ "m_ObjectId": "78d60df48e9956f1a482fa25f18feef4",
+ "m_Id": 0,
+ "m_DisplayName": "Out",
+ "m_SlotType": 1,
+ "m_Hidden": false,
+ "m_ShaderOutputName": "Out",
+ "m_StageCapability": 3,
+ "m_Value": {
+ "x": 0.0,
+ "y": 0.0,
+ "z": 0.0,
+ "w": 0.0
+ },
+ "m_DefaultValue": {
+ "x": 0.0,
+ "y": 0.0,
+ "z": 0.0,
+ "w": 0.0
+ },
+ "m_Labels": []
+}
+
+{
+ "m_SGVersion": 1,
+ "m_Type": "UnityEditor.ShaderGraph.PositionNode",
+ "m_ObjectId": "763a77e708035709ac25714684151d99",
+ "m_Group": {
+ "m_Id": ""
+ },
+ "m_Name": "Position",
+ "m_DrawState": {
+ "m_Expanded": true,
+ "m_Position": {
+ "serializedVersion": "2",
+ "x": -900,
+ "y": 150,
+ "width": 220.0,
+ "height": 130.0
+ }
+ },
+ "m_Slots": [
+ {
+ "m_Id": "8740a0decec05906a143198d46192237"
+ }
+ ],
+ "synonyms": [],
+ "m_Precision": 1,
+ "m_PreviewExpanded": false,
+ "m_DismissedVersion": 0,
+ "m_PreviewMode": 0,
+ "m_CustomColors": {
+ "m_SerializableColors": []
+ },
+ "m_Space": 4,
+ "m_PositionSource": 0
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
+ "m_ObjectId": "8740a0decec05906a143198d46192237",
+ "m_Id": 0,
+ "m_DisplayName": "Out",
+ "m_SlotType": 1,
+ "m_Hidden": false,
+ "m_ShaderOutputName": "Out",
+ "m_StageCapability": 3,
+ "m_Value": {
+ "x": 0.0,
+ "y": 0.0,
+ "z": 0.0
+ },
+ "m_DefaultValue": {
+ "x": 0.0,
+ "y": 0.0,
+ "z": 0.0
+ },
+ "m_Labels": []
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.ShaderGraph.NormalVectorNode",
+ "m_ObjectId": "f4f0c1872db55a8aa50643addb74b9e8",
+ "m_Group": {
+ "m_Id": ""
+ },
+ "m_Name": "Normal Vector",
+ "m_DrawState": {
+ "m_Expanded": true,
+ "m_Position": {
+ "serializedVersion": "2",
+ "x": -900,
+ "y": 300,
+ "width": 220.0,
+ "height": 130.0
+ }
+ },
+ "m_Slots": [
+ {
+ "m_Id": "33da6c9859305f058cebe7e0a885269b"
+ }
+ ],
+ "synonyms": [],
+ "m_Precision": 1,
+ "m_PreviewExpanded": false,
+ "m_DismissedVersion": 0,
+ "m_PreviewMode": 0,
+ "m_CustomColors": {
+ "m_SerializableColors": []
+ },
+ "m_Space": 2
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
+ "m_ObjectId": "33da6c9859305f058cebe7e0a885269b",
+ "m_Id": 0,
+ "m_DisplayName": "Out",
+ "m_SlotType": 1,
+ "m_Hidden": false,
+ "m_ShaderOutputName": "Out",
+ "m_StageCapability": 3,
+ "m_Value": {
+ "x": 0.0,
+ "y": 0.0,
+ "z": 0.0
+ },
+ "m_DefaultValue": {
+ "x": 0.0,
+ "y": 0.0,
+ "z": 0.0
+ },
+ "m_Labels": []
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.ShaderGraph.Internal.Texture2DShaderProperty",
+ "m_ObjectId": "f4227b0694b35d8c89b0cc59542ea231",
+ "m_Guid": {
+ "m_GuidSerialized": "0a88da1c-6721-5771-99d8-16254fc9f0d4"
+ },
+ "m_Name": "ScBakeTex",
+ "m_DefaultRefNameVersion": 1,
+ "m_RefNameGeneratedByDisplayName": "ScBakeTex",
+ "m_DefaultReferenceName": "_ScBakeTex",
+ "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": "9bed353632ae55ba96bcd2c3c3ee2275",
+ "m_Group": {
+ "m_Id": ""
+ },
+ "m_Name": "ScBakeTex",
+ "m_DrawState": {
+ "m_Expanded": true,
+ "m_Position": {
+ "serializedVersion": "2",
+ "x": -900,
+ "y": 450,
+ "width": 220.0,
+ "height": 130.0
+ }
+ },
+ "m_Slots": [
+ {
+ "m_Id": "99b1ce64ec7352b980aea65becd6931d"
+ }
+ ],
+ "synonyms": [],
+ "m_Precision": 0,
+ "m_PreviewExpanded": false,
+ "m_DismissedVersion": 0,
+ "m_PreviewMode": 0,
+ "m_CustomColors": {
+ "m_SerializableColors": []
+ },
+ "m_Property": {
+ "m_Id": "f4227b0694b35d8c89b0cc59542ea231"
+ }
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.ShaderGraph.Texture2DMaterialSlot",
+ "m_ObjectId": "99b1ce64ec7352b980aea65becd6931d",
+ "m_Id": 0,
+ "m_DisplayName": "Out",
+ "m_SlotType": 1,
+ "m_Hidden": false,
+ "m_ShaderOutputName": "Out",
+ "m_StageCapability": 3,
+ "m_BareResource": false
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.ShaderGraph.Internal.Texture2DShaderProperty",
+ "m_ObjectId": "6c3b295f2d98598598e0245ee0a38e65",
+ "m_Guid": {
+ "m_GuidSerialized": "58fbd967-0b3a-5b15-84f7-66127f2bc12a"
+ },
+ "m_Name": "ScCoastTex",
+ "m_DefaultRefNameVersion": 1,
+ "m_RefNameGeneratedByDisplayName": "ScCoastTex",
+ "m_DefaultReferenceName": "_ScCoastTex",
+ "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": "a3e15ab001b759f6b126319858f4b91e",
+ "m_Group": {
+ "m_Id": ""
+ },
+ "m_Name": "ScCoastTex",
+ "m_DrawState": {
+ "m_Expanded": true,
+ "m_Position": {
+ "serializedVersion": "2",
+ "x": -900,
+ "y": 570,
+ "width": 220.0,
+ "height": 130.0
+ }
+ },
+ "m_Slots": [
+ {
+ "m_Id": "14dd5ab33e2d5afca079335ca1377814"
+ }
+ ],
+ "synonyms": [],
+ "m_Precision": 0,
+ "m_PreviewExpanded": false,
+ "m_DismissedVersion": 0,
+ "m_PreviewMode": 0,
+ "m_CustomColors": {
+ "m_SerializableColors": []
+ },
+ "m_Property": {
+ "m_Id": "6c3b295f2d98598598e0245ee0a38e65"
+ }
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.ShaderGraph.Texture2DMaterialSlot",
+ "m_ObjectId": "14dd5ab33e2d5afca079335ca1377814",
+ "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",
+ "m_ObjectId": "0c721d24051f5765970882f281b1f92f",
+ "m_Group": {
+ "m_Id": ""
+ },
+ "m_Name": "StatecraftTerrain (Custom Function)",
+ "m_DrawState": {
+ "m_Expanded": true,
+ "m_Position": {
+ "serializedVersion": "2",
+ "x": -450,
+ "y": 100,
+ "width": 220.0,
+ "height": 130.0
+ }
+ },
+ "m_Slots": [
+ {
+ "m_Id": "81e536502f61538d9d4a405ed9182f04"
+ },
+ {
+ "m_Id": "ca43aef98e875606a6a881aa72ed2752"
+ },
+ {
+ "m_Id": "0a54b5d7978c5cef980c1ddfabf1194e"
+ },
+ {
+ "m_Id": "a924b25f4b7651518fbf0efab2048eaf"
+ },
+ {
+ "m_Id": "5b4fa9b9a0685b439e8cd8b2451d1d7c"
+ },
+ {
+ "m_Id": "8990932a9fe95bfabd3d5e645cf3bc58"
+ },
+ {
+ "m_Id": "87a7dd817fad59ecb1f11eb968ed2567"
+ },
+ {
+ "m_Id": "11344551a71f5c03a8b7bbd1c15b0c1a"
+ },
+ {
+ "m_Id": "cb63b71e6a3f5e86be2b475b2f4c76d8"
+ },
+ {
+ "m_Id": "2760420ab9605db9a7b6dbeeb57b12b1"
+ },
+ {
+ "m_Id": "e25c4c763f6f5b329ac0aeaf3c6da58f"
+ }
+ ],
+ "synonyms": [],
+ "m_Precision": 1,
+ "m_PreviewExpanded": false,
+ "m_DismissedVersion": 0,
+ "m_PreviewMode": 0,
+ "m_CustomColors": {
+ "m_SerializableColors": []
+ },
+ "m_SourceType": 0,
+ "m_FunctionName": "StatecraftTerrain",
+ "m_FunctionSource": "2ffabe5c4710a4e518d5f81ca5c4fa46",
+ "m_FunctionSourceUsePragmas": true,
+ "m_FunctionBody": ""
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.ShaderGraph.Vector2MaterialSlot",
+ "m_ObjectId": "81e536502f61538d9d4a405ed9182f04",
+ "m_Id": 0,
+ "m_DisplayName": "UV",
+ "m_SlotType": 0,
+ "m_Hidden": false,
+ "m_ShaderOutputName": "UV",
+ "m_StageCapability": 3,
+ "m_Value": {
+ "x": 0.0,
+ "y": 0.0
+ },
+ "m_DefaultValue": {
+ "x": 0.0,
+ "y": 0.0
+ },
+ "m_Labels": []
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
+ "m_ObjectId": "ca43aef98e875606a6a881aa72ed2752",
+ "m_Id": 1,
+ "m_DisplayName": "PositionWS",
+ "m_SlotType": 0,
+ "m_Hidden": false,
+ "m_ShaderOutputName": "PositionWS",
+ "m_StageCapability": 3,
+ "m_Value": {
+ "x": 0.0,
+ "y": 0.0,
+ "z": 0.0
+ },
+ "m_DefaultValue": {
+ "x": 0.0,
+ "y": 0.0,
+ "z": 0.0
+ },
+ "m_Labels": []
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
+ "m_ObjectId": "0a54b5d7978c5cef980c1ddfabf1194e",
+ "m_Id": 2,
+ "m_DisplayName": "NormalWS",
+ "m_SlotType": 0,
+ "m_Hidden": false,
+ "m_ShaderOutputName": "NormalWS",
+ "m_StageCapability": 3,
+ "m_Value": {
+ "x": 0.0,
+ "y": 0.0,
+ "z": 0.0
+ },
+ "m_DefaultValue": {
+ "x": 0.0,
+ "y": 0.0,
+ "z": 0.0
+ },
+ "m_Labels": []
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.ShaderGraph.Texture2DInputMaterialSlot",
+ "m_ObjectId": "a924b25f4b7651518fbf0efab2048eaf",
+ "m_Id": 3,
+ "m_DisplayName": "Bake",
+ "m_SlotType": 0,
+ "m_Hidden": false,
+ "m_ShaderOutputName": "Bake",
+ "m_StageCapability": 3,
+ "m_BareResource": false,
+ "m_Texture": {
+ "m_SerializedTexture": "",
+ "m_Guid": ""
+ },
+ "m_DefaultType": 0
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.ShaderGraph.Texture2DInputMaterialSlot",
+ "m_ObjectId": "5b4fa9b9a0685b439e8cd8b2451d1d7c",
+ "m_Id": 4,
+ "m_DisplayName": "Coast",
+ "m_SlotType": 0,
+ "m_Hidden": false,
+ "m_ShaderOutputName": "Coast",
+ "m_StageCapability": 3,
+ "m_BareResource": false,
+ "m_Texture": {
+ "m_SerializedTexture": "",
+ "m_Guid": ""
+ },
+ "m_DefaultType": 0
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
+ "m_ObjectId": "8990932a9fe95bfabd3d5e645cf3bc58",
+ "m_Id": 5,
+ "m_DisplayName": "BaseColor",
+ "m_SlotType": 1,
+ "m_Hidden": false,
+ "m_ShaderOutputName": "BaseColor",
+ "m_StageCapability": 3,
+ "m_Value": {
+ "x": 0.0,
+ "y": 0.0,
+ "z": 0.0
+ },
+ "m_DefaultValue": {
+ "x": 0.0,
+ "y": 0.0,
+ "z": 0.0
+ },
+ "m_Labels": []
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
+ "m_ObjectId": "87a7dd817fad59ecb1f11eb968ed2567",
+ "m_Id": 6,
+ "m_DisplayName": "NormalOut",
+ "m_SlotType": 1,
+ "m_Hidden": false,
+ "m_ShaderOutputName": "NormalOut",
+ "m_StageCapability": 3,
+ "m_Value": {
+ "x": 0.0,
+ "y": 0.0,
+ "z": 0.0
+ },
+ "m_DefaultValue": {
+ "x": 0.0,
+ "y": 0.0,
+ "z": 0.0
+ },
+ "m_Labels": []
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
+ "m_ObjectId": "11344551a71f5c03a8b7bbd1c15b0c1a",
+ "m_Id": 7,
+ "m_DisplayName": "Occlusion",
+ "m_SlotType": 1,
+ "m_Hidden": false,
+ "m_ShaderOutputName": "Occlusion",
+ "m_StageCapability": 2,
+ "m_Value": 0.0,
+ "m_DefaultValue": 0.0,
+ "m_Labels": [],
+ "m_LiteralMode": false
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
+ "m_ObjectId": "cb63b71e6a3f5e86be2b475b2f4c76d8",
+ "m_Id": 8,
+ "m_DisplayName": "Smoothness",
+ "m_SlotType": 1,
+ "m_Hidden": false,
+ "m_ShaderOutputName": "Smoothness",
+ "m_StageCapability": 2,
+ "m_Value": 0.0,
+ "m_DefaultValue": 0.0,
+ "m_Labels": [],
+ "m_LiteralMode": false
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
+ "m_ObjectId": "2760420ab9605db9a7b6dbeeb57b12b1",
+ "m_Id": 9,
+ "m_DisplayName": "Metallic",
+ "m_SlotType": 1,
+ "m_Hidden": false,
+ "m_ShaderOutputName": "Metallic",
+ "m_StageCapability": 2,
+ "m_Value": 0.0,
+ "m_DefaultValue": 0.0,
+ "m_Labels": [],
+ "m_LiteralMode": false
+}
+
+{
+ "m_SGVersion": 0,
+ "m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
+ "m_ObjectId": "e25c4c763f6f5b329ac0aeaf3c6da58f",
+ "m_Id": 10,
+ "m_DisplayName": "Emission",
+ "m_SlotType": 1,
+ "m_Hidden": false,
+ "m_ShaderOutputName": "Emission",
+ "m_StageCapability": 3,
+ "m_Value": {
+ "x": 0.0,
+ "y": 0.0,
+ "z": 0.0
+ },
+ "m_DefaultValue": {
+ "x": 0.0,
+ "y": 0.0,
+ "z": 0.0
+ },
+ "m_Labels": []
+}
diff --git a/unity/Assets/Shaders/StatecraftTerrain.shadergraph.meta b/unity/Assets/Shaders/StatecraftTerrain.shadergraph.meta
new file mode 100644
index 000000000..484ebcc44
--- /dev/null
+++ b/unity/Assets/Shaders/StatecraftTerrain.shadergraph.meta
@@ -0,0 +1,18 @@
+fileFormatVersion: 2
+guid: fec8cf14a4bb541acbf4f191315aec66
+ScriptedImporter:
+ internalIDToNameTable: []
+ externalObjects: {}
+ serializedVersion: 2
+ userData:
+ assetBundleName:
+ assetBundleVariant:
+ script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}
+ useAsTemplate: 0
+ exposeTemplateAsShader: 0
+ template:
+ name:
+ category:
+ description:
+ icon: {instanceID: 0}
+ thumbnail: {instanceID: 0}
diff --git a/unity/Assets/Tests/EditMode/MapTests.cs b/unity/Assets/Tests/EditMode/MapTests.cs
index 21365d04f..825bc7d1c 100644
--- a/unity/Assets/Tests/EditMode/MapTests.cs
+++ b/unity/Assets/Tests/EditMode/MapTests.cs
@@ -66,7 +66,7 @@ public class MapTests
public void BuildUsesThePassedTerrainAndOverlayMaterials()
{
var (terrainMat, overlayMat) = Materials();
- Assert.AreEqual("Universal Render Pipeline/Terrain/Lit", terrainMat.shader.name);
+ Assert.AreEqual("Statecraft/StatecraftTerrain", terrainMat.shader.name);
Assert.AreEqual("Universal Render Pipeline/Unlit", overlayMat.shader.name);
var go = MapBuilder.Build(Paths.StreamingMap, HexesJson, terrainMat, overlayMat);
@@ -78,7 +78,7 @@ public class MapTests
Assert.IsNotNull(overlay, "HexOverlay child");
Assert.AreSame(overlayMat, overlay.GetComponent<MeshRenderer>().sharedMaterial);
Assert.AreEqual(2049, terrain.terrainData.heightmapResolution);
- Assert.AreEqual(MapBuilder.AlphamapResolution, terrain.terrainData.alphamapResolution);
+ Assert.AreEqual(1, terrain.terrainData.terrainLayers.Length);
Assert.Greater(overlay.GetComponent<MeshFilter>().sharedMesh.vertexCount, 0);
}
finally { Object.DestroyImmediate(go); }
@@ -106,12 +106,6 @@ public class MapTests
Assert.IsFalse(UnityEngine.Experimental.Rendering.GraphicsFormatUtility.HasAlphaChannel(l.diffuseTexture.graphicsFormat),
$"{l.name} diffuse must have no alpha channel");
}
- // URP Terrain/Lit has no specular-highlight or environment-reflection toggle; its per-layer defaults are zeroed.
- for (int i = 0; i < 4; i++)
- {
- Assert.AreEqual(0f, terrainMat.GetFloat("_Smoothness" + i), $"Terrain.mat _Smoothness{i}");
- Assert.AreEqual(0f, terrainMat.GetFloat("_Metallic" + i), $"Terrain.mat _Metallic{i}");
- }
}
finally { Object.DestroyImmediate(go); }
}
diff --git a/unity/Assets/Tests/EditMode/TerrainShaderTests.cs b/unity/Assets/Tests/EditMode/TerrainShaderTests.cs
new file mode 100644
index 000000000..77c934cd1
--- /dev/null
+++ b/unity/Assets/Tests/EditMode/TerrainShaderTests.cs
@@ -0,0 +1,177 @@
+#nullable enable
+using System.Collections;
+using System.Linq;
+using NUnit.Framework;
+using Statecraft.Game.Map;
+using UnityEditor;
+using UnityEditor.SceneManagement;
+using UnityEngine;
+using UnityEngine.TestTools;
+
+/// <summary>Plan Task 6: the Statecraft terrain graph, its baked inputs and what they do on screen.</summary>
+public class TerrainShaderTests
+{
+ const string TerrainMatPath = "Assets/Materials/Terrain.mat";
+
+ [TearDown]
+ public void Reset() { EditorSceneManager.NewScene(NewSceneSetup.EmptyScene, NewSceneMode.Single); VisualToggles.Clear(); }
+
+ static MapScene OpenMap()
+ {
+ EditorSceneManager.OpenScene("Assets/Map.unity", OpenSceneMode.Single);
+ var map = Object.FindFirstObjectByType<MapScene>(); map.Build();
+ return map;
+ }
+
+ /// <summary>Review C1, the positive half of the Task 6 gate: the generated passes include StatecraftTerrain.hlsl (the Custom
+ /// Function is in File mode), and the HLSL really paints the terrain: with a magenta biome texture a flat coastal-plain
+ /// pixel comes out magenta, not black or the sea colour.</summary>
+ [UnityTest]
+ public IEnumerator TheCustomFunctionDrivesTheTerrain()
+ {
+ var shader = AssetDatabase.LoadAssetAtPath<Material>(TerrainMatPath).shader;
+ var data = ShaderUtil.GetShaderData(shader);
+ int including = 0;
+ for (int s = 0; s < data.SubshaderCount; s++)
+ {
+ var sub = data.GetSerializedSubshader(s);
+ for (int p = 0; p < sub.PassCount; p++) if (sub.GetPass(p).SourceCode.Contains("StatecraftTerrain.hlsl")) including++;
+ }
+ Assert.Greater(including, 0, "no generated pass includes StatecraftTerrain.hlsl: the Custom Function is not in File mode");
+ var map = OpenMap();
+ 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.
+ var plain = map.Frame.ToWorld(34.90, 31.95, 0); plain.y = map.Terrain.SampleHeight(plain);
+ 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);
+ try
+ {
+ Shader.SetGlobalTexture(MapShaderGlobals.Biome, magenta);
+ var px = new Vector2[1];
+ var s = RenderSample.Render(cam, 480, 270, new[] { plain }, px);
+ var c = s.Mean((int)px[0].x, (int)px[0].y, 2);
+ TestContext.WriteLine($"land with a magenta biome texture: {c}");
+ 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); }
+ }
+
+ [Test]
+ public void TheTerrainUsesTheStatecraftGraphWithItsBakedTextures()
+ {
+ var mat = AssetDatabase.LoadAssetAtPath<Material>(TerrainMatPath);
+ Assert.AreEqual("Statecraft/StatecraftTerrain", mat.shader.name);
+ Assert.IsFalse(ShaderUtil.ShaderHasError(mat.shader), string.Join("\n", ShaderUtil.GetShaderMessages(mat.shader).Select(m => m.message)));
+ Assert.AreEqual(AssetDatabase.LoadAssetAtPath<Texture2D>(MapTexturePaths.Bake), mat.GetTexture("_ScBakeTex"));
+ Assert.AreEqual(AssetDatabase.LoadAssetAtPath<Texture2D>(MapTexturePaths.Coast), mat.GetTexture("_ScCoastTex"));
+ CollectionAssert.AreEquivalent(MapBuilder.BiomeColours.Keys, MapPalette.Ground.Keys, "a ground colour for every biome");
+ }
+
+ [Test]
+ public void TheTerrainShaderCompilesForWebGL2() =>
+ CollectionAssert.IsEmpty(ShaderChecks.Gles3Errors(AssetDatabase.LoadAssetAtPath<Material>(TerrainMatPath).shader));
+
+ [Test]
+ public void TheBakedTexturesImportAsLinearClampedData()
+ {
+ var bake = AssetDatabase.LoadAssetAtPath<Texture2D>(MapTexturePaths.Bake);
+ var coast = AssetDatabase.LoadAssetAtPath<Texture2D>(MapTexturePaths.Coast);
+ foreach (var t in new[] { bake, coast })
+ {
+ Assert.AreEqual(2048, t.width, t.name); Assert.AreEqual(2048, t.height, t.name);
+ Assert.IsFalse(t.isDataSRGB, t.name + " is data, not colour");
+ Assert.AreEqual(TextureWrapMode.Clamp, t.wrapMode, t.name);
+ Assert.Greater(t.mipmapCount, 1, t.name);
+ }
+ Assert.AreEqual(TextureFormat.R8, coast.format, "one uncompressed channel: compression blocks would show in the foam band");
+ }
+
+ [Test]
+ public void TheTerrainDrawsInOnePassAndNeverFallsBackToItsBasemap()
+ {
+ var terrain = OpenMap().Terrain;
+ Assert.AreEqual(1, terrain.terrainData.terrainLayers.Length, "one layer: one pass (7 layers drew every pixel twice)");
+ Assert.GreaterOrEqual(terrain.basemapDistance, 1e6f, "the camera is always farther than the 1 km default");
+ }
+
+ [Test]
+ public void TheBiomeTextureIsOwnedByTheMapAndSetForTheShaders()
+ {
+ var map = OpenMap();
+ var biome = Shader.GetGlobalTexture(MapShaderGlobals.Biome);
+ Assert.IsNotNull(biome); Assert.AreEqual(MapBuilder.BiomeTextureResolution, biome.width);
+ var m = Shader.GetGlobalVector(MapShaderGlobals.Map);
+ Assert.AreEqual(map.Terrain.terrainData.size.x, m.x, 1f); Assert.AreEqual(map.Terrain.terrainData.size.z, m.y, 1f);
+ Assert.AreEqual(map.Hexes.hex_size_km * 1000f, Shader.GetGlobalVector(MapShaderGlobals.MapOrigin).w, 1e-3f);
+ CollectionAssert.Contains(VisualToggles.Names, "haze");
+ EditorSceneManager.NewScene(NewSceneSetup.EmptyScene, NewSceneMode.Single);
+ Assert.IsTrue(biome == null, "destroyed with the map");
+ }
+
+ /// <summary>Rendered by Tel Aviv: 10 km offshore is the sea colour, 10 km inland the ground colour.</summary>
+ [UnityTest]
+ public IEnumerator TheCoastSeparatesLandFromSea()
+ {
+ var map = OpenMap();
+ yield return null;
+ var cam = Camera.main; var rig = cam.GetComponent<CameraRig>();
+ rig.LookAt = map.Frame.ToWorld(34.78, 32.08, 0); rig.Distance = 60000f; rig.Yaw = 0; rig.TopInset = 0; rig.Apply();
+ var sea = map.Frame.ToWorld(34.66, 32.08, 0); var land = map.Frame.ToWorld(34.89, 32.08, 0);
+ sea.y = map.Terrain.SampleHeight(sea); land.y = map.Terrain.SampleHeight(land);
+ var px = new Vector2[2];
+ var s = RenderSample.Render(cam, 960, 540, new[] { sea, land }, px);
+ Color a = s.Mean((int)px[0].x, (int)px[0].y, 3), b = s.Mean((int)px[1].x, (int)px[1].y, 3);
+ TestContext.WriteLine($"sea {a}, land {b}");
+ Assert.Greater(a.b, a.r + 0.15f, "sea"); Assert.Greater(b.r, b.b + 0.05f, "land");
+ }
+
+ /// <summary>Rendered over the Judean hills: the bakes (AO, curvature, sky-view) raise the relief's local contrast
+ /// (RenderSample.GradientEnergy) by at least 8% against a neutral bake (AO 1, curvature 0.5, sky 1). Local, not the
+ /// frame's luma spread: this view takes in the Dead Sea, and the land-to-sea step dominates LumaStd, so the AO's overall
+ /// darkening of the land lowers it (measured 0.0830 -> 0.0827) while the relief is visibly carved (gradient +13%).
+ /// Terrain.mat is changed in memory only and restored.</summary>
+ [UnityTest]
+ public IEnumerator TheBakesCarveTheRelief()
+ {
+ var map = OpenMap();
+ yield return null;
+ var cam = Camera.main; var rig = cam.GetComponent<CameraRig>();
+ rig.LookAt = map.Frame.ToWorld(35.25, 31.70, 0); rig.Distance = 45000f; rig.Yaw = 0; rig.TopInset = 0; rig.Apply();
+ var mat = AssetDatabase.LoadAssetAtPath<Material>(TerrainMatPath);
+ var real = mat.GetTexture("_ScBakeTex");
+ var neutral = new Texture2D(1, 1, TextureFormat.RGBA32, false, true);
+ neutral.SetPixel(0, 0, new Color(1f, 0.5f, 1f, 1f)); neutral.Apply();
+ try
+ {
+ var carved = RenderSample.Render(cam, 480, 270);
+ mat.SetTexture("_ScBakeTex", neutral);
+ var plain = RenderSample.Render(cam, 480, 270);
+ TestContext.WriteLine($"relief gradient {plain.GradientEnergy(0f, 1f):0.0000} -> {carved.GradientEnergy(0f, 1f):0.0000}");
+ Assert.Greater(carved.GradientEnergy(0f, 1f), plain.GradientEnergy(0f, 1f) * 1.08f);
+ }
+ finally { mat.SetTexture("_ScBakeTex", real); Object.DestroyImmediate(neutral); }
+ }
+
+ /// <summary>Rendered at the country-wide pose: the haze moves the far (top) band more than the near (bottom) band. Both
+ /// bands are sampled in the column x 0.45..0.6, which is the map's land from top to bottom at this pose: in Task 6 only
+ /// the land carries haze, and across the full width the far band is mostly the Mediterranean and the border skirt
+ /// (no haze until Task 7), which hid the effect (full width: far 0.023, near 0.026; land column: far 0.069, near 0.026).</summary>
+ [UnityTest]
+ public IEnumerator TheHazeThickensWithDistance()
+ {
+ var map = OpenMap();
+ yield return null;
+ var cam = Camera.main; var rig = cam.GetComponent<CameraRig>();
+ PromoPose.Diorama02.Apply(rig, map.Frame); rig.TopInset = 0; rig.Apply();
+ VisualToggles.Set("haze", false); var clear = RenderSample.Render(cam, 480, 270);
+ VisualToggles.Set("haze", true); var hazy = RenderSample.Render(cam, 480, 270);
+ const float x0 = 0.45f, x1 = 0.6f;
+ float far = Mathf.Abs(hazy.MeanLuma(x0, 0.8f, x1, 0.95f) - clear.MeanLuma(x0, 0.8f, x1, 0.95f));
+ float near = Mathf.Abs(hazy.MeanLuma(x0, 0.05f, x1, 0.2f) - clear.MeanLuma(x0, 0.05f, x1, 0.2f));
+ TestContext.WriteLine($"haze shift far {far:0.000}, near {near:0.000}");
+ Assert.Greater(far, near + 0.005f);
+ }
+}
diff --git a/unity/Assets/Tests/EditMode/TerrainShaderTests.cs.meta b/unity/Assets/Tests/EditMode/TerrainShaderTests.cs.meta
new file mode 100644
index 000000000..e524f5a66
--- /dev/null
+++ b/unity/Assets/Tests/EditMode/TerrainShaderTests.cs.meta
@@ -0,0 +1,2 @@
+fileFormatVersion: 2
+guid: f8ee37c9c4d884096a341c458bdb690c
\ No newline at end of file