Skip to content

Commit 20849f2

Browse files
TMHSDigitalclaude
andcommitted
fix(showcase): dress the anvil hero with a polished face, a hammer and forge light
The anvil read as a uniformly dark block on its stump. The render path now changes three things: - polish_face() mixes up-facing steel (the working face and the top of the horn) toward bright, low-roughness metal, driven by the geometry normal, so the face reads as hammer-worn. - build_hammer() lays a render-only cross-peen hammer on the floor beside the stump. It is added to the framing gate's element set, so it must clear the frame edges too. - A low warm point light off frame stands in for the forge and puts an orange edge on the steel and stump. The checked mesh, budgets and checks are unchanged. Evidence (live runs, local; E:\Blender-Developer-Tools\.scratch binaries): - blender-5.2.1-windows-x64 (Blender 5.2.1 LTS) and blender-4.5.11-windows-x64 (Blender 4.5.11 LTS): default exit 0 on both. Falsifiers on both: --skip-decimate 9, --stray-vert 15, --lift-z 16, --short-staves 16, --float-anvil 17, --round-band 18, --round-waist 19. - Framing (5.2.1): fill x=0.297 y=0.800, margins l=0.344 r=0.159 b=0.050 t=0.150. The first hammer placement crossed the bottom edge (exit 10); it now lies beside the stump. - Contact sheet: luma 0.212, stage 0.214, warmth +0.334, sat 0.226. - Asset sheet (docs/gallery/asset-sheets/anvil.webp): the face polish reads at sheet scale, and the anvil is not the least-designed object in the lineup. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent 8fc90b5 commit 20849f2

8 files changed

Lines changed: 87 additions & 4 deletions

File tree

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ Budget-conformance props. Not examples. Conventions: [`showcase/README.md`](show
122122
<a href="showcase/cart/"><img src="showcase/cart/preview.webp" width="24%" alt="Cart: a two-wheel wooden cart with spoked wheels, slatted bed, and shafts on a dark studio floor" /></a>
123123
<a href="showcase/park-bench/"><img src="showcase/park-bench/preview.webp" width="24%" alt="Park bench: a wrought-iron bench whose round-bar legs curl into scrolled feet, with wooden slats and a reclined back, on a dark studio floor" /></a>
124124
<a href="showcase/wheelbarrow/"><img src="showcase/wheelbarrow/preview.webp" width="24%" alt="Wheelbarrow: a wooden tray with walls of stacked boards and iron straps, a spoked wheel, rear legs, and handles on a dark studio floor" /></a>
125-
<a href="showcase/anvil/"><img src="showcase/anvil/preview.webp" width="24%" alt="Anvil: a dark forged-steel London-pattern anvil with a flared, squared waist on a hooped timber stump on a dark studio floor" /></a>
125+
<a href="showcase/anvil/"><img src="showcase/anvil/preview.webp" width="24%" alt="Anvil: a forged-steel London-pattern anvil with a hammer-polished face on a hooped timber stump, a hammer at its foot" /></a>
126126
<a href="showcase/water-trough/"><img src="showcase/water-trough/preview.webp" width="24%" alt="Water trough: a watertight wooden trough with plank ends, contained water, and trestle legs on a dark studio floor" /></a>
127127
<a href="showcase/hitching-post/"><img src="showcase/hitching-post/preview.webp" width="24%" alt="Hitching post: a square timber post with a pyramidal cap, cross-arm, iron bands wrapped around it, two hitching rings and a nailed horseshoe on a dark studio floor" /></a>
128128
<a href="showcase/grindstone/"><img src="showcase/grindstone/preview.webp" width="24%" alt="Grindstone: a stone wheel on a timber A-frame with an iron axle, hubs, crank, and tray on a dark studio floor" /></a>
55.6 KB
Loading
5.24 KB
Loading
4.64 KB
Loading

‎showcase/anvil/README.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,13 @@ it is now dark forged steel with rust. Staves and head carry their own
8787
wood tone and grain. The stage grid grew from 14 to 60 m. The temp `.glb`
8888
is removed after its size is measured.
8989

90+
The hero dresses the scene without touching the checked mesh: up-facing
91+
steel (the working face and the top of the horn) is mixed toward bright,
92+
low-roughness metal by the geometry normal, as a hammer polishes it; a
93+
render-only cross-peen hammer lies on the floor beside the stump; and a
94+
low warm point light off frame stands in for the forge. The hammer is in
95+
the framing gate's element set, so it has to clear the frame edges too.
96+
9097
### Falsifiers
9198

9299
Each violates one named budget. All seven were run on 4.5.11, 5.1.2 and

‎showcase/anvil/anvil.py‎

Lines changed: 78 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,6 +1417,70 @@ def check(
14171417
return 0, low, high, wood, tex, collider
14181418

14191419

1420+
def polish_face(mat):
1421+
"""Render only: up-facing steel (the working face and horn top) is worn
1422+
bright by the hammer, the flanks keep the dark forge scale."""
1423+
nt = mat.node_tree
1424+
bsdf = nt.nodes["Principled BSDF"]
1425+
geo = nt.nodes.new("ShaderNodeNewGeometry")
1426+
sep = nt.nodes.new("ShaderNodeSeparateXYZ")
1427+
nt.links.new(geo.outputs["Normal"], sep.inputs["Vector"])
1428+
ramp = nt.nodes.new("ShaderNodeMapRange")
1429+
ramp.inputs["From Min"].default_value = 0.82
1430+
ramp.inputs["From Max"].default_value = 0.97
1431+
nt.links.new(sep.outputs["Z"], ramp.inputs["Value"])
1432+
for sock_name, bright in (("Base Color", (0.50, 0.50, 0.52, 1.0)), ("Roughness", 0.16)):
1433+
sock = bsdf.inputs[sock_name]
1434+
src = sock.links[0].from_socket if sock.is_linked else None
1435+
mix = nt.nodes.new("ShaderNodeMix")
1436+
mix.data_type = "RGBA" if sock_name == "Base Color" else "FLOAT"
1437+
a_in, b_in = mix.inputs["A"], mix.inputs["B"]
1438+
if mix.data_type == "RGBA":
1439+
a_in = [i for i in mix.inputs if i.name == "A" and i.type == "RGBA"][0]
1440+
b_in = [i for i in mix.inputs if i.name == "B" and i.type == "RGBA"][0]
1441+
else:
1442+
a_in = [i for i in mix.inputs if i.name == "A" and i.type == "VALUE"][0]
1443+
b_in = [i for i in mix.inputs if i.name == "B" and i.type == "VALUE"][0]
1444+
if src is not None:
1445+
nt.links.new(src, a_in)
1446+
else:
1447+
a_in.default_value = sock.default_value
1448+
b_in.default_value = bright
1449+
fac = mix.inputs.get("Factor") or mix.inputs.get("Fac")
1450+
nt.links.new(ramp.outputs["Result"], fac)
1451+
out = [o for o in mix.outputs if o.name == "Result" and
1452+
o.type == ("RGBA" if mix.data_type == "RGBA" else "VALUE")][0]
1453+
nt.links.new(out, sock)
1454+
1455+
1456+
def build_hammer(scene, steel, wood):
1457+
"""Render only: a cross-peen hammer lying on the floor against the stump."""
1458+
me = bpy.data.meshes.new("Hammer")
1459+
bm = bmesh.new()
1460+
try:
1461+
res = bmesh.ops.create_cone(bm, cap_ends=True, segments=12, radius1=0.013,
1462+
radius2=0.015, depth=0.34)
1463+
for v in res["verts"]:
1464+
v.co = Vector((v.co.z, v.co.y, v.co.x)) # handle along +X
1465+
head = bmesh.ops.create_cube(bm, size=1.0)
1466+
for v in head["verts"]:
1467+
v.co = Vector((v.co.x * 0.036 + 0.17, v.co.y * 0.115, v.co.z * 0.036))
1468+
head_faces = {f for v in head["verts"] for f in v.link_faces}
1469+
for f in bm.faces:
1470+
f.material_index = 1 if f in head_faces else 0
1471+
f.smooth = f not in head_faces
1472+
bm.to_mesh(me)
1473+
finally:
1474+
bm.free()
1475+
me.materials.append(wood)
1476+
me.materials.append(steel)
1477+
ob = bpy.data.objects.new("Hammer", me)
1478+
ob.location = (0.27, 0.10, 0.036)
1479+
ob.rotation_euler = (0.0, 0.0, math.radians(62.0))
1480+
scene.collection.objects.link(ob)
1481+
return ob
1482+
1483+
14201484
def render_still(low, _wood, _tex, path, engine):
14211485
scene = bpy.context.scene
14221486
for ob in list(scene.objects):
@@ -1465,9 +1529,21 @@ def light(name, loc, energy, size, col, rot):
14651529
ob.rotation_euler = tuple(math.radians(a) for a in rot)
14661530
scene.collection.objects.link(ob)
14671531

1468-
light("Key", (-3.6, -5.0, 5.4), 660.0, 4.0, (1.0, 0.94, 0.86), (50, 0, -36))
1532+
light("Key", (-3.6, -5.0, 5.4), 620.0, 3.0, (1.0, 0.94, 0.86), (50, 0, -36))
14691533
light("Fill", (5.0, -3.4, 2.4), 46.0, 8.0, (0.72, 0.82, 1.0), (62, 0, 50))
14701534
light("Wedge", (2.2, 4.0, 3.8), 600.0, 5.5, (1.0, 0.70, 0.40), (-70, 0, 198))
1535+
# an off-frame forge: a low warm point to one side, so the steel picks up
1536+
# an orange edge the way an anvil does in a working smithy
1537+
forge = bpy.data.lights.new("Forge", "POINT")
1538+
forge.energy = 55.0
1539+
forge.color = (1.0, 0.45, 0.14)
1540+
forge.shadow_soft_size = 0.25
1541+
forge_ob = bpy.data.objects.new("Forge", forge)
1542+
forge_ob.location = (0.95, 0.35, 0.42)
1543+
scene.collection.objects.link(forge_ob)
1544+
1545+
polish_face(low.data.materials[METAL_IDX])
1546+
hammer = build_hammer(scene, low.data.materials[METAL_IDX], _wood)
14711547

14721548
bb = world_bbox(low)
14731549
span = max(bb[3] - bb[0], bb[4] - bb[1], bb[5] - bb[2], 0.2)
@@ -1505,7 +1581,7 @@ def light(name, loc, energy, size, col, rot):
15051581
scene.view_settings.view_transform = "Standard"
15061582

15071583
fcode = gallery_framing.check_framing(
1508-
scene, cam, hero=[low], elements=[low], stage=[floor, wall],
1584+
scene, cam, hero=[low], elements=[low, hammer], stage=[floor, wall],
15091585
)
15101586
if fcode:
15111587
return fcode

‎showcase/anvil/preview.webp‎

5.06 KB
Loading

‎showcase/gallery.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@
182182
"name": "anvil",
183183
"dir": "showcase/anvil",
184184
"teaches": "A procedural blacksmith anvil on a timber stump through UVs, bake, LOD, collider, and Unity glTF, asserting recomputed budgets rather than an API contract.",
185-
"alt": "A dark forged-steel anvil with a flared, squared waist, mounted on a hooped timber stump.",
185+
"alt": "A forged-steel anvil with a hammer-polished face and a flared, squared waist on a hooped timber stump, a cross-peen hammer on the floor and forge light on its flank.",
186186
"witnessesFix": "Recomputed: 3052 tris, two materials with 1040 wood and 854 metal faces, UVs in 0..1 with zero AABB overlap, outer AABB 0.621×0.414×0.489 m, LOD ratios in band, convex collider 134 tris, hygiene 0, 16 grounded staves, hoop bite 0.003 m, foot-on-head gap 0.003 m, waist corner reach 0.8572, non-empty glTF. --skip-decimate exits 9; --stray-vert 15; --lift-z/--short-staves 16; --float-anvil 17; --round-band 18; --round-waist 19.",
187187
"hero": "docs/gallery/assets/anvil-hero.webp",
188188
"preview": "showcase/anvil/preview.webp",

0 commit comments

Comments
 (0)