Wednesday 22 January 2014

Mirror across sphere rig

In my previous post I explained the math and maya nodes you need to create mirroring of positions in 3D space. Here is a different, more complicated, example where I created a rig that mirrors across any point on a sphere. I used a sphere but it can be any object you want. The only limitation would be a low poly mesh where the mirrored positions would snap since there would not be enough polygons that would provide data on normals that would ensure a smooth transition. In that case I would probably add some nurbs patches that match the poly shape and use their normals.


Mirroring across a sphere from Armin Halac on Vimeo.

Questions and comments are welcome.


Sunday 19 January 2014

Mirroring across a plane - Tutorial

Mirroring a point across a plane (ex. YZ plane) seems easy but it requires a couple of math tricks to make it work every time. The main tool for achieving this effect is the dot product. It gives us the projections of our point on Y and Z axes and with those values we have almost everything we need for our mirrored position. With a few Maya nodes we can implement this in a scene:

The completed node graph

Same calculations can be done to mirror any object, vertices, curves...
I go into more detail on how this works in the video:

Mirror across a plane - Tutorial from Armin Halac on Vimeo.

Edit:
This technique was more of a demonstration of some math tricks that could be more useful in many other cases. To do the same mirroring the easy way you can just take the world position of the first object and multiply the x value by -1 and you will get the mirrored position. That is what I would do in a real case scenario because it is faster and more efficient then doing all the math stuff.

Thursday 16 January 2014

Skeleton pose manager - Free script

This script is inspired by some of TD Matt's blog posts where he goes into detail about skinning and rigging meshes in different poses. He was hosting a script that did the similar job as this one (at least I think it did the same job because I never got to use his script) but the download link is broken. So I made my own version of the tool.



A few things to keep in mind while using the tool:
- The pose data for every joint is written to a custom attribute and the data is preserved if the joints are copied. So make sure to delete it from duplicated joints like those for IK/FK switching so they stay in place while you switch poses on your bind joints.
- When mirroring poses from one side to the other make sure to select joints down the chain because the data is stored in the object space.
- The mirroring function uses the "L_" and "R_" prefixes to find the correct joints. Edit the mirrorPrefixs variable in the script to the prefixes you use. I know that it is not good to hard code stuff but I did it here for the sake of simplicity.
- I was playing around with pymel classes for ui elements and tried to write everything in an object oriented way so it might look a bit weird to you who are used to using flags to set up ui elements. When writing this way there are a lot more lines of code but everything is easy to read and a lot easier to edit.

Hope you find the script useful and let me know if you find any bugs. I will fix them as soon as I can.

DOWNLOAD