How do I force pytorch to calculate/import and incorporate normals when fitting the source to the target.
In my case, both the source and the target objs are somewhat similar and can draw upon normal values to guide fitting.
Any pointers?
Thank you
The chamfer loss accepts both xyz point positions as well as normals and returns a loss for both.
In the demo, we sample 5k points from the surface of the mesh using the sample_points_from_meshes function. This has a boolean argument which you can set return_normals=True (default is False) in order to get the normals for the sampled points.
In the optimization loop you can modify the sampling and chamfer loss section as follows:
# We sample 5k points and normals from the surface of each mesh
sample_trg, normals_trg = sample_points_from_meshes(trg_mesh, 5000, return_normals=True)
sample_src, normals_src = sample_points_from_meshes(new_src_mesh, 5000, return_normals=True)
# We compare the two sets of pointclouds by computing (a) the chamfer loss
loss_chamfer, loss_chamfer_normals = chamfer_distance(sample_trg, sample_src, normals_trg, normals_src)
@ruslanvasylev If this answers your question please close this issue.
@ruslanvasylev Note that we have spent a significant amount of time documenting all of our ops. In our API docs you can find all the details regarding our implementations. For example, for chamfer you can read more details here.