Repository navigation
Assets: preserve glTF material defaults during GLB import - #6283
Conversation
|
Independent AI-assisted Windows CPU check of In the combined output all three embedded PNG slots were byte-identical to input. Base-color alpha decoded to 0, 64, 160, 255. All three UV pairs, the material and image references, implicit/explicit |
|
Tested
AI-assisted. |
shayderrr
left a comment
There was a problem hiding this comment.
Summary
read_glb_parts() now applies glTF's PBR defaults (baseColorFactor [1,1,1,1], metallicFactor 1, roughnessFactor 1) when factors are omitted, including for primitives with no material reference via a synthesized {name: ..._mat} entry. Explicit factors, alpha fields, per-primitive names/order, JSON/OBJ clay defaults, and out-of-range material indices keep their behavior. tests/test_ped_glb_material_defaults.py drives the real writer, importer, and CLI through eight omission variants and byte-compares output to the explicit-all-one control.
Why merge
Removes importer-side color/metallic/roughness drift on otherwise valid GLBs; coverage spans both the Python API and CLI and locks legacy input formats to their existing clay defaults.
Verdict: Approve
Summary
Why mergeRemoves importer-side color/metallic/roughness drift on otherwise valid GLBs; coverage spans both the Python API and CLI and locks legacy input formats to their existing clay defaults. Verdict: Approve |
Problem
Valid GLB inputs can omit PBR factors or a material reference. The importer substitutes its clay defaults, changing color, metallic response and roughness even though assembly succeeds. The glTF defaults are baseColorFactor
[1, 1, 1, 1], metallicFactor1and roughnessFactor1.Change
Use those defaults in the GLB material-construction path, including the specified default material for primitives without a material reference. Explicit factors and alpha fields, per-primitive names, and JSON/OBJ clay defaults keep their existing behavior.
Claim: #6214 (comment)
The literal expectations follow the pinned Khronos PBR schema and default-material rule.
Validation
561b65a8produce 20 failures; explicit-factor and legacy-format controls pass there.ffc26593, BUILD-1975: Bound transient GLB import allocations #61190c783978, ASSET-505: Preserve static GLB node transforms during ped import #60370afc7914, ped_assemble: guard output paths and report I/O or JSON errors with exit 2 #5764f9e2ff3e, ped_assemble: a malformed GLB is one ERROR line and exit 2, not a traceback #59997f17f7f6, ASSET-522: Preserve GLB strip and fan topology #619982d19e3cand BUILD-2045: Apply sparse glTF attributes and indices when assembling GLB parts #62083d2f4eda. Published tests are unchanged, including BUILD-2045: Apply sparse glTF attributes and indices when assembling GLB parts #6208's updated malformed-input controls. The source patch applies cleanly by three-way merge to each exact head; this fix adds no dependency on them.Windows, Python 3.14, CPU only. All fixtures are synthetic; no game files or GPU runs. AI-assisted: yes.