Using Gen to mix two Mesh shapes.

bareimage's icon

Hello, I have a question, I would like to create GEN patch to morph between shapes. I know that you can do it outside of Max. But I am hopping to get better speed with Gen.

Thanks, a lot!

Andro's icon

What are you using to create your shapes ?
Typically you would use jit.xfade to mix two matrixes.
If you'd' use two jit.gl.gridshapes @ matrix output 1 then you could interpolate between the 2 forms/matrixes.
In jit.gen ( not gen ) you can use swiz xyz or rgb to get the 1st 3 planes ( or if im correct swiz 123 as well )
You can then use the mix object to mix them together ( same as jit.xfade)
Speed is irrelevant unless your using a high detail model.

Graham Wakefield's icon

Here's a quick example. There are tons of caveats here though; generally morphing meshes is far more complex than interpolating the vertex data. For this even to work at all, the meshes have to have equal matrix dimensions, and the same draw primitive (points, tri_grid, triangles, etc.). Then interpolating the vertex positions is possible, but the texcoords probably won't make any sense, unless you're really lucky with the source geometry. And interpolating the normals probably won't make sense either unless the source geometry is similarly laid out and similar in shape -- it might be better to regenerate normals after modifying the mesh (e.g. jit.gl.mesh's @auto_normals, or by another jit.gen post-process that knows how to index the mesh properly for adjacent vertices for face normals).

Max Patch
Copy patch and select New From Clipboard in Max.

But, if you only care about positions, and are rendering with points, then it's totally fine :-)

cskonopka's icon

Thank you Graham for this awesome shape morphing example. I've been looking for something like this for days. Woo!