#### Howdy, Stranger!

We are about to switch to a new forum software. Until then we have removed the registration on this forum.

# How to create a blend between two different 3D objects

edited January 2018

Hi, I want to blend two very different 3D objects, say a cat and a teapot, to create a sort of average between them. Much similar to how you would do it in 2D with the blend function in Illustrator, which is also easy to recreate in Processing. (The results will be wonky of course, but that's the point.)

I haven't written any code yet but asking here to see if anyone has seen any attempts to do something similar?

Since the two 3D objects will have completely different point arrays I guess I need to go through each point on object A and find the closest point on object B, and this closest point would need to be in a specific angle relative to origin.

Tagged:

• edited January 2018

nice idea !

a case for jeremydouglas, I guess.

Remark

go through each point on object A and find the closest point on object B, and this closest point would need to be in a specific angle relative to origin.

to be more precise:

• source 3D object 1: A
• source 3D object 2: B
• destination 3D object: C

for all points do :

• go through each point on object A and find the closest point on object B, and then calculate point c for C as

formula:

``````   c[i] = new PVector (  (a[i].x+b[i].x)/2,
(a[i].y+b[i].y)/2,
(a[i].z+b[i].z)/2  );
``````

not sure what happens when the numbers of points in A and B are different.

probably just for-loop `i` over the 3D object that has less many points than the other (e.g. only over A's or B's points).

• Do you have the links for two 3D objects ready?

and the code to load and display one in 3D?

Hi, thanks for the reply Chrisir!

I ended up coding this in Unity with C# instead, saved me some time writing the code to load and display the 3D. The method is pretty straightforward and should be easy to translate to processing, here's a link to the code: https://forum.unity.com/threads/blending-two-3d-meshes-via-script.511647/#post-3346137

• Nice!

• For people working in related problems in Processing, I want to mention that one way to make 3D mesh tweening satisfying to watch is to designate meaningful parts of each mesh that are equivalent -- for example, the handle of the teapot = the tail of the cat, or the lid of the teapot = the head of the cat. This is how people often imagine 3D tweens as morphing -- they feel intuitively that the headlights and grill of the car should become the eyes and face of the animal, no matter what the closes points are on the car roof to the animal's head.

Done raw this can be laborious to designate points and it can create ragged results between groups of points. However, if you pick correspondences and then do smoothing, it works well. This process of picking correspondence points and then inferring from them is more or less the exact approach that also creates the most satisfying morphs in 2D.

• Very true, Jeremy! I posted about this in c4dcafe as well, and user Rectro came up with a solution for c4d that is very much in line with your idea. https://www.c4dcafe.com/ipb/forums/topic/101520-blend-two-different-objects/?tab=comments#comment-668812