Skip to content

Commit f6d15c1

Browse files
committed
fix: redesign depsgraph-export with one teal hero material on both silhouettes
1 parent 6d6082f commit f6d15c1

5 files changed

Lines changed: 26 additions & 14 deletions

File tree

1.69 KB
Loading
492 KB
Loading

‎docs/gallery/depsgraph-export/index.html‎

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -287,11 +287,18 @@ <h2>Source</h2>
287287
<span class="s">&quot;&quot;&quot;Base cube beside its evaluated form — the two counts the check compares.&quot;&quot;&quot;</span>
288288
scene = bpy.context.scene
289289

290+
<span class="c"># one hero material on BOTH objects: the two silhouettes share a color so</span>
291+
<span class="c"># the only visible difference is the thing the check measures — base-mesh</span>
292+
<span class="c"># geometry versus the depsgraph-evaluated subsurf</span>
293+
hero = principled(<span class="s">&quot;Teal&quot;</span>, (<span class="n">0.012</span>, <span class="n">0.30</span>, <span class="n">0.34</span>, <span class="n">1.0</span>), <span class="n">0.0</span>, <span class="n">0.2</span>)
294+
290295
<span class="c"># left: the base mesh, modifier-free (a plain copy of the datablock)</span>
291296
base_obj = bpy.data.objects.new(<span class="s">&quot;Base&quot;</span>, obj.data.copy())
292297
base_obj.location = (-<span class="n">1.7</span>, <span class="n">0.0</span>, <span class="n">1.0</span>)
293-
base_obj.data.materials.append(
294-
principled(<span class="s">&quot;Graphite&quot;</span>, (<span class="n">0.09</span>, <span class="n">0.10</span>, <span class="n">0.12</span>, <span class="n">1.0</span>), <span class="n">0.0</span>, <span class="n">0.55</span>))
298+
<span class="c"># turned off camera-parallel so the key rakes the front face into a</span>
299+
<span class="c"># gradient instead of one flat tone</span>
300+
base_obj.rotation_euler = (<span class="n">0.0</span>, <span class="n">0.0</span>, math.radians(<span class="n">32</span>))
301+
base_obj.data.materials.append(hero)
295302
bpy.context.collection.objects.link(base_obj)
296303

297304
<span class="c"># right: the SUBSURF object — what the depsgraph evaluates and the OBJ ships.</span>
@@ -302,8 +309,7 @@ <h2>Source</h2>
302309
bottom = min(v.co.z <span class="k">for</span> v <span class="k">in</span> em.vertices)
303310
obj.evaluated_get(dg).to_mesh_clear()
304311
obj.location = (<span class="n">1.8</span>, <span class="n">0.0</span>, -bottom)
305-
obj.data.materials.append(
306-
principled(<span class="s">&quot;EvalGreen&quot;</span>, (<span class="n">0.03</span>, <span class="n">0.32</span>, <span class="n">0.10</span>, <span class="n">1.0</span>), <span class="n">0.0</span>, <span class="n">0.15</span>))
312+
obj.data.materials.append(hero)
307313
<span class="k">for</span> poly <span class="k">in</span> obj.data.polygons:
308314
poly.use_smooth = <span class="k">True</span>
309315

@@ -345,10 +351,10 @@ <h2>Source</h2>
345351
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>))
346352

347353
cam_data = bpy.data.cameras.new(<span class="s">&quot;Cam&quot;</span>)
348-
cam_data.lens = <span class="n">46.0</span>
354+
cam_data.lens = <span class="n">50.0</span>
349355
cam = bpy.data.objects.new(<span class="s">&quot;Cam&quot;</span>, cam_data)
350-
cam.location = (<span class="n">0.0</span>, -<span class="n">8.2</span>, <span class="n">2.7</span>)
351-
cam.rotation_euler = (math.radians(<span class="n">78</span>), <span class="n">0.0</span>, <span class="n">0.0</span>)
356+
cam.location = (<span class="n">0.0</span>, -<span class="n">7.4</span>, <span class="n">3.0</span>)
357+
cam.rotation_euler = (math.radians(<span class="n">76</span>), <span class="n">0.0</span>, <span class="n">0.0</span>)
352358
scene.collection.objects.link(cam)
353359
scene.camera = cam
354360

‎examples/depsgraph-export/depsgraph_export.py‎

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,18 @@ def render_still(obj, path, engine):
8282
"""Base cube beside its evaluated form — the two counts the check compares."""
8383
scene = bpy.context.scene
8484

85+
# one hero material on BOTH objects: the two silhouettes share a color so
86+
# the only visible difference is the thing the check measures — base-mesh
87+
# geometry versus the depsgraph-evaluated subsurf
88+
hero = principled("Teal", (0.012, 0.30, 0.34, 1.0), 0.0, 0.2)
89+
8590
# left: the base mesh, modifier-free (a plain copy of the datablock)
8691
base_obj = bpy.data.objects.new("Base", obj.data.copy())
8792
base_obj.location = (-1.7, 0.0, 1.0)
88-
base_obj.data.materials.append(
89-
principled("Graphite", (0.09, 0.10, 0.12, 1.0), 0.0, 0.55))
93+
# turned off camera-parallel so the key rakes the front face into a
94+
# gradient instead of one flat tone
95+
base_obj.rotation_euler = (0.0, 0.0, math.radians(32))
96+
base_obj.data.materials.append(hero)
9097
bpy.context.collection.objects.link(base_obj)
9198

9299
# right: the SUBSURF object — what the depsgraph evaluates and the OBJ ships.
@@ -97,8 +104,7 @@ def render_still(obj, path, engine):
97104
bottom = min(v.co.z for v in em.vertices)
98105
obj.evaluated_get(dg).to_mesh_clear()
99106
obj.location = (1.8, 0.0, -bottom)
100-
obj.data.materials.append(
101-
principled("EvalGreen", (0.03, 0.32, 0.10, 1.0), 0.0, 0.15))
107+
obj.data.materials.append(hero)
102108
for poly in obj.data.polygons:
103109
poly.use_smooth = True
104110

@@ -140,10 +146,10 @@ def light(name, loc, energy, size, col, rot):
140146
light("Wedge", (2.5, 5.5, 4.0), 380.0, 6.0, (1.0, 0.76, 0.5), (-68, 0, 190))
141147

142148
cam_data = bpy.data.cameras.new("Cam")
143-
cam_data.lens = 46.0
149+
cam_data.lens = 50.0
144150
cam = bpy.data.objects.new("Cam", cam_data)
145-
cam.location = (0.0, -8.2, 2.7)
146-
cam.rotation_euler = (math.radians(78), 0.0, 0.0)
151+
cam.location = (0.0, -7.4, 3.0)
152+
cam.rotation_euler = (math.radians(76), 0.0, 0.0)
147153
scene.collection.objects.link(cam)
148154
scene.camera = cam
149155

1.59 KB
Loading

0 commit comments

Comments
 (0)