1
$\begingroup$

I have 2 3D head images and want to morph one into the other (animation) without using blender etc. I want to do it using coding preferably using C++, C# or python(libraries are ok). I have done 2D image morphing etc but was unable to replicate it in 3D. Kindly give guidance about the steps that needs to be followed to achieve this task. ( Any Sample project would help).

$\endgroup$

1 Answer 1

2
$\begingroup$

One method, probably the easiest. Is to have a one to one association of vertices in 1 model (model A) with vertices in the other model(model B). To do the morph look up the two vertices and lerp between them. Where the linear interpolation ranges from 0 to 1 and the two points form a line segment. 0 would represent model A and 1 would be the fully morphed version of model B.

The biggest problem with this approach is generating the association between the vertices.

To overcome this issue, a relatively simple solution is to scale and rotate both models so they effectively share the same model space, and are approximately overlapping each other. Distortions don't matter here, the goal is to get the two models roughly equivalent in size and shape with the bits of model A that map to model B close to each other. (if the two models are rigged, then this actually becomes easy to do automatically just by mapping the joints to each other)

Once you are happy that the basic parts are lined up, simply iterate across the vertices doing a brute force search for the nearest vertex from model A in model B. There will be some repeated vertices, either repeat them or create a structure to hold multiple mappings.

The result is your mapping. At this point the models can be massaged to be GPU friendly or whatever else is needed.

Other methods exist, but they get very bogged down in theory and math. I like this simple approach because it is relatively easy to implement and understand. (it is also easy to adjust it to fit different needs)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.