An AI agent skill that turns any subject into a 3D film or app
viz3d 0.9.3: ground cover from real assets, hue check in compare-look
Nguyen Xuan And92730af85c8
diff --git a/plugins/visualize-in-3d/.claude-plugin/plugin.json b/plugins/visualize-in-3d/.claude-plugin/plugin.jsonindex 07381ca..51a5c7d 100644--- a/plugins/visualize-in-3d/.claude-plugin/plugin.json+++ b/plugins/visualize-in-3d/.claude-plugin/plugin.json@@ -1,6 +1,6 @@{"name": "visualize-in-3d",- "version": "0.9.2",+ "version": "0.9.3","description": "Visualize anything in 3D: places, systems, objects, products, creatures, stories and events, as a documentary or action film, a showcase, a live three.js app with a dashboard, a lesson, an illustrated cutaway book or a playable game, in twelve looks across four families, built from real layouts and models made from real references.","author": {"name": "CodePawl",diff --git a/plugins/visualize-in-3d/skills/visualize-in-3d/references/asset-sources.md b/plugins/visualize-in-3d/skills/visualize-in-3d/references/asset-sources.mdindex 6445cb2..3ee2c6d 100644--- a/plugins/visualize-in-3d/skills/visualize-in-3d/references/asset-sources.md+++ b/plugins/visualize-in-3d/skills/visualize-in-3d/references/asset-sources.md@@ -21,6 +21,12 @@ list each one in the report.them for props and set dressing, or as a base to restyle.5. **Build it** in Blender (or three.js, see `no-blender.md`) from a reference sheet (`real-objects.md`).+Ground cover counts as an asset too. Search for it like a prop: a ground texture (ambientCG `Grass005` is a bright+lawn, `api/v2/full_json?type=Material&q=grass` lists more) and tuft models on Poly Pizza (search "grass"; each+model page links its `.glb` on static.poly.pizza and states its licence). Tufts alone leave bare ground between+them; lay them on the texture. Brighten dark tuft textures with the material colour, and render two or three+ground options for the user to pick.+Pick the right kind of thing, not the nearest model: a narrowboat for a canal, not a sailing ship. A containercrane belongs in a port, not a construction crane. A wrong kind fails review however good it looks.diff --git a/plugins/visualize-in-3d/skills/visualize-in-3d/references/live-embed.md b/plugins/visualize-in-3d/skills/visualize-in-3d/references/live-embed.mdindex cfb539b..cc33b7a 100644--- a/plugins/visualize-in-3d/skills/visualize-in-3d/references/live-embed.md+++ b/plugins/visualize-in-3d/skills/visualize-in-3d/references/live-embed.md@@ -19,7 +19,10 @@ Skip Pass 1 and do not ask about Blender. Build everything in one pass in `{{WORswitcher and the film unless the user asks.2. **Ready models first, a kit for the rest.** Take every prop that exists ready-made from the CC0 and CC BY packsin `asset-sources.md` (Kenney, Quaternius, Poly Pizza, Poly Haven), chosen to match the style card's shapes:- boats, trees, rocks, people, vehicles, fences, plants. Build only the subject-specific parts in one file+ boats, trees, rocks, people, vehicles, fences, plants, and the ground itself: a real CC0 ground texture (lawn,+ sand, gravel from ambientCG or Poly Haven) under instanced tuft models (Quaternius "Grass Wispy" and "Tall+ Grass" on Poly Pizza). Never code-built grass blades or a canvas-painted ground: flat triangles with random+ greens read as noise. Build only the subject-specific parts in one file`src/kit.jsx`, parametric and at real size (a lock's chamber and gates, a port's quay), with bevels and realmaterials. A scene of plain boxes and capsules is a fail, not a prototype. Build every main asset from the kit against its reference sheet(`real-objects.md`): proportions and part count still matter.diff --git a/plugins/visualize-in-3d/skills/visualize-in-3d/references/style-reference.md b/plugins/visualize-in-3d/skills/visualize-in-3d/references/style-reference.mdindex f01c40e..f74c4ac 100644--- a/plugins/visualize-in-3d/skills/visualize-in-3d/references/style-reference.md+++ b/plugins/visualize-in-3d/skills/visualize-in-3d/references/style-reference.md@@ -62,7 +62,7 @@ shapes (`asset-sources.md`) instead of reshaping primitives toward them.Each self-review round renders the build from the reference's camera (its angle and field of view, at a distancewhere the subject fills the same share of the frame) at the same size and puts the two side byside in one image. Run `uv run --no-project --with pillow python {{SKILL_DIR}}/scripts/compare-look.py-<reference> <render>`: it fails when the median luminance or the saturation is more than 10% off. Darkness is+<reference> <render>`: it fails when the median luminance or the saturation is more than 10% off, or the hue moves more than 10 degrees. Darkness ishard to judge by eye next to the scene you built, so trust the number. Crop each hero prop next to the real phototoo. Write the three biggest gaps, each tied to a card line ("ground is one flat colour, card saysgrass with flowers and stones"), fix them, and render again. A round passes when compare-look prints PASS and no gap isdiff --git a/plugins/visualize-in-3d/skills/visualize-in-3d/scripts/compare-look.py b/plugins/visualize-in-3d/skills/visualize-in-3d/scripts/compare-look.pyindex 2b5ef5b..c4bdfa0 100644--- a/plugins/visualize-in-3d/skills/visualize-in-3d/scripts/compare-look.py+++ b/plugins/visualize-in-3d/skills/visualize-in-3d/scripts/compare-look.py@@ -5,7 +5,9 @@ Usage: uv run --no-project --with pillow python compare-look.py <reference> <renBoth images are shrunk to 640 px. The script prints the median, 10th and 90th percentileluminance and the mean saturation of each, then the render's ratio to the reference. It failswhen the median luminance or the mean saturation differs from the reference by more than the-tolerance. Crop UI out of both images first when the UI covers much of either frame.+tolerance, or when the median hue of the coloured pixels moves more than 10 degrees+(water and flowers mix into it, so a smaller shift is noise). Crop UI out of both images first+when the UI covers much of either frame."""import argparse@@ -18,9 +20,13 @@ def measure(image_path):image = Image.open(image_path).convert("RGB")image.thumbnail((640, 640))luminance = sorted(image.convert("L").tobytes())- saturation = image.convert("HSV").tobytes()[1::3]+ hsv = image.convert("HSV").tobytes()+ saturation = hsv[1::3]+ # Median hue of the clearly coloured pixels; a scene can match brightness yet turn olive or teal.+ coloured_hues = sorted(hsv[index] for index in range(0, len(hsv), 3) if hsv[index + 1] > 60)count = len(luminance)return {+ "hue": coloured_hues[len(coloured_hues) // 2] * 360 / 255 if coloured_hues else 0,"median": luminance[count // 2],"p10": luminance[count // 10],"p90": luminance[(9 * count) // 10],@@ -40,7 +46,7 @@ def main():for name, values in (("reference", reference), ("render", render)):print(f"{name:9} luminance median {values['median']:3} p10 {values['p10']:3} p90 {values['p90']:3}"- f" saturation {values['saturation']:.0f}"+ f" saturation {values['saturation']:.0f} hue {values['hue']:.0f}")brightness_ratio = render["median"] / max(reference["median"], 1)saturation_ratio = render["saturation"] / max(reference["saturation"], 1)@@ -49,8 +55,11 @@ def main():failures.append("darker" if brightness_ratio < 1 else "brighter")if abs(saturation_ratio - 1) > arguments.tolerance:failures.append("duller" if saturation_ratio < 1 else "more saturated")+ hue_shift = render["hue"] - reference["hue"]+ if abs(hue_shift) > 10:+ failures.append(f"hue off by {hue_shift:+.0f} degrees")verdict = "FAIL " + ", ".join(failures) if failures else "PASS"- print(f"{verdict}: brightness x{brightness_ratio:.2f}, saturation x{saturation_ratio:.2f} of the reference")+ print(f"{verdict}: brightness x{brightness_ratio:.2f}, saturation x{saturation_ratio:.2f}, hue {hue_shift:+.0f} degrees against the reference")if __name__ == "__main__":