2010
11.08

I propose a way of using ICE to split symmetrical shape halves. Here it is in action:
My
(Download here and read more about it below.)


The classical way of doing symmetrical shapekeys (a.k.a. “blendshapes” if you’re in Maya or morphs if you’re in Max) is to make a symmetrical one then add it twice and paint off its influence with two weight maps, one for each half. In Maya you’d use the Paint Blend Shape Weights tool, but it’s basically the same deal.

In ICE, shapekeys have a .positions ICEattribute in them. This is an array of positions (vectors) representing the relative offset from the original mesh. In other words, it means you need to add them to the existing point positions to make said shape occur. That said, we won’t be using .positions in this post but full PointPosition’s instead.

Here’s what we’re gonna be working with in my example:
Amazing smile!

Normally you would make the 2 weightmaps, select one then Shape->Modulate Shape Key with Weight Map. The map looks kinda like this:
Middle is 50 percent, rest is 100 percent.
This involves making sure you have 100% of one half and 50% of the middle. You want 50% because you want to be able to add the shapes for both sides and get 100% of the deformation in the middle, else you’d get 200% and that’s no good.

Let’s see how we can use ICE to skip that step altogether by only deforming points in one half instead of relying on a map to define it, as pictured at the beginning of this post.

My

So as you can see we read the PointPosition, split out to scalars with the “3D Vector to Scalar“, then feed the X to different nodes to see if it’s bigger or equal to / bigger / smaller or equal to / smaller than zero. With the “Select Case” we use the correct one as defined from our dropdown menu input attribute “Type“. (If you didn’t know: to define a dropdown menu for an attribute in a compound just rightclick it and go to Properties, then fill in “Combo string” and “Combo value” then click “Add combo” as desired.)

The If node before the Linear Interpolate makes sure that if we’re not dealing with the correct half, we just let the positions pass through untouched. Otherwise, we check if the “Type” (mode) is set to one that includes the middle line, and if X is 0 it means we have a point in the perfect middle of the mesh, in which case we only affect it by 50%, else we let it go through. At the end we do one more Linear Interpolate between the affected result and the original mesh, so we can blend it gradually with a slider.

Lastly, if anyone’s curious what the word “Epsilon” means in regards to an “Equals” node, it’s basically the margin of error permitted in the comparison since vector values aren’t exact numbers most of the time in 3D. Thus an epsilon of 0.001 in this case means that a vector’s posX can be off from 0 by 0.001, so it could anywhere between -0.001 and 0.001 and still be considered to equal 0. You can increase the epsilon if you need to.


Long story short, you can download the compound right here. I find it has greatly sped up my workflow when generating shape halves. Hope it helps you too. 😉

6 comments so far

Add Your Comment
  1. getting an access denied when we try to download it. 😛

    • Woops! My bad. Forgot to set the file permissions to be public. Fixed! 🙂 Thanks for pointing it out.

  2. Is it safe to use “shapes” in the compound instead of the “foreign mesh”? I tried it out and all seemed ok. What are your thoughts?

    thanks
    Phil

  3. It’s no where as elegant or cool as your solution, but I wrote a little plugin a while back that does symmetrical shape splitting among other tricks:

    http://shaderop.com/projects/shape-tools/

    Sorry for the link baiting, but I thought people reading this article might find this useful.

    Thanks for sharing 🙂

  4. Thanks all,

    Mohammad,I often use your tool and i like it and its also very usefull,
    thanks for sharing to both of you!

  5. Hi:

    I’m currently trying to do something similar in ICE (where I can use one shapekey and only have it affect the Lf/Rt side of a mesh depending on a user-specified flag), and I tried downloading your compound to see how it worked, however, whether I plug my mesh or shape key in, the shape still deforms on both sides no matter which side I select in the dropdown menu?

    I’m not very savvy in ICE, so I probably connected it wrongly: Am I supposed to connect a mesh with shape keys on it to this compound? I tried digging into the compound itself and replacing the get self.pointpositions with the actual shapeKeys pointpositions, but then the ICE tree had errors and wouldn’t evaluate.