augmero's physics workflow - Ziva Dynamics for Blender
Last edited: 01/10/2023, version history on GitHub
supporting video documentation - https://www.youtube.com/watch?v=hnPJCRaTDEo
Disclaimer:
This is an experimental workflow. I don't necessarily recommend anybody actually do this.
If you are new to Blender or 3D this post is probably not for you, but bookmark it for later if you're interested
However, if you are looking beyond Blender native physics I hope some of these notes will be useful!
If you found this page and don't know who augmero is, fair warning some links are going to be NSFW. While this workflow can be useful for more general applications, I am using it for NSFW content
Lastly, if you have ideas / improvements let me know! I'll keep this page updated
Tools:
- Blender
- Maya + Ziva Dynamics plugin
What is Ziva Dynamics?
-
Ziva Dynamics is a plugin for Maya that specializes in character physics simulation and deformations.
-
Check out this lion: https://www.youtube.com/watch?v=vsTP6Ldm7Yo
- For something more relevant to this post you can take a look at my recent animations (NSFW)
- I first found out about this software when I saw tweets from m.tsqn (NSFW), definitely check out what they've made as well
Why not just use Maya?
-
Many models and shared resources online have armatures and python scripts for Blender with no Maya version, it's not easy to port things to Maya
-
Most of my experience and workflows (modeling, sculpting, rendering, materials, etc) is in Blender/Cycles, re-learning all of that stuff for Maya is difficult
Surface Deform is better than Mesh Deform
In previous versions of my workflow I used the Mesh Deform modifier, if you're interested in this method historical versions are still accessible via github. Here are some pros and cons comparing Surface Deform to Mesh Deform:
Pros
- Much more accurate deformations (no cage, follows the same topology)
- For things involving fine details like hand collisions I certainly recommend this over v1
- No need to remesh things to make a cage for the main Ziva tissue
- I still remesh at times to make things like subtissues
Cons
- Less flexible to adjusting with shape keys available after simulation
- It can be quite difficult in some cases to bind the surface deform modifier
- Note: Adding subdivision or triangulate to the target can help
Overview
If you are new to Ziva/Maya, please watch the elephant tutorial, it goes over most of the basics:
https://www.youtube.com/watch?v=QA6C9xzf4f8
These are the general steps for my workflow:
- Make an animation with any model in Blender
- Make the tissue and bone meshes, export to Maya
- Set up and run Ziva physics sim in Maya
- Export Ziva physics sim, import to blender
- Surface deform original model
Supporting video documentation for this workflow - https://www.youtube.com/watch?v=hnPJCRaTDEo
Step 1 - General set-up
- Set up character model with the most general desired shape (likely default pose, shape keys set up for body proportions
- You will be able to make adjustments (and animate adjustments) in Ziva as well but a good base gets better results
- Any simple animation is fine starting out, even an existing animation you want to add physics to
- Pick a frame where the physics simulation will start (I use frame 3) and make sure that your armature stays consistent at that frame.
- I recommend keyframing rest pose at the first sim frame for the most consistency and ease of use.
- Make vertex group for separating armature vs physics deformation
- Exclude more complex parts of the geometry in the physics
- Generally, this includes the head, hands, feet, gens.
- I include hands as a bone, not part of the tissue cage
- We will use this vertex group later for the first two modifiers on the render mesh like this:
Step 2 - Building the exports for Maya, and then exporting them
There are many ways to prepare your tissues and bones for Ziva, if you've got a better way let me know!
Ziva is picky about what it lets you use as a tissue or bone. If you run into issues here's some documentation on what Ziva is looking for zMeshCheck
zBone example: hands
For some context, a zBone in Ziva is part of the simulation that is rigid and can collide with things
Hands aren't incredibly squishy so to save on physics simulation calculations I just make them a bone.
- Duplicate the model's mesh and remove all irrelevant vertices
- Fill the holes with grid fill
- That's it!
- Note: If Ziva complains about the mesh when you import it later, check for weird toplogy. Things like fingernails might be messing with it. It's also worth smoothing out the harsh edges near any grid-filled holes
zTissue example: body physics cage
zTissue in Ziva is where squishy happens and there's a lot of settings to play with
- Duplicate the model's mesh and remove all irrelevant vertices
- Test if the tissue is good by adding a surface deform modifier to the original model, adding the new one as the target of the modifier, and binding. Then test it by adding modifiers to the cage to make sure all the vertices are affected
- Note: if surface deform won't bind, adding subdivision or triangulate (or both) modifiers to the target may help
- Copy the vertex groups from your original mesh onto your new one using the data
transfer modifier
- Click on 'Generate Data Layers' first and then apply the modifier
- Make sure the two meshes are overlapping, maybe put your armature in rest pose for this section
- Clean up deformation artifacts with corrective smooth modifier
Exporting to Maya
It's export time
- alembic export - for performance reasons I recommend excluding from view layer collections of anything that's not being exported
- This means the checkbox on the collection. Export will be slower if anything else is being calculated by the view layer
- For batch exporting alembics, I made a python script, to use it read the documentation in the script. This is much more quick and efficient than doing it through the blender UI
Step 3 - Set up the Ziva sim in Maya and run it
The elephant tutorial can probably teach the basics of Ziva better than me, here's a link again
https://www.youtube.com/watch?v=QA6C9xzf4f8
The elephant tutorial is quite similar to what I do, but my alembics are coming from Blender instead
However, there are some specific notes I'd like to share
General Steps
- Set your Maya framerate to the same framerate you use in Blender
- Import Blender alembic files into Maya
- Duplicate it twice (ctrl d), it's going to do multiple things
- One version will now be part of the physics sim, make it a zTissue
- The other version is now going to become an animated zBone (disable collisons) for attaching the zTissue to
- Make a blend shape from the alembic mesh to a duplicate (set envelope to 1)
- Make attachments from the zBone to the zTissue
- Make sure to set high strength attachments on parts where the cage is next to vertices that won't be part of the final deform, like by the head, wrists, feet, gens. Otherwise the physics sim will travel away from the armature and that's no good
- Remember to use vertex select before attaching and then weight paint the attachment to prevent it from affecting parts that don't need to be attached
- Optional step: I've been getting improved results by using this alembic as a zRestShape of my zTissue
- There is a problem / bug with this but there are workarounds. A quick description of the issue (by my assumptions) is that Ziva is optimized such that if the rest shape hasn't changed a lot it won't update. Since the rest shape is an alembic this can cause some jumping
- Workaround: In some cases where this occurs I've had success with an oscillating shape key out of sight used for my zRestShape mesh (doesn't have to be the same as the zBone). The constant changes with this shape key will force Ziva to update. Can also put this shape key on one of the holes that got filled so it never reflects on the original mesh
I have left these steps fairly generic / sparse because the elephant youtube tutorial does such a good job of describing many things in Ziva, and there's a lot of artistic freedom here. This is a really fun part of the flow. There are some more specific Ziva notes I added after Step 5, I'll link them here. They are also in the floating menu
Clothing
Expansion
IMPORTANT NOTE READ THIS: REVISIONS
Revisions are super important for any workflow, here's how to efficiently re-export/re-import your Blender alembics without having to re-do any of the later steps.
- Save the Maya scene and then export your Blender alembics, overwriting the existing files.
- Use file->open recent and open the same file you currently have open. In reloading the file Maya will get the new animations you exported and you can run your physics simulation again!
- (Maya might crash if you try to keep going without re-opening the scene)
Step 4 - Export Ziva physics sim, import to Blender
- In Maya, select the mesh you want to export and click Cache -> Alembic Cache -> Export Selection to Alembic (this will play the animation as it's exporting)
- In Blender import the file you just exported from Maya
Step 5 - Surface deform the original model in Blender
Simple example of the modifiers at the top of my stack for my render mesh:
That's it! If everything went perfectly the deformations simulated in ziva will now show up on the render mesh
Clothing
Some notes on clothes
For interactive clothing, I add another zTissue but for the clothes in the physics sim
This can have a good result on its own, but to take it a step further software like Marvelous Design can be used as another step afterwards
Expansion
Expansion / inflation, there's a lot of possibilities and potential here
Two main ways I've found to change the proportions on your character with Ziva
- zMaterials with rest scale
- Pros: Fairly easy to set up
- Cons: For animating, you change the 'Rest Scale Envelope' on the Tissue, but this applies to all materials on that Tissue. So if you wanted to increase bust first and then back afterwards on the same Tissue this method won't work
- zRestShape
- Export one more version of the cage from blender with shape keys over time as alembic! Thanks for the tip @vanasmuttin
- I've run into some jankiness with this approach just be warned
- Pros: Individual animation over time with envelopes
- Cons:
- An additional mesh needs to be exported
- In some cases to lower artifacting rest shape influence needs to be turned down, however this makes the simulation less accurate the desired shape
Additional Links and Resources
Ziva first party documentation
If you're curious, the Ziva rabbit hole goes much further than the simulations I've been doing. Here's some crazy forum posts I was looking at