Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trimesh 3.9.33 test regression #203

Open
traversaro opened this issue Nov 29, 2021 · 5 comments · May be fixed by #216
Open

trimesh 3.9.33 test regression #203

traversaro opened this issue Nov 29, 2021 · 5 comments · May be fixed by #216

Comments

@traversaro
Copy link

Since trimesh 3.9.33 (I tested with pip, and trimesh 3.9.32 works fine) the test_meshes.py test fails with error:

        bm = trimesh.load('tests/data/WaterBottle.glb').dump()[0]
        x = Mesh.from_trimesh(bm)
        assert x.primitives[0].material.baseColorTexture is not None
>       assert x.primitives[0].material.emissiveTexture is not None
E       assert None is not None
E        +  where None = <pyrender.material.MetallicRoughnessMaterial object at 0x7fa1a0e760a0>.emissiveTexture
E        +    where <pyrender.material.MetallicRoughnessMaterial object at 0x7fa1a0e760a0> = <pyrender.primitive.Primitive object at 0x7fa1a0e76130>.material

tests/unit/test_meshes.py:121: AssertionError
@mikedh
Copy link

mikedh commented Dec 16, 2021

Hey, is this still happening? Checking on my local machine it looks OK:

n [4]: m = trimesh.load('/home/mikedh/Downloads/WaterBottle.glb')
primitive has no mode! trying GL_TRIANGLES?

In [5]: m
Out[5]: <trimesh.Scene(len(geometry)=1)>

In [9]: m.geometry
Out[9]: 
OrderedDict([('WaterBottle',
              <trimesh.Trimesh(vertices.shape=(2549, 3), faces.shape=(4510, 3))>)])

In [10]: m.geometry['WaterBottle'].visual.material
Out[10]: <trimesh.visual.material.PBRMaterial at 0x7f66ab235520>

In [11]: mat = m.geometry['WaterBottle'].visual.material

In [12]: mat._data
Out[12]: 
{'emissiveFactor': array([1., 1., 1.]),
 'baseColorTexture': <PIL.PngImagePlugin.PngImageFile image mode=RGB size=2048x2048 at 0x7F66AB240A30>,
 'doubleSided': False}

In [13]: mat.emissiveFactor
Out[13]: array([1., 1., 1.])

In [14]: mat.emissiveTexture
Out[14]: <PIL.PngImagePlugin.PngImageFile image mode=RGB size=2048x2048 at 0x7F66A31BA130>

Is it possible the runner is missing pillow, which would be required to load the texture?

@traversaro
Copy link
Author

I missed the reply @mikedh ! I will trigger a new build in conda-forge/pyrender-feedstock#2 to check.

@eyllanesc
Copy link

@traversaro I reproduce the same thing on my local machine and also on GitHub Workflow (See #216)

@eyllanesc
Copy link

I was debugging code and found the following behavior change:

import trimesh

print(trimesh.__version__)

bm = trimesh.load("tests/data/WaterBottle.glb").dump()[0]
print(bm.visual.material.emissiveTexture)
  • trimesh 3.9.32

    3.9.32
    primitive has no mode! trying GL_TRIANGLES?
    <PIL.Image.Image image mode=RGB size=2048x2048 at 0x7F385EAFACD0>
  • trimesh 3.9.33

    3.9.33
    primitive has no mode! trying GL_TRIANGLES?
    None

eyllanesc added a commit to eyllanesc/pyrender that referenced this issue Mar 18, 2022
@eyllanesc eyllanesc linked a pull request Mar 18, 2022 that will close this issue
8 tasks
@eyllanesc
Copy link

eyllanesc commented Mar 18, 2022

@mikedh Your analysis helped me a lot. It seems that the dump method has changed in trimesh 3.9.33 so it does not take into account some materials. So I have changed the test based on your code which is in my PR #216.

Also note that prior to 3.9.33 emissive Texture was of type PIL.Image.Image but is now PIL.PngImagePlugin.PngImageFile. It can be a starting point to know the effects of the changes introduced in 3.9.33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants