Thursday, 25 August 2016

Blendshape: Instancing Scene Data using inMesh

Whilst looking into the Blendshapes for the purpose of Corrective Targets in a Facial Rig I discovered something interesting.
An empty shape node can be created and then have the outMesh of another plugged into its inMesh. It will then inherit the component data for the input mesh. This appears to have no cost on scene size.
Try it out:

Create a cube
Set its subdivisions to 100 in all axis
Save the scene
Inspect the file and check its size

Now create another cube and plug the outMesh of the first into the inMesh of the second (from and to the shape nodes). You should notice that the second cube ends up looking identical to the first.
Save the scene
Inspect the file and check its size

You should notice that the file size will only have increased by a nominal amount.
It would appear that as the data is in effect instanced the cost is only placed for one of the cubes. Maya will only make you pay for the differences between the first and second cubes - their deltas.

Try editing the second cube. If you move a large group of faces and save the file you will now see that the file size has increased again.
What use is this? I don't need a bunch of identical mesh data within a scene. Well actually this could be useful for populating large scenes with stuff like trees and rocks. However I propose that it could also be useful for storing out the deltas used when working with blendshape targets.
For instance I have noticed people online complaining that file size gets very large when they work with large amounts of corrective data for projects. Most of the time the fix is to either delete the targets or to store them away in another file. It can be useful to keep them in the same file however for such things as editing or retrieving normal data.
So as an alternative create a 'base mesh', a duplicate of the object you are working with, and then each time you need a new corrective duplicate the base mesh and plug its outMesh into the inMesh of the new corrective. You should be able to make your edits and apply as a blendshape corrective. Maya will only tot up a cost for the vertex difference, scene size will hence be lowered and you have the added bonus that any edits to the base mesh will propagate through all target shapes so you can make relatively complex changes quickly without having the problem of passing the data back to the correctives.

By the way, I haven't actually implemented this yet... but in theory it should work.


Post a Comment