Layout del blog

Aim constraint. How does it work?

20 settembre 2022

DCC agnostic aim constraint maths

We all love aim constraints. They are easy to set up and pretty powerful, if we know how to use them. 
But how is an aim constraint really working? That is actually a pretty simple logic, but exploring it is very interesting and will surely give you a good visual exercise for vector maths.

First of all, to properly set up an aim constraint, we need three vectors:

- Our base object vector

- An aim vector.

- An up vector, in most of the 3D softwares the up vector, if not specified, is the y axis. 
The reason why we need an up vector is that when we are using euler angles (the x, y, z rotation system that we use every day to manipulate our objects) after 180 degrees, since the angle considered is always the smallest one,  the other side is considered (essentially, if we are rotating 270 degrees for instance, the angle calculated would actually be the remaining 90°).
Without going too complex to that, this leads to flipping, and setting an up vector essentially sets in which cases our object will flip. Relying on a custom up vector is useful because we can use for instance an object in our rig that is connected to the rest of the rig, so the up vector is changing every time the rig is transformed an this helps to reduce flipping.

This is why the more complex system of quaternions was introduced. I won't cover quaternions in this article, as they are definitely on a more advanced side, but they are essentially 4 floats vectors. where 3 of the 4 components are not real numbers, but imaginary ones, that are not affected by the issue that I described above (and neither others, for instance gimbal lock, under certain circumstances).

fig. 1 We start from the base, aim and up vector.

fig. 2 We are now finding the (up - base) vector and the new aim, which is essentially the vector we are going to use to aim the object.

fig. 3 Doing the cross product between the new aim and the (up - base) allow us to find the normal vector, which will be used as a side vector for our aim constraint. Notice that the cross product points inward/outward depending  on the right hand rule. It is a good idea to normalize our cross product (dividing it by its magnitude to get the same vector but with the magnitude of the unit vector).

fig. 4 Doing now the cross product between the side and the new aim (and normalizing) will give us a perpendicular up vector.

fig. 5 We now have 3 perpendicular vectors (it may be a good idea to normalize the new aim as well) and we can compose a 4 by 4 matrix. The last row represents the transform and since in an aim constraint that doesn't need to change we can set it back to the obj's base coordinates.

What if we want to add an offset to this aim constraint? This is extremely easy. When we apply an aim constraint with the "mantain offset" option turned on, for instance in Maya, it basically just stores the three base rotation values of the object to a 3 float attribute and adds them to the result rotation of the decomposed matrix.

11 luglio 2022
This is a pretty old project that I finally had the time to finalize. My goal was to create a walking shot with muscles, fat and skin sim. I already did a lot of muscle sims in the past, but I must say that I am pretty happy with this one. I will publish soon a full article showing the breakdown of the process! CREDITS: Animation - Stefano Colombo https://www.instagram.com/coste999/ Modeling and texturing - Nicolas Morel https://nicolasmorel.gumroad.com/
Autore: Francesco Gioia 29 maggio 2022
In this post, I would like to give an introduction on the upper torso anatomy, as well as showing my favourite rigging system for this part of the body. In particular, I will demonstrate the setup on a skeleton model, and the best application is to rig skeletons for muscle simulations, such as in Ziva. Having a good skeleton rig really helps a lot to have stable simulations and proper bony landmarks. This doesn't mean that you can't use this setup to achieve better deformations as well as some fake-scapula sliding in your skinned models.
Autore: Francesco Gioia 12 maggio 2022
Blendshape nodes are among the most important deformers used in Maya (and not just there! Similar nodes are implemented in almost every 3D software ). Different types of behaviors can be implemented, usually, the most common approach is the vertex order-based one, but UVs can be used as well . In this post, I will go for the vertex order-based one.
Share by: