Deformation-Transfer-for-Triangle-Meshes icon indicating copy to clipboard operation
Deformation-Transfer-for-Triangle-Meshes copied to clipboard

The mesh position after deformation is far away from the reference mesh position.

Open Owen1234560 opened this issue 3 years ago • 4 comments

Hi, The mesh position after deformation is far away from the reference mesh position. How can I deal with this problem? Thanks. 无标题

Owen1234560 avatar Jul 14 '21 03:07 Owen1234560

Hi Owen, the authors of the paper state a solution: "In order to resolve the global positioning of the camel over time and to enforce foot/ground contact, we extracted the positions of one vertex on each foot of the horse over time, performed an overall scaling to better match the larger size of the camel, and added vertex constraints to match a vertex on each camel foot to these positions." [Ch.6 Sumner2004DTF by Sumner, Popović]

So basically it is up to the user to move the transformed mesh to a desired position.

corr_markers: List[(int,int)] = ...  # List of vertex-id-tuples (source, target)
source: meshlib.Mesh = ...
pose: meshlib.Mesh = ...
target: meshlib.Mesh = ...

foot_marker: int = ???

source_height = source.vertices.T[2].max() - source.vertices.T[2].min()
target_height = target.vertices.T[2].max() - target.vertices.T[2].min()
scale: float = target_height / source_height

...

transf: Transformation = ...
result = transf(pose)

offset = pose.vertices[corr_markers[foot_marker][0]]] * scale - result.vertices[corr_markers[foot_marker][1]]
result.vertices += offset

Won't fix it in code, since it depends on the case.

mickare avatar Jul 14 '21 06:07 mickare

Ok, I try this. Thank you.

Owen1234560 avatar Jul 14 '21 07:07 Owen1234560

Couldn't this be resolved by offsetting the vertices based on target's reference position of one of the markers? (That sounds like a pretty generalized solution)

I implemented such offsetting as well for a special use case in my fork, so seems a common requirement.

hendrikp avatar Aug 02 '21 16:08 hendrikp