Skip to content

Commit d9c5dd7

Browse files
TMHSDigitalclaude
andcommitted
fix: shader-node-group presentation, standard view on the house stage
Render path only: Standard view transform, dark stage, softer key, camera aimed at the spheres. Contract and exit codes unchanged on 4.5.11, 5.1.2 and 5.2.1. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: TMHSDigital <154358121+TMHSDigital@users.noreply.github.com>
1 parent 7493d11 commit d9c5dd7

6 files changed

Lines changed: 48 additions & 14 deletions

File tree

2.83 KB
Loading
13.6 KB
Loading

‎docs/gallery/shader-node-group/index.html‎

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,8 @@ <h1>shader-node-group</h1>
280280
<section class="detail-section md">
281281
<p>A runnable example that declares a reusable <code>TintedGloss</code> shader group through <code>tree.interface.new_socket</code> — the 4.x/5.x API that replaced <code>tree.inputs</code>/<code>tree.outputs</code> — and instances it in two materials with different parameters, following <a href="https://github.com/TMHSDigital/Blender-Developer-Tools/tree/main/skills/procedural-materials-and-shaders/SKILL.md"><code>procedural-materials-and-shaders</code></a> and the <a href="https://github.com/TMHSDigital/Blender-Developer-Tools/tree/main/snippets/shader-node-group.py"><code>shader-node-group</code></a> snippet.</p>
282282
<p><strong>What it witnesses:</strong> the grouping contract. Sockets declared on the interface appear on every group-node instance; both materials share ONE group datablock (<code>users == 2</code>); and the per-material Tint lives on the group <strong>node</strong>, not inside the group — set it inside the tree and every material changes at once. The render is the proof: two spheres, one group, two colors.</p>
283+
<h2>Staging</h2>
284+
<p>The still renders under the Standard view transform on the dark house stage; it had no view transform set, so AgX washed both tints toward pastel over a lighter floor. The key is larger and softer (the glossy spheres had mirrored it as a hard white square), and the camera aims at the sphere centres. Render path only.</p>
283285
<h2>Run</h2>
284286
<pre><code># Cheap correctness check (no render) — the CI check:
285287
blender --background --python shader_node_group.py --
@@ -438,8 +440,8 @@ <h2>Source</h2>
438440
fmat = bpy.data.materials.new(<span class="s">&quot;Studio&quot;</span>)
439441
fmat.use_nodes = <span class="k">True</span>
440442
fb = fmat.node_tree.nodes[<span class="s">&quot;Principled BSDF&quot;</span>]
441-
fb.inputs[<span class="s">&quot;Base Color&quot;</span>].default_value = (<span class="n">0.055</span>, <span class="n">0.06</span>, <span class="n">0.07</span>, <span class="n">1.0</span>)
442-
fb.inputs[<span class="s">&quot;Roughness&quot;</span>].default_value = <span class="n">0.5</span>
443+
fb.inputs[<span class="s">&quot;Base Color&quot;</span>].default_value = (<span class="n">0.03</span>, <span class="n">0.032</span>, <span class="n">0.037</span>, <span class="n">1.0</span>)
444+
fb.inputs[<span class="s">&quot;Roughness&quot;</span>].default_value = <span class="n">0.7</span>
443445
floor_me.materials.append(fmat)
444446
floor = bpy.data.objects.new(<span class="s">&quot;Floor&quot;</span>, floor_me)
445447
scene.collection.objects.link(floor)
@@ -450,7 +452,7 @@ <h2>Source</h2>
450452

451453
world = bpy.data.worlds.new(<span class="s">&quot;World&quot;</span>)
452454
world.use_nodes = <span class="k">True</span>
453-
world.node_tree.nodes[<span class="s">&quot;Background&quot;</span>].inputs[<span class="s">&quot;Color&quot;</span>].default_value = (<span class="n">0.008</span>, <span class="n">0.009</span>, <span class="n">0.012</span>, <span class="n">1.0</span>)
455+
world.node_tree.nodes[<span class="s">&quot;Background&quot;</span>].inputs[<span class="s">&quot;Color&quot;</span>].default_value = (<span class="n">0.02</span>, <span class="n">0.021</span>, <span class="n">0.025</span>, <span class="n">1.0</span>)
454456
scene.world = world
455457

456458
<span class="k">def</span> light(name, loc, energy, size, col, rot):
@@ -461,16 +463,26 @@ <h2>Source</h2>
461463
ob.rotation_euler = tuple(math.radians(a) <span class="k">for</span> a <span class="k">in</span> rot)
462464
scene.collection.objects.link(ob)
463465

464-
light(<span class="s">&quot;Key&quot;</span>, (-<span class="n">4.0</span>, -<span class="n">5.0</span>, <span class="n">6.5</span>), <span class="n">1400.0</span>, <span class="n">5.5</span>, (<span class="n">1.0</span>, <span class="n">0.98</span>, <span class="n">0.94</span>), (<span class="n">46</span>, <span class="n">0</span>, -<span class="n">35</span>))
466+
<span class="c"># a large soft key: at 5.5 m the glossy spheres mirrored it as a hard</span>
467+
<span class="c"># white square</span>
468+
light(<span class="s">&quot;Key&quot;</span>, (-<span class="n">4.0</span>, -<span class="n">5.0</span>, <span class="n">6.5</span>), <span class="n">1100.0</span>, <span class="n">9.0</span>, (<span class="n">1.0</span>, <span class="n">0.98</span>, <span class="n">0.94</span>), (<span class="n">46</span>, <span class="n">0</span>, -<span class="n">35</span>))
465469
light(<span class="s">&quot;Fill&quot;</span>, (<span class="n">5.5</span>, -<span class="n">4.0</span>, <span class="n">3.0</span>), <span class="n">280.0</span>, <span class="n">8.0</span>, (<span class="n">0.82</span>, <span class="n">0.88</span>, <span class="n">1.0</span>), (<span class="n">63</span>, <span class="n">0</span>, <span class="n">48</span>))
466470
light(<span class="s">&quot;Rim&quot;</span>, (<span class="n">0.5</span>, <span class="n">6.0</span>, <span class="n">4.0</span>), <span class="n">900.0</span>, <span class="n">3.5</span>, (<span class="n">1.0</span>, <span class="n">0.74</span>, <span class="n">0.46</span>), (-<span class="n">62</span>, <span class="n">0</span>, <span class="n">175</span>))
467471

468472
cam_data = bpy.data.cameras.new(<span class="s">&quot;Cam&quot;</span>)
469-
cam_data.lens = <span class="n">58.0</span>
473+
cam_data.lens = <span class="n">50.0</span>
470474
cam = bpy.data.objects.new(<span class="s">&quot;Cam&quot;</span>, cam_data)
471-
cam.location = (<span class="n">0.0</span>, -<span class="n">8.7</span>, <span class="n">2.6</span>)
472-
cam.rotation_euler = (math.radians(<span class="n">78</span>), <span class="n">0.0</span>, <span class="n">0.0</span>)
475+
cam.location = (<span class="n">0.0</span>, -<span class="n">8.4</span>, <span class="n">3.3</span>)
473476
scene.collection.objects.link(cam)
477+
<span class="c"># aim at the spheres&#x27; centres so they sit mid-frame, not above a band of</span>
478+
<span class="c"># empty floor</span>
479+
aim = bpy.data.objects.new(<span class="s">&quot;Aim&quot;</span>, <span class="k">None</span>)
480+
aim.location = (<span class="n">0.0</span>, <span class="n">0.0</span>, <span class="n">1.0</span>)
481+
scene.collection.objects.link(aim)
482+
track = cam.constraints.new(<span class="s">&#x27;TRACK_TO&#x27;</span>)
483+
track.target = aim
484+
track.track_axis = <span class="s">&#x27;TRACK_NEGATIVE_Z&#x27;</span>
485+
track.up_axis = <span class="s">&#x27;UP_Y&#x27;</span>
474486
scene.camera = cam
475487

476488
scene.render.engine = <span class="s">&#x27;CYCLES&#x27;</span> <span class="k">if</span> engine == <span class="s">&#x27;cycles&#x27;</span> <span class="k">else</span> eevee_engine_id()
@@ -485,6 +497,8 @@ <h2>Source</h2>
485497
scene.render.resolution_y = <span class="n">720</span>
486498
scene.render.image_settings.file_format = <span class="s">&#x27;PNG&#x27;</span>
487499
scene.render.filepath = path
500+
<span class="c"># AgX would wash both tints toward pastel (docs/VISUAL-STYLE.md)</span>
501+
scene.view_settings.view_transform = <span class="s">&#x27;Standard&#x27;</span>
488502
<span class="c"># Layer 1 framing gate (silhouette matte) — exit 10 on violation, before</span>
489503
<span class="c"># the beauty render so a defective composition ships no artifact.</span>
490504
fcode = gallery_framing.check_framing(

‎examples/shader-node-group/README.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ per-material Tint lives on the group **node**, not inside the group — set it i
1212
and every material changes at once. The render is the proof: two spheres, one group, two
1313
colors.
1414

15+
## Staging
16+
17+
The still renders under the Standard view transform on the dark house
18+
stage; it had no view transform set, so AgX washed both tints toward
19+
pastel over a lighter floor. The key is larger and softer (the glossy
20+
spheres had mirrored it as a hard white square), and the camera aims
21+
at the sphere centres. Render path only.
22+
1523
## Run
1624

1725
```bash
2.78 KB
Loading

‎examples/shader-node-group/shader_node_group.py‎

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ def render_still(objs, path, engine):
135135
fmat = bpy.data.materials.new("Studio")
136136
fmat.use_nodes = True
137137
fb = fmat.node_tree.nodes["Principled BSDF"]
138-
fb.inputs["Base Color"].default_value = (0.055, 0.06, 0.07, 1.0)
139-
fb.inputs["Roughness"].default_value = 0.5
138+
fb.inputs["Base Color"].default_value = (0.03, 0.032, 0.037, 1.0)
139+
fb.inputs["Roughness"].default_value = 0.7
140140
floor_me.materials.append(fmat)
141141
floor = bpy.data.objects.new("Floor", floor_me)
142142
scene.collection.objects.link(floor)
@@ -147,7 +147,7 @@ def render_still(objs, path, engine):
147147

148148
world = bpy.data.worlds.new("World")
149149
world.use_nodes = True
150-
world.node_tree.nodes["Background"].inputs["Color"].default_value = (0.008, 0.009, 0.012, 1.0)
150+
world.node_tree.nodes["Background"].inputs["Color"].default_value = (0.02, 0.021, 0.025, 1.0)
151151
scene.world = world
152152

153153
def light(name, loc, energy, size, col, rot):
@@ -158,16 +158,26 @@ def light(name, loc, energy, size, col, rot):
158158
ob.rotation_euler = tuple(math.radians(a) for a in rot)
159159
scene.collection.objects.link(ob)
160160

161-
light("Key", (-4.0, -5.0, 6.5), 1400.0, 5.5, (1.0, 0.98, 0.94), (46, 0, -35))
161+
# a large soft key: at 5.5 m the glossy spheres mirrored it as a hard
162+
# white square
163+
light("Key", (-4.0, -5.0, 6.5), 1100.0, 9.0, (1.0, 0.98, 0.94), (46, 0, -35))
162164
light("Fill", (5.5, -4.0, 3.0), 280.0, 8.0, (0.82, 0.88, 1.0), (63, 0, 48))
163165
light("Rim", (0.5, 6.0, 4.0), 900.0, 3.5, (1.0, 0.74, 0.46), (-62, 0, 175))
164166

165167
cam_data = bpy.data.cameras.new("Cam")
166-
cam_data.lens = 58.0
168+
cam_data.lens = 50.0
167169
cam = bpy.data.objects.new("Cam", cam_data)
168-
cam.location = (0.0, -8.7, 2.6)
169-
cam.rotation_euler = (math.radians(78), 0.0, 0.0)
170+
cam.location = (0.0, -8.4, 3.3)
170171
scene.collection.objects.link(cam)
172+
# aim at the spheres' centres so they sit mid-frame, not above a band of
173+
# empty floor
174+
aim = bpy.data.objects.new("Aim", None)
175+
aim.location = (0.0, 0.0, 1.0)
176+
scene.collection.objects.link(aim)
177+
track = cam.constraints.new('TRACK_TO')
178+
track.target = aim
179+
track.track_axis = 'TRACK_NEGATIVE_Z'
180+
track.up_axis = 'UP_Y'
171181
scene.camera = cam
172182

173183
scene.render.engine = 'CYCLES' if engine == 'cycles' else eevee_engine_id()
@@ -182,6 +192,8 @@ def light(name, loc, energy, size, col, rot):
182192
scene.render.resolution_y = 720
183193
scene.render.image_settings.file_format = 'PNG'
184194
scene.render.filepath = path
195+
# AgX would wash both tints toward pastel (docs/VISUAL-STYLE.md)
196+
scene.view_settings.view_transform = 'Standard'
185197
# Layer 1 framing gate (silhouette matte) — exit 10 on violation, before
186198
# the beauty render so a defective composition ships no artifact.
187199
fcode = gallery_framing.check_framing(

0 commit comments

Comments
 (0)