Skip to content

Commit 51aadb9

Browse files
committed
fix: legibilize gltf-export-roundtrip labels at thumbnail scale
The AUTHORED and ROUND-TRIP plaques are the render's argument, but the dark metallic text vanished at thumbnail. Diffuse light-grey material and larger type keep the round-trip story readable at 320x180. Render-path only; the check's closed forms and measured values are unchanged and re-verified on 5.1.2 and 4.5.11. README gains the pipeline-arc reference. Signed-off-by: fOuttaMyPaint <TMhospitalitystrategies@gmail.com>
1 parent 041f49f commit 51aadb9

5 files changed

Lines changed: 16 additions & 8 deletions

File tree

2.04 KB
Loading

‎docs/gallery/gltf-export-roundtrip/index.html‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ <h1>gltf-export-roundtrip</h1>
184184
</div>
185185
<section class="detail-section md">
186186
<p>A runnable example that builds a sci-fi supply crate — 35 beveled box shells with three material slots and box-mapped UVs — exports it with <code>bpy.ops.export_scene.gltf</code>, parses the file on disk, re-imports it, and verifies the whole round-trip against the depsgraph-evaluated mesh, following <a href="https://github.com/TMHSDigital/Blender-Developer-Tools/tree/main/skills/depsgraph-and-evaluated-data/SKILL.md"><code>depsgraph-and-evaluated-data</code></a> and <a href="https://github.com/TMHSDigital/Blender-Developer-Tools/tree/main/skills/headless-batch-scripting/SKILL.md"><code>headless-batch-scripting</code></a>.</p>
187+
<p><strong>Pipeline arc:</strong> modeling/LOD in <a href="https://github.com/TMHSDigital/Blender-Developer-Tools/tree/main/examples/lod-decimate-chain"><code>lod-decimate-chain</code></a>, weighting in <a href="https://github.com/TMHSDigital/Blender-Developer-Tools/tree/main/examples/vertex-weight-limit"><code>vertex-weight-limit</code></a>, export here.</p>
187188
<p><strong>What it witnesses:</strong> the interchange contracts AI-generated export code most often gets silently wrong.</p>
188189
<p>1. <strong>The +Y-up convention is baked into vertex data.</strong> glTF is +Y-up, Blender is +Z-up, and <code>export_yup=True</code> (the default) writes <code>(x, y, z) -&gt; (x, z, -y)</code> directly into the POSITION buffer — the node carries <strong>no</strong> rotation or scale. The check parses the <code>.gltf</code> JSON and asserts the accessor bounds equal the axis-converted evaluated bounding box, and that the node transform is absent. Exporting with <code>export_yup=False</code> ships raw Z-up data every engine displays lying on its back. 2. <strong><code>export_apply=True</code> ships the evaluated mesh, not the base cage.</strong> The crate&#x27;s bevel modifier lives only in the depsgraph; with flat shading and UV seams the exporter splits exactly one vertex per evaluated loop (7,560), so the on-disk POSITION count is an exact witness. <code>export_apply=False</code> silently writes the 624-vertex cage. 3. <strong>The round-trip is faithful.</strong> Re-imported positions (bit-exact here), loop normals (≤2e-4), box-mapped UVs (≤3e-5), and per-triangle material bindings all match the evaluated mesh. UVs are V-flipped on disk (glTF texture origin is top-left) and flipped back on import — both flips are proven by reading the <code>.bin</code> buffer directly.</p>
189190
<p><strong>Version witness (probed on Blender 4.5.11 LTS and 5.1.2):</strong> the operator signatures are byte-identical — 109 exporter properties, 20 importer properties, same defaults — and the exported JSON differs only in <code>asset.generator</code> (&quot;Khronos glTF Blender I/O v4.5.51&quot; vs &quot;v5.1.20&quot;). The example therefore runs identical kwargs on both versions and guards forward drift explicitly: every kwarg it passes must still exist in the operator&#x27;s RNA, so a future rename fails loudly instead of drifting silently. One genuine 5.x removal surfaced during authoring: <code>Mesh.calc_normals()</code> is gone (loop normals auto-compute on read) — calling it is itself a cross-version hazard, noted in the code.</p>
@@ -680,15 +681,17 @@ <h2>Source</h2>
680681
pm = bpy.data.materials.new(<span class="s">&quot;PlaqueMetal&quot;</span>)
681682
pm.use_nodes = <span class="k">True</span>
682683
pb = pm.node_tree.nodes[<span class="s">&quot;Principled BSDF&quot;</span>]
683-
pb.inputs[<span class="s">&quot;Base Color&quot;</span>].default_value = (<span class="n">0.16</span>, <span class="n">0.17</span>, <span class="n">0.19</span>, <span class="n">1.0</span>)
684-
pb.inputs[<span class="s">&quot;Metallic&quot;</span>].default_value = <span class="n">0.9</span>
685-
pb.inputs[<span class="s">&quot;Roughness&quot;</span>].default_value = <span class="n">0.3</span>
684+
<span class="c"># diffuse light-grey, not metal: the AUTHORED/ROUND-TRIP labels are the</span>
685+
<span class="c"># render&#x27;s argument and must survive thumbnail scale on the dark floor</span>
686+
pb.inputs[<span class="s">&quot;Base Color&quot;</span>].default_value = (<span class="n">0.42</span>, <span class="n">0.44</span>, <span class="n">0.48</span>, <span class="n">1.0</span>)
687+
pb.inputs[<span class="s">&quot;Metallic&quot;</span>].default_value = <span class="n">0.2</span>
688+
pb.inputs[<span class="s">&quot;Roughness&quot;</span>].default_value = <span class="n">0.6</span>
686689

687690
<span class="k">def</span> plaque(text, x):
688691
cu = bpy.data.curves.new(<span class="s">&quot;Plaque&quot;</span>, <span class="s">&#x27;FONT&#x27;</span>)
689692
cu.body = text
690693
cu.align_x = <span class="s">&#x27;CENTER&#x27;</span>
691-
cu.size = <span class="n">0.24</span>
694+
cu.size = <span class="n">0.30</span>
692695
cu.extrude = <span class="n">0.008</span>
693696
ob = bpy.data.objects.new(<span class="s">&quot;Plaque&quot;</span>, cu)
694697
ob.location = (x, -<span class="n">1.55</span>, <span class="n">0.01</span>)

‎examples/gltf-export-roundtrip/README.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ the whole round-trip against the depsgraph-evaluated mesh, following
77
[`depsgraph-and-evaluated-data`](../../skills/depsgraph-and-evaluated-data/SKILL.md)
88
and [`headless-batch-scripting`](../../skills/headless-batch-scripting/SKILL.md).
99

10+
**Pipeline arc:** modeling/LOD in [`lod-decimate-chain`](../lod-decimate-chain/),
11+
weighting in [`vertex-weight-limit`](../vertex-weight-limit/), export here.
12+
1013
**What it witnesses:** the interchange contracts AI-generated export code most
1114
often gets silently wrong.
1215

‎examples/gltf-export-roundtrip/gltf_export_roundtrip.py‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -474,15 +474,17 @@ def render_still(authored, roundtrip, path, engine):
474474
pm = bpy.data.materials.new("PlaqueMetal")
475475
pm.use_nodes = True
476476
pb = pm.node_tree.nodes["Principled BSDF"]
477-
pb.inputs["Base Color"].default_value = (0.16, 0.17, 0.19, 1.0)
478-
pb.inputs["Metallic"].default_value = 0.9
479-
pb.inputs["Roughness"].default_value = 0.3
477+
# diffuse light-grey, not metal: the AUTHORED/ROUND-TRIP labels are the
478+
# render's argument and must survive thumbnail scale on the dark floor
479+
pb.inputs["Base Color"].default_value = (0.42, 0.44, 0.48, 1.0)
480+
pb.inputs["Metallic"].default_value = 0.2
481+
pb.inputs["Roughness"].default_value = 0.6
480482

481483
def plaque(text, x):
482484
cu = bpy.data.curves.new("Plaque", 'FONT')
483485
cu.body = text
484486
cu.align_x = 'CENTER'
485-
cu.size = 0.24
487+
cu.size = 0.30
486488
cu.extrude = 0.008
487489
ob = bpy.data.objects.new("Plaque", cu)
488490
ob.location = (x, -1.55, 0.01)
1.55 KB
Loading

0 commit comments

Comments
 (0)