pytorch3d icon indicating copy to clipboard operation
pytorch3d copied to clipboard

is there any undocumented function to recalculate the face normals for consistency?

Open xiaoxTM opened this issue 4 years ago • 2 comments

🚀 Feature

recalculate the face normals for consistency NOTE: Please look at the existing list of Issues tagged with the label 'enhancement`. Only open a new issue if you do not see your feature request there.

Motivation

sometimes there are wrong ordered face indices in mesh files (e.g., OFF file store vertex index to represent face). Directly rendering them generates wrong images that have non-interpolation-like texture. It will be great if there are functions to make the face normals consistent (i.e., all pointing outside or inside of a object), so that the rendered images have better looks.

Pitch

the function may looks like:

meshes.make_face_normals_consistency()

NOTE: we only consider adding new features if they are useful for many users.

xiaoxTM avatar Dec 24 '20 04:12 xiaoxTM

I would really love this as well. Is there a common way to do this "manually" with PyTorch3D's Mesh objects?

russelldc avatar Sep 14 '21 18:09 russelldc

you could load the file via python library trimesh and then use the function trimesh.repair.fix_inversion and then convert trimesh to pytorch3d mesh

martinpflaum avatar Nov 04 '21 12:11 martinpflaum