Open FreakTheMighty opened 2 years ago
Based on the docs, it sounds like the normals are calculated relative to some bounding volume...
These tools will recalculate the normals of selected faces so that they point outside (respectively inside) the volume that the face belongs to. The volume does not need to be closed; inside and outside are determined by the angles with adjacent faces. This means that the face of interest must be adjacent to at least one non-coplanar other face. For example, with a Grid primitive, recalculating normals does not have a meaningful result.
Hey, m.fix_normals
might be what you're looking for:
In [10]: m.fix_normals?
Signature: m.fix_normals(*args, **kwargs)
Docstring:
Find and fix problems with self.face_normals and self.faces
winding direction.
For face normals ensure that vectors are consistently pointed
outwards, and that self.faces is wound in the correct direction
for all connected components.
Parameters
-------------
multibody : None or bool
Fix normals across multiple bodies
if None automatically pick from body_count
File: ~/trimesh/trimesh/constants.py
Type: method
Hi @mikedh thanks for the comment, unfortunately that is what I was using, I guess I called out fix_inversion
cause of the two "fixes" in fix_normals
that seemed to be the one I was interested in.
Gotcha fix_winding
should make the normals consistently pointed though (i.e. not multicolored like your picture)?
I've attached a glb with a some normals that are inverted. I'd like to use
fix_inversion
but the docs note this only works with water tight meshes. In blender, however, there is a function "Recalculate Outside" that sounds very similar tofix_inversion
, but works as expected. I'm curious if there is someway to add such support to Trimesh?example.zip