Tuesday, December 11, 2012

Hi-Res simulated cloth as skinned mesh

Here is a small snippet to convert a vertex-animation into a joint animation. This comes in handy when you, for instance, simulate a piece of cloth in maya and want to import it in your game engine.

This function creates a joint per vertex and uses the pointOnPolyConstraint (Maya 2012 or higher) to align them to the sim. I love this constraint, its basically constraining in UV-space.

For decent looking results, I simulate a hires mesh and wrap deform a lowres mesh for game export. From the hires simulation I then generate a texture sheet with normalmaps that will be used in a "texture atlas walk shader".

Hopefully I can post more on that later.

1 comment:

  1. This solved a huge problem for me involving "Paint Effects". Thank you.

    I was trying for months to export pre-animated anemone and seaweed to Unity with no results. Also solved a speed tree issue, since it's direct SDK isn't compatible with Unity3D.

    BTW, an issue occurs when I set the "brush animation" to loop. All the vertices shrink into a singularity when i run the script. I found a simple way around it by looping the animation manually after baking. A small issue, but not a deal breaker. Great Job :)