Skip to content

Official Codebase of 3DCodeVerse

Python

textures: a passive offer loses to the recipe — say the ground is what the pack is for

ziyao00c6daf1c986
diff --git a/harness/codeverse/prompts/tracks/scene_env.j2 b/harness/codeverse/prompts/tracks/scene_env.j2
index 8f85f823..d9edfdb6 100644
--- a/harness/codeverse/prompts/tracks/scene_env.j2
+++ b/harness/codeverse/prompts/tracks/scene_env.j2
@@ -86,15 +86,15 @@ every authored camera needs mean luminance >= 0.15 with dark <= 35 %.
{{ effects_catalog }}
{% endif %}
-{% if textures is defined and textures %}
-
-{{ textures }}
-{% endif %}
{% if recipes is defined and recipes %}
# Recipes (from the scene cookbook — copy these numbers and snippets)
{{ recipes }}
{% endif %}
+{% if textures is defined and textures %}
+
+{{ textures }}
+{% endif %}
## Output
{{ output_format }}
diff --git a/harness/codeverse/prompts/tracks/scene_zone.j2 b/harness/codeverse/prompts/tracks/scene_zone.j2
index 4ae9c981..7f74d372 100644
--- a/harness/codeverse/prompts/tracks/scene_zone.j2
+++ b/harness/codeverse/prompts/tracks/scene_zone.j2
@@ -94,15 +94,15 @@ motion is under 0.4 % of the frame, double the amplitude and render again.
{{ effects_catalog }}
{% endif %}
-{% if textures is defined and textures %}
-
-{{ textures }}
-{% endif %}
{% if recipes is defined and recipes %}
# Recipes (from the scene cookbook — copy these numbers and snippets)
{{ recipes }}
{% endif %}
+{% if textures is defined and textures %}
+
+{{ textures }}
+{% endif %}
## Output
{{ output_format }}
diff --git a/harness/codeverse/texturing/plan.py b/harness/codeverse/texturing/plan.py
index 5a0eb6e8..fb20f7c8 100644
--- a/harness/codeverse/texturing/plan.py
+++ b/harness/codeverse/texturing/plan.py
@@ -519,10 +519,22 @@ def load_manifest(path: Path) -> dict[str, dict[str, Any]]:
def texture_pack_prompt(manifest: dict[str, dict[str, Any]], *, url_prefix: str = DEFAULT_URL_PREFIX) -> str:
- """Prompt snippet for zone/env generation: what exists and the exact loading idiom."""
+ """Prompt snippet for zone/env generation: what exists and the exact loading idiom.
+
+ Rendered AFTER the cookbook recipes (``tracks/scene_env.j2`` / ``scene_zone.j2``), and
+ it says outright that the ground blend is what the pack is for. Measured 2026-09-05:
+ the first two cells of the texture arm generated 8 and 9 textures, carried this block
+ verbatim in their env prompt, and used **zero** of them across `env.js` and six zone
+ modules. Three things were telling the model to write a procedural colour blend — the
+ plan's own ground sentence ("blends velvet moss, raked gravel, packed earth and slate
+ by height, slope and normal noise"), the cookbook chapter "Ground that reads real
+ (blend, paths, edges — never one flat colour)", and that chapter's position AFTER this
+ block — against one passive list offering an alternative. A passive offer loses.
+ """
if not manifest:
return ""
- lines = ["## Available textures (seamless tileable albedo PNGs, generated for this scene)"]
+ ground = [n for n, e in manifest.items() if str(e.get("role", "")).lower() in ("ground", "path")]
+ lines = ["## Available textures (seamless tileable albedo PNGs, generated FOR THIS SCENE — use them)"]
for name, e in manifest.items():
lines.append(f"- `{url_prefix}/{e['file']}` — {name} ({e.get('family', 'other')}, {e.get('role', '')}; "
f"one tile = {float(e['tile_size_m']):.2f} m; roughness {float(e.get('roughness', 0.8)):.2f})")
@@ -537,6 +549,16 @@ def texture_pack_prompt(manifest: dict[str, dict[str, Any]], *, url_prefix: str
"const mat = new THREE.MeshStandardMaterial({ map: tex, roughness: 0.8, metalness: 0.0 });\n"
"```\n"
"Use `texture.clone()` (+ `needsUpdate = true`) when the same image needs a different repeat. "
- "Keep vertex-colour / procedural materials where no texture fits; never invent texture URLs."
+ "Never invent texture URLs, and keep procedural materials where no texture fits."
)
+ if ground:
+ lines.append(
+ "\n**The ground is what this pack is for.** The single most repeated defect on this "
+ "track is a ground that reads as one flat untextured colour. The recipe above "
+ "blends ground COLOURS by height, slope and noise — keep that logic exactly, and "
+ "blend these MAPS instead of (or multiplied by) the flat colours: "
+ + ", ".join(f"`{n}`" for n in ground)
+ + ". Sample each with its own `repeat`, mix them with the same masks the recipe "
+ "builds, and keep the vertex-colour term as a tint rather than the whole albedo."
+ )
return "\n".join(lines)
diff --git a/harness/tests/scene_gates/test_scene_textures_stage.py b/harness/tests/scene_gates/test_scene_textures_stage.py
index 80bfb606..55760a1a 100644
--- a/harness/tests/scene_gates/test_scene_textures_stage.py
+++ b/harness/tests/scene_gates/test_scene_textures_stage.py
@@ -111,3 +111,46 @@ def test_the_prompt_context_carries_the_manifest_the_stage_produced(monkeypatch)
seen.clear()
S.SceneTrack()._ctx(ctx_none) # type: ignore[arg-type]
assert seen["textures"] == "", "no pack, no prompt block"
+
+
+GROUND_MANIFEST = {
+ "raked_zen_gravel": {"file": "raked_zen_gravel.png", "family": "stone", "role": "ground",
+ "tile_size_m": 1.0, "roughness": 0.95},
+ "dark_slate_flagstone": {"file": "dark_slate_flagstone.png", "family": "stone", "role": "path",
+ "tile_size_m": 1.5, "roughness": 0.8},
+ "aged_cedar_planks": {"file": "aged_cedar_planks.png", "family": "wood", "role": "prop",
+ "tile_size_m": 0.8, "roughness": 0.75},
+}
+
+
+def test_the_pack_says_outright_that_the_ground_is_what_it_is_for():
+ """Measured 2026-09-05: the first two cells of the texture arm generated 8 and 9
+ textures, carried the block verbatim in their env prompt, and used ZERO of them across
+ `env.js` and six zone modules. Three things told the model to write a procedural
+ colour blend — the plan's own ground sentence, the cookbook chapter "Ground that reads
+ real (blend, paths, edges — never one flat colour)", and that chapter's position after
+ the block — against one passive list. A passive offer loses."""
+ from codeverse.texturing.plan import texture_pack_prompt
+
+ text = texture_pack_prompt(GROUND_MANIFEST)
+ assert "The ground is what this pack is for" in text
+ # it names the ground/path maps, and only those
+ assert "`raked_zen_gravel`" in text and "`dark_slate_flagstone`" in text
+ tail = text.split("The ground is what this pack is for")[1]
+ assert "`aged_cedar_planks`" not in tail, "a prop texture is not a ground map"
+
+
+def test_a_pack_with_no_ground_map_makes_no_ground_claim():
+ from codeverse.texturing.plan import texture_pack_prompt
+
+ props = {k: v for k, v in GROUND_MANIFEST.items() if v["role"] == "prop"}
+ text = texture_pack_prompt(props)
+ assert "aged_cedar_planks.png" in text
+ assert "The ground is what this pack is for" not in text
+
+
[email protected]("template", ["scene_env.j2", "scene_zone.j2"])
+def test_the_pack_has_the_last_word_over_the_recipes(template: str):
+ """The cookbook's ground chapter is long and specific; whichever comes last wins."""
+ out = _render(template, textures="TEXTURE_BLOCK_MARKER", recipes="RECIPE_MARKER")
+ assert out.index("RECIPE_MARKER") < out.index("TEXTURE_BLOCK_MARKER")