mikedh / trimesh

Python library for loading and using triangular meshes.
https://trimesh.org
MIT License
3.01k stars 582 forks source link

possible error for scipy?? #1442

Closed lucasjinreal closed 2 years ago

lucasjinreal commented 2 years ago
smplifyx\mesh_viewer.py", line 80, in create_mesh
    return self.trimesh_to_pymesh(mesh, material=material)
  File "C:\ProgramData\Anaconda3\lib\site-packages\pyrender\mesh.py", line 202, in from_trimesh
    normals = m.vertex_normals.copy()
  File "C:\ProgramData\Anaconda3\lib\site-packages\trimesh\caching.py", line 109, in get_cached
    value = function(*args, **kwargs)
  File "C:\ProgramData\Anaconda3\lib\site-packages\trimesh\base.py", line 473, in vertex_normals
    assert hasattr(self.faces_sparse, 'dot')
  File "C:\ProgramData\Anaconda3\lib\site-packages\trimesh\caching.py", line 109, in get_cached
    value = function(*args, **kwargs)
  File "C:\ProgramData\Anaconda3\lib\site-packages\trimesh\base.py", line 326, in faces_sparse
    sparse = geometry.index_sparse(
  File "C:\ProgramData\Anaconda3\lib\site-packages\trimesh\geometry.py", line 450, in index_sparse
    matrix = scipy.sparse.coo_matrix((data, (row, col)),
  File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\sparse\coo.py", line 196, in __init__
    self._check()
  File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\sparse\coo.py", line 283, in _check
    raise ValueError('row index exceeds matrix dimensions')
ValueError: row index exceeds matrix dimensions
mikedh commented 2 years ago

That's weird! Looks like the vertex normals are failing; what is mesh.vertices.shape and mesh.faces.shape? If you run mesh.process(validate=True) first (which will remove degenerate faces and do some other cleanup) does this still occur?

lucasjinreal commented 2 years ago

@mikedh I found it was caused by torchgeometry some func API changed, it seems torchgeometry move into kornia, but their api need one less dimension input caused dimension fails.