3D Model animated with audio

PaddyCobain's icon

Hey there !

I'm trying to find a way to modify coordinates of a 3D Model (.obj) with audio values, or just with values.

For example, I have a face model (Mouth, eyes...) and I want my model to close eyes. How can I modify the coordinates for the eyes in max ?

I know I can modify shades, colors and so one, but what about changing coordinates ?

Thank you very much for your help.

Andrew Benson's icon

The most effective way to do this would probably to create a skeleton for your model in your 3D modeling software, and then export as a DAE file that can be read by jit.gl.model. From there, you can either animate individual bones, or you can set keyframes in the 3D software and scrub through them using animtime messages.

PaddyCobain's icon

Thanks Andrew !

I think I got it with the keyframes, but how do you animate individual bones ? Also with animtime messages ?

Rob Ramirez's icon
Max Patch
Copy patch and select New From Clipboard in Max.

check out the copynodestoclipboard message of gl.model

PaddyCobain's icon

Ok thanks !

I'm a beginner with visuals, and I just see that I was not asking the good question, sorry.

I have done Shape Keys in Blender, and I would like to manipulate them in max. It means importing the file and morphing from one shape key to another in max.

Does that make sense ?

Andro's icon

Shape key states in Blender are not exported to max. The shape key add-on for DAE files only works when you re-import the DAE model back into blender.
If you make a 3d model and export each shape key as a separate model you can then load all the model "states" into a bunch of jit.gl.model objects.
Enable @matrix out 1.
Now plug two models into a basic jit.gen object. Input 1 and 2. Create a param object inside the jit.gen object. Call it crossfade for example.Plug that into the mix object.

Now get the output of the jit.gen object and connect it to jit.gl.mesh.
The fade parameter will allow you to crossfade from one model position to another.
This will only work for two models. I'm sure a gen wizard could easily make a patch which would allow you to crossfade between 9 different inputs.

PaddyCobain's icon

Excellent ! Thanks a lot !

I got it theoretically, I'll try the practical work !

PaddyCobain's icon

Alright it works, but as expected it's decomposing every piece of model to morph. One model state is bursting to another. Is there a way to avoid this ?

Andrew Benson's icon

With this approach, it might make sense to export a separate model for the parts that shouldn't morph. The jit.gl.model outputs each drawgroup as a separate matrix, so that should also be taken into account.

Andro's icon

You have to have exactly the same amount of verts, edges and faces with each model you export (like in Blender once you made the default shape for Shapekeys you can't alter the amount of verts edges etc..)
Double check that you have the right export options turned on in Blender, I know it took me a while to figure out the right way of exporting them, also very important. Work with triangles not quads, also make sure that your jit,gl.render has primitive_mode set to triangles.
Use the triangulate modifier in Blender to make quads into triangles before exporting them, or use it as a modifier and export with "apply modifiers".

Andro's icon

Forgot to say that the primitive mode for your jit.gl.model objects also has to be triangles or tri_grid, set this for jit.gl.render as well.