trimesh icon indicating copy to clipboard operation
trimesh copied to clipboard

fix export PBR alphaMode seperated from alphaCutoff

Open LHolst opened this issue 2 years ago • 4 comments

When importing a glb file that contained PBR materials with BLEND alpha mode and exporting the scene with file_type='glb', the exported material had no alpha mode set.

PR fixes the export for materials with alphaMode and unset alphaCutoff. Previously, the export of alphaMode was dependent on a defined alphaCutoff:

  • alphaMode 'BLEND'
  • alphaCutoff None

if alphaCutoff is None leading to alphaMode not exporting at all.

partially reverting bbed0734ea6ef4d15f647784c3cd4726fc385e59

LHolst avatar Aug 11 '22 08:08 LHolst

Thanks for the PR! Would you be able to add a quick test that roundtrips some test data and asserts that it did the right thing?

mikedh avatar Aug 11 '22 16:08 mikedh

i'm getting warm with the tests, and i'll try to add a test for exporting gltf files with alphaMode / alphaCutoff settings

LHolst avatar Aug 12 '22 06:08 LHolst

added test_alphamode and used the python setup.py --format command

used Model comes from https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/AlphaBlendModeTest

LHolst avatar Aug 12 '22 07:08 LHolst

Awesome thanks for the fix and test!

mikedh avatar Aug 12 '22 17:08 mikedh