Skip to content

Commit 6f6221e

Browse files
committed
fix: give bmesh-gear a machined-brass hero material with concentric turning marks
1 parent 15ebadb commit 6f6221e

6 files changed

Lines changed: 52 additions & 16 deletions

File tree

‎README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ non-destructive path.
176176
<table>
177177
<tr>
178178
<td width="46%" valign="middle">
179-
<a href="examples/bmesh-gear/"><img src="examples/bmesh-gear/preview.webp" alt="Bmesh gear: a machined steel 14-tooth gear at a three-quarter angle on a dark studio floor" /></a>
179+
<a href="examples/bmesh-gear/"><img src="examples/bmesh-gear/preview.webp" alt="Bmesh gear: a machined brass 14-tooth gear with concentric turning marks catching the light, tilted at a three-quarter angle on a dark studio floor" /></a>
180180
</td>
181181
<td valign="middle">
182182

@@ -251,7 +251,7 @@ semver on LTS builds (`"4.5.11 LTS"`), and that a Mesh reference dies at
251251
</tr>
252252
<tr>
253253
<td width="46%" valign="middle">
254-
<a href="examples/depsgraph-export/"><img src="examples/depsgraph-export/preview.webp" alt="Depsgraph-evaluated export: a matte graphite base cube beside its glossy green subdivision-surface evaluated form on a dark studio floor" /></a>
254+
<a href="examples/depsgraph-export/"><img src="examples/depsgraph-export/preview.webp" alt="Depsgraph-evaluated export: a teal base cube beside the smooth teal sphere of its subdivision-surface evaluated form - one shared material, two silhouettes - on a dark studio floor with a warm light pool behind" /></a>
255255
</td>
256256
<td valign="middle">
257257

23.4 KB
Loading

‎docs/gallery/bmesh-gear/index.html‎

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -295,15 +295,31 @@ <h2>Source</h2>
295295
scene = bpy.context.scene
296296
<span class="k">for</span> poly <span class="k">in</span> obj.data.polygons:
297297
poly.use_smooth = <span class="k">False</span> <span class="c"># crisp machined facets</span>
298-
mat = bpy.data.materials.new(<span class="s">&quot;Steel&quot;</span>)
298+
<span class="c"># machined brass: a flat metal face lit by area lights renders as one</span>
299+
<span class="c"># featureless gradient, so the finish carries the design — concentric</span>
300+
<span class="c"># turning marks (a RINGS wave driving roughness) break the face into</span>
301+
<span class="c"># rings that each catch the key at a different angle</span>
302+
mat = bpy.data.materials.new(<span class="s">&quot;MachinedBrass&quot;</span>)
299303
mat.use_nodes = <span class="k">True</span>
300-
bsdf = mat.node_tree.nodes[<span class="s">&quot;Principled BSDF&quot;</span>]
301-
bsdf.inputs[<span class="s">&quot;Base Color&quot;</span>].default_value = (<span class="n">0.75</span>, <span class="n">0.77</span>, <span class="n">0.8</span>, <span class="n">1.0</span>)
304+
nt = mat.node_tree
305+
bsdf = nt.nodes[<span class="s">&quot;Principled BSDF&quot;</span>]
306+
bsdf.inputs[<span class="s">&quot;Base Color&quot;</span>].default_value = (<span class="n">0.72</span>, <span class="n">0.44</span>, <span class="n">0.16</span>, <span class="n">1.0</span>)
302307
bsdf.inputs[<span class="s">&quot;Metallic&quot;</span>].default_value = <span class="n">1.0</span>
303-
bsdf.inputs[<span class="s">&quot;Roughness&quot;</span>].default_value = <span class="n">0.45</span>
308+
rings = nt.nodes.new(<span class="s">&quot;ShaderNodeTexWave&quot;</span>)
309+
rings.wave_type = <span class="s">&#x27;RINGS&#x27;</span>
310+
rings.rings_direction = <span class="s">&#x27;SPHERICAL&#x27;</span> <span class="c"># concentric from center, not X-axis bands</span>
311+
rings.inputs[<span class="s">&quot;Scale&quot;</span>].default_value = <span class="n">16.0</span>
312+
rings.inputs[<span class="s">&quot;Distortion&quot;</span>].default_value = <span class="n">0.5</span>
313+
rough = nt.nodes.new(<span class="s">&quot;ShaderNodeMapRange&quot;</span>)
314+
rough.inputs[<span class="s">&quot;From Min&quot;</span>].default_value = <span class="n">0.0</span>
315+
rough.inputs[<span class="s">&quot;From Max&quot;</span>].default_value = <span class="n">1.0</span>
316+
rough.inputs[<span class="s">&quot;To Min&quot;</span>].default_value = <span class="n">0.14</span>
317+
rough.inputs[<span class="s">&quot;To Max&quot;</span>].default_value = <span class="n">0.36</span>
318+
nt.links.new(rings.outputs[<span class="s">&quot;Fac&quot;</span>], rough.inputs[<span class="s">&quot;Value&quot;</span>])
319+
nt.links.new(rough.outputs[<span class="s">&quot;Result&quot;</span>], bsdf.inputs[<span class="s">&quot;Roughness&quot;</span>])
304320
obj.data.materials.append(mat)
305321
obj.location = (<span class="n">0.0</span>, <span class="n">0.0</span>, <span class="n">0.85</span>)
306-
obj.rotation_euler = (math.radians(<span class="n">38</span>), <span class="n">0.0</span>, math.radians(<span class="n">22</span>))
322+
obj.rotation_euler = (math.radians(<span class="n">46</span>), <span class="n">0.0</span>, math.radians(<span class="n">22</span>))
307323

308324
floor_me = bpy.data.meshes.new(<span class="s">&quot;Floor&quot;</span>)
309325
bm = bmesh.new()
@@ -341,9 +357,11 @@ <h2>Source</h2>
341357

342358
<span class="c"># metals live on reflections: soft warm key, restrained cool fill, and the</span>
343359
<span class="c"># warm wedge raking the back wall (docs/VISUAL-STYLE.md)</span>
344-
light(<span class="s">&quot;Key&quot;</span>, (-<span class="n">3.5</span>, -<span class="n">4.5</span>, <span class="n">5.5</span>), <span class="n">700.0</span>, <span class="n">6.0</span>, (<span class="n">1.0</span>, <span class="n">0.96</span>, <span class="n">0.9</span>), (<span class="n">48</span>, <span class="n">0</span>, -<span class="n">35</span>))
345-
light(<span class="s">&quot;Fill&quot;</span>, (<span class="n">5.0</span>, -<span class="n">3.5</span>, <span class="n">2.5</span>), <span class="n">160.0</span>, <span class="n">9.0</span>, (<span class="n">0.75</span>, <span class="n">0.85</span>, <span class="n">1.0</span>), (<span class="n">65</span>, <span class="n">0</span>, <span class="n">50</span>))
360+
light(<span class="s">&quot;Key&quot;</span>, (-<span class="n">3.5</span>, -<span class="n">4.5</span>, <span class="n">5.5</span>), <span class="n">550.0</span>, <span class="n">4.5</span>, (<span class="n">1.0</span>, <span class="n">0.96</span>, <span class="n">0.9</span>), (<span class="n">48</span>, <span class="n">0</span>, -<span class="n">35</span>))
361+
light(<span class="s">&quot;Fill&quot;</span>, (<span class="n">5.0</span>, -<span class="n">3.5</span>, <span class="n">2.5</span>), <span class="n">130.0</span>, <span class="n">9.0</span>, (<span class="n">0.75</span>, <span class="n">0.85</span>, <span class="n">1.0</span>), (<span class="n">65</span>, <span class="n">0</span>, <span class="n">50</span>))
346362
light(<span class="s">&quot;Wedge&quot;</span>, (<span class="n">2.5</span>, <span class="n">5.5</span>, <span class="n">4.0</span>), <span class="n">380.0</span>, <span class="n">6.0</span>, (<span class="n">1.0</span>, <span class="n">0.76</span>, <span class="n">0.5</span>), (-<span class="n">68</span>, <span class="n">0</span>, <span class="n">190</span>))
363+
<span class="c"># a small hot glint: brass needs one crisp specular streak to read machined</span>
364+
light(<span class="s">&quot;Glint&quot;</span>, (<span class="n">1.8</span>, -<span class="n">5.2</span>, <span class="n">6.2</span>), <span class="n">900.0</span>, <span class="n">0.9</span>, (<span class="n">1.0</span>, <span class="n">0.9</span>, <span class="n">0.7</span>), (<span class="n">40</span>, <span class="n">0</span>, <span class="n">18</span>))
347365

348366
cam_data = bpy.data.cameras.new(<span class="s">&quot;Cam&quot;</span>)
349367
cam_data.lens = <span class="n">55.0</span>
566 KB
Loading

‎examples/bmesh-gear/bmesh_gear.py‎

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,31 @@ def render_still(obj, path, engine):
9393
scene = bpy.context.scene
9494
for poly in obj.data.polygons:
9595
poly.use_smooth = False # crisp machined facets
96-
mat = bpy.data.materials.new("Steel")
96+
# machined brass: a flat metal face lit by area lights renders as one
97+
# featureless gradient, so the finish carries the design — concentric
98+
# turning marks (a RINGS wave driving roughness) break the face into
99+
# rings that each catch the key at a different angle
100+
mat = bpy.data.materials.new("MachinedBrass")
97101
mat.use_nodes = True
98-
bsdf = mat.node_tree.nodes["Principled BSDF"]
99-
bsdf.inputs["Base Color"].default_value = (0.75, 0.77, 0.8, 1.0)
102+
nt = mat.node_tree
103+
bsdf = nt.nodes["Principled BSDF"]
104+
bsdf.inputs["Base Color"].default_value = (0.72, 0.44, 0.16, 1.0)
100105
bsdf.inputs["Metallic"].default_value = 1.0
101-
bsdf.inputs["Roughness"].default_value = 0.45
106+
rings = nt.nodes.new("ShaderNodeTexWave")
107+
rings.wave_type = 'RINGS'
108+
rings.rings_direction = 'SPHERICAL' # concentric from center, not X-axis bands
109+
rings.inputs["Scale"].default_value = 16.0
110+
rings.inputs["Distortion"].default_value = 0.5
111+
rough = nt.nodes.new("ShaderNodeMapRange")
112+
rough.inputs["From Min"].default_value = 0.0
113+
rough.inputs["From Max"].default_value = 1.0
114+
rough.inputs["To Min"].default_value = 0.14
115+
rough.inputs["To Max"].default_value = 0.36
116+
nt.links.new(rings.outputs["Fac"], rough.inputs["Value"])
117+
nt.links.new(rough.outputs["Result"], bsdf.inputs["Roughness"])
102118
obj.data.materials.append(mat)
103119
obj.location = (0.0, 0.0, 0.85)
104-
obj.rotation_euler = (math.radians(38), 0.0, math.radians(22))
120+
obj.rotation_euler = (math.radians(46), 0.0, math.radians(22))
105121

106122
floor_me = bpy.data.meshes.new("Floor")
107123
bm = bmesh.new()
@@ -139,9 +155,11 @@ def light(name, loc, energy, size, col, rot):
139155

140156
# metals live on reflections: soft warm key, restrained cool fill, and the
141157
# warm wedge raking the back wall (docs/VISUAL-STYLE.md)
142-
light("Key", (-3.5, -4.5, 5.5), 700.0, 6.0, (1.0, 0.96, 0.9), (48, 0, -35))
143-
light("Fill", (5.0, -3.5, 2.5), 160.0, 9.0, (0.75, 0.85, 1.0), (65, 0, 50))
158+
light("Key", (-3.5, -4.5, 5.5), 550.0, 4.5, (1.0, 0.96, 0.9), (48, 0, -35))
159+
light("Fill", (5.0, -3.5, 2.5), 130.0, 9.0, (0.75, 0.85, 1.0), (65, 0, 50))
144160
light("Wedge", (2.5, 5.5, 4.0), 380.0, 6.0, (1.0, 0.76, 0.5), (-68, 0, 190))
161+
# a small hot glint: brass needs one crisp specular streak to read machined
162+
light("Glint", (1.8, -5.2, 6.2), 900.0, 0.9, (1.0, 0.9, 0.7), (40, 0, 18))
145163

146164
cam_data = bpy.data.cameras.new("Cam")
147165
cam_data.lens = 55.0

‎examples/bmesh-gear/preview.webp‎

21.1 KB
Loading

0 commit comments

Comments
 (0)