Cult of Rig : Season 00 Day 008 Math Crash Course

Season 00 Day 008 Stream – Math Crash Course – Trigonometry and Matrix Mult

Trig is the study and solution of triangles…or all angles

Starting with Trigonometry as it is a basic and good place to start vs. starting with linear algebra that creates lots of extra wasted calculations.

“You hear me mention custom nodes…doesn’t mean you don’t have to use custom nodes unless you need performance, but the math part is important for foundations”


  • Right triangle is where we start (triangle with 90 degree corner)
    • degree vs. radian
      • Also the “Why” of when unitConversion nodes show up as you connect a translate value to rotation.
      • unitConversion nodes are normal maya nodes with some basic math (conversion factors) and change the type of the connection at the output (
    • Scene used to display the functions is available at:…
      Maya 2016 and up.
  • Back to radians
    • Radius of the circle  R=1   means 1/2 is PI 3.14  so full raius is 2 PI R
    • when you see radians the start of the circle is 0, end is 2 PI, half circle is 1/2 PI
  • Degrees
    • Circle is broken in to 360 values , 0, 90, 180, 270, 360
  • The relationship between the two is PI = 180   so if you need to convert them 3.14/180 to convert so when you look in the unitConversion node you see this math happening.

When you create triangles from a unit circle you always get hypontus of 1, simplifying calculations.

function of an angle (works in radians always works  between [-1,1]

  • Sin
  • Cos
  • Tangent ( can be infinite)

Each function has an inverse

  • arc sin
  • arc cos
  • arc Tangent

What do these do?

If we say the we get the Sin of the triangle leg, the Arc Sin will give us the Angle.

Given any axis, if you are rotating around Z for example , clockwise will be negative.  This isn’t great so flip the mesh around so that the rotation will be positive.

*Do follow along in Maya with the example scene and also create with Raf.

  • Build some primitives named
    • sine
    • cosine
  • We will rotate the HY transform node (from the example file) and on its rotation  to create an expression

skip from 30:00 to here to see 35.32 to see the expression work

in expression editor type sine.ty = sin(hy.rz) and click create

Rotate the hy node to see the SINE node translate up and down. Because the connection creates a unitConversion by default you can change the value in the unitConversion node to 1 to allow it to pass through to the SIN() in the expression with no rad/deg convert.

Next we create the cosine transform expression  cosine.tx = cos(hy.rz) so we now have our nodes translating up and down and left and right as we rotate the HY node.

Behind the scenes in Maya when you take  a “vector” and rotate it with Matrix Math.

If we connect the  translate X from cosine and translate Y from sine to a new transform you can see that the new Transform (say a new sphere) you will get the same action as if a parent constraint on the new sphere following the HY node.

The combination of the Sin and Cos create a translation the spears to be a rotation.

Soh Cah Toa

For any giving angle there are two sides, (legs) adjacent, opposite and hypotenuse

S(?) = 0/h  C(?)=a/h  T(?)=o/a

Law of Sin and Law of Cosin 55:30

a/sinA = b/sinB = c/sinC

Law of cosines is the foundation for IK solvers like the 2 bone solver

“I mention all of this because when ever you are using Matrices because this is what you are doing under the hood a lot”


Linear field of numbers with sides

Vector for example is a single column Matrix.

Raf gets in two a few topic tangents and you are best watching it as it is hard to note what he was talking about with all the drawing and graphics.

What happens when the Matrix is not normal? 1:15


Why is this important?



Get involved:

Scene used to display the functions is available at:…
Maya 2016 and up.

Follow me on twitter for announcements and news

Check out the calendar for up-to-date information and times

Follow the Streams live on Twitch

And keep up to date with news on the website

Cult of Rig : Season 00 Day 007 Matrix math rig clean-up

Season 00 Day 007 Stream – Cleaning the Components

“Day 7, we introduce matrix multiplication and then proceed to an uninterrupted stretch of rigging proper (yay!)
Lots of nodelling.”


What is the Matrix? 6:00 (video)

Raf hits some basics of the Matrix, the Matrix is the transform in Maya and describes what was required to move the object to where it is in space.

If you want to reverse the path of the object back to 0,0,0 this is the “inverse Matrix” will give you this path.

*order maters in how they are multiplied*  Similar to Rotate order

“Build a rig that you are not affrid to change the rig”

Implement the rig:

If the rig so far has been built correctly you can simply select all the “deform” nodes and graph them and cut the connections. (rig should stop updating the mesh after)

Don’t be afraid to detach chunks of your rig and re-hook up later.

Next hunt down any nodes that are in the connections but not named correctly


  • pedals_M_cmpnt
    • input
      • localWorld_srt  updated to pedals_M_localWorld_srt
  • Control graphed and  “wheel_M_main_ctrl_wMtx_output_fNode2” gets updated to match what the in and out connections are “pedals_M_staffworldMtx_fNode”
  • Continue to clean the graph and make sure the IK FK blend works
    • Here you need to watch closely as Raf shows a fearless editing of the existing rig nodes to prep the rig.

Build a new attribute holder

  • Create new curve shape
    • pedals_M_settings_ctrl and parent it under the pedals_M_cmpnt-controls
    • It needs to move along with the rig
      • pedals_M_world3staff_offset_srt-> pedals_M_staffworldMTX_fNode-> pedals_M_settings_ctrl
  • Add custom attribute FKIK_switch  and pedals_gravityAligned

We had this working before but it gets disconnected and cleaned up

  • We were using the animBlendNode_AdditiveRotation weight to rotate the node to flip the value and also do the blend.
  • Make sure animBlendNode_AdditiveRotation.output -> pedals_M_pole_srt.rotation (this still works from our process before)
  • Few more cleanup passes on some of the  other unnamed nodes multMatrix1, decomposeMatrix2, vectorProduct3,angleBetween node, from pedals_M_world3staff_offset_srt.   pedals_M_localizedPEdal2staff_fNode, pedals_M_localizedPEdal2staff_mtx2srt, pedals_M_ikPedals_projectedAxis_fNode, pdeals_M_ikPedals_projectedAngle_fNode

“Don’t just copy what I do, become familiar build dexterity with the Node editor”


The next process is hooking up the logic for the connections, FKIK_switch out to Weight B on but the value needs to be flipped- Using Reverse node to flip the 0 to 1 should give us the weight swap.


FKIk_swtich to animBlendNode_AdditiveRotation.Weight A to finish the rig.

Next get multDoubleLinear node take FKIK switch attribute to its input 1 and set input 2 to -1 to flip the incoming value and hook it up to the animBlendNode_AdditiveRotation.Weight A .

Rename your nodes and clean up the graph on what you just created and hooked up.

Staves rigging:

  • wheel_M_main_ctrl_wMtx_output_fNode1.Translate -> staves_srt.Translate
  • animBlendNode_AdditiveRotation.rotate-> staves_srt.rotation
  • update name animBlendNode_AdditiveRotation  to pedals_M_FKIK_rotBlend_fNode

Continue clean up and end: (1:15:00)

Here Raf walks the graph and updates the names of the nodes to help make sure they make sense to the rig and do what they are doing, there are many changes here so take the time to watch this part of the video or clean up the rig names on your own.



Get involved:
Follow Raf on twitter for announcements and news
Follow the Streams live on Twitch
Subscribe and watch past broadcasts
Cult of Rig -YouTube
And keep up to date with news on the website

Cult of Rig : Season 00 Day 06 – Theory and Applied vectors, IK pedals

Season 00 Day 6 – Theory and Applied vectors, IK pedals


“More on vectors while we actually show some application, and eventually make it to hooking up the pedals’ geo to the IK pedals control in the niche of time”

“Day 6, crash course in vector math, sprinkle of matrix math, and finally, applying in Maya. IK pedals connected to the geometry in the niche of time.”

continuing from last video cult-rig-season-00-day-005-vectors

Quick catch up:

  • Shout out to animBlendNodeAdditiveRotation for angle connections without unitConvert nodes.
  • Pythagorean theorem reminder for dealing with vector length
  • |V| or ||V|| is how you might see will be an absolute length of a vector, if you read about vectors in math books
  • a unit vector is the vector compressed in to a 0 to 1 range
    if you want to scale it, normalize it first then * by value to scale it up to be longer.

How to do this with nodes: Vector scale and playing with vector math.

  • create a control transform group “pedal_ik_ctrl”
  • Add a cone polygon primitive
  • Connect the ik control to drive the cone
    • create the node vectorProduct
    • connect ik translate to node input and go output to the cone translate.
    • set the vectorProduct attribute normalize output this crates a “follow” that is limited to a range of 1 and set to “no operation” because we only want the value normalized.

How do we create the Math with only nodes?

  • interesting tip that comes up later: If you have two vectors and normalize them then do dotProduct you get the angle between them
  • Create a spherical constraint with just vector math(13:29)
    • ik ctrl node translate – vector Product-translate of target
    • To control the length is multiply the vectorProduct by a value with a multiplydivide node before the target translate.
    • If you want to lock this sphere to a single plane you need to set the axis in the mitiplyDivde node to zero.

Need to control this effect or build on.

  • dotProduct
    • ||a|| *||b||* cos  – if you have two normalized vectors multiplied by COS gives you an angle.
    • If your vectors are aligned (angle zero) the COS of that angle is going to be 1
      • ||b|| * COS  normalized gives you the magnitude(length) of the vector
  • So with out a “length node” in Maya we can use the vectorProduct node
    • pedal_ik_ctrl.translate out to vectorProduct 1 node (normalizing the value no operation) -out to vectorProduct 2nd node input 1
    • pedal_ik_ctrl.translate out to vectorProduct 2 node input 2 (with no normalizing set to dotProduct)
  • We get the result of the length of the vector
  • Condition node (if length of first vector in to “first term” ) is greater than 3 (then we want the reScaled vector from multiplyDivde node “second term” )
    multiplyDivide.output – Color if true.
    otherwise if the length is less than, use the pedal_ik_ctrl translate.
    Then take condition.out to the cone.translate.
  • This creates an “IK” like behavior by creating a limited range

RIGGING : Back to rigging the bike pedals

Raf now uses what he just worked through with the vectors to create the rigging. And updates the names of the nodes.

  • pedals_M_pedal_IK_ctrl_srtBuffer
    • pedals_M_pedal_IK_ctrl
  • pedals_M_pedal_IK_ctrl. translate->vectorProduct (no operation) – multipleyDivide


We want to have our pedals_M_pedal_ik_ctrl_srtBuffer end up in the same space as the the pedal_Mstaff_ctrl_srtBuffer + an offset

  1. parent pedals_M_pedal_IK_ctrl_srtBuffer under pedals_M_cmpnt-control
  2. world2Pedals_offset_srt->wheel_M_main_ctrl_wMtx_output_fNode2 -> pedals_M_pedal_IK_ctrl_srtBuffer
  3. create a new node staff2pedals_offset_srt that is a child of pedals_M_cmpnt- input- world2pedals_offset_srt (rename name to world2staff_offset_srt )
  4. staff2pedals_offset_srt world matrix out- to new decomposeMatrix node wheel_M_main_ctrl_wMtx_output_fNode3- srt out to pedals_M_pedal_IK_ctrl_srtBuffer

Now the IK control starts in the same place as the FK

Raf does something interesting here to drive the control points on the shape for the pedal inverse of the transform to create a visual link 

At this point Raf also digs in to Matrix math (1:00hr) to setup the information needed to create context to the nodes and rigging that he needs to do to make the IK buffer work in the rig.

*Maya uses row matrices, reading top to bottom across the matrix

1,0,0,0 x
0,1,0,0 y
0,0,1,0 z
0,0,0,1 (w) displacement from world 0,0,0

Continue the rig

  • world2staff_offset_srt
  • pedals_M_peal_IK_ctrl

New node time ( multiplyMatrix )

Take the inverse matrix from world2staff_offset_srt ->multMatrix.Matrix In[2]

and pedals_M_peal_IK_ctrl.worldMatrix to ->multMatrix.Matrix In[1]

Now decompose the multMatrix output  and drive a sphere for visualize the output of the offset we now need in order to drive our pedals.

delete it and create a cone.

parent the code under the world2staff_offset_srt for visualization of the pivot.

  • multMatrix-decompose->and attach it to the translate/rotate to check that your offset goes to the pedal location.

But we need rotations, not translate

  • create vectorProduct and set it to no operation
  • Dot product can give you both projection and angle of the vector.
  • New node (angle between)
    • multMatrix-decompose-Y and Z in to the angle between vector Y.Z and then angle.euler out to the cone to show rotation. of only Y and Z, keeping X from solving and creating a flat plane of rotation
    • To invert the value push the Euler out to animBlendnodeAdditiveRotation and – the weight so you can get the rotation angle in the direction you need.
    •  To do the final rig hook up between the IK and FK  using the existing animBlendnodeAdditiveRotation  node, take and pedals_M_staff_Ctrl (our fk rig) .Rotate  into  animBlendnodeAdditiveRotation.inputb
    • then animBlendnodeAdditiveRotation.Output – to Deform-pedals_M_pole_srt
  • Now the weight value on the animBlend node will mix between the IK or FK rig system.


What does this give us?

  1. A rig that doesn’t depend on hierarchy
  2. no relationships with layers of constraints because the rigging is managed with pure math and in the DG not in the hiearchy.
  3. A deeper understanding of what Maya is managing behind the scenes when you are doing constraints and parents etc in the DAG.



Get involved:
Follow Raf on twitter for announcements and news
Follow the Streams live on Twitch
Subscribe and watch past broadcasts
Cult of Rig -YouTube
And keep up to date with news on the website


Cult of Rig : Season 00 Day 005 – Vectors

Note : There isn’t much breakdown on this, as you really need to watch it through and pay attention, enjoy!

Season 00 Day 005 Stream – Vectors

Math time! ( need more reference check our math resources for more )

“Day five: a crash course in vector math basics all the way to practical application, at which point a crash in input devices all the way to mouse click prevented actual practical application.

Minute 52 to 58 are largely pointless, once you get to 52m just skip ahead to this point in the video:
Sadly as of two months ago YouTube doesn’t allow annotating any longer, so I can’t inline this in the video itself like you might have seen elsewhere.”

  • Why vectors? Problem with the rig right now is you can’t twist the rig as everything pivots from a diffrent location/offsets. That is normal but want to cover vectors before we get to the fixes.
  • Not a rotation issue – it is a translation issue ( the rotations are linked well but they don’t translate when rotated, the position is still added in world space, not the local space
    • Simple fix? add in some extra nodes under localWorld_srt – world2pedals_offset_srt and match that offset to the center of the wheel, then grab its world space in push it in to the pedals_M_staff_ctrl_srtBuffer

Why does this work?because there is a real transform node located at the correct place that is now rotated by the control.  This is fine but great, what about if we want to keep the rig in the node graph and not hiearchy hacking?

Intro to Maths

  • vectors
  • linear algebra
    • when you want to work on two numbers together like X and Y you use linear algebra
  • the meeting location of the 2 numbers (X,Y) gives you a direction aka 2d vector

In Maya you get a Vector (xyz) and a Point (xyzw)where the w is the length of travel down the vector until you hit the point location.

  • What can you do to the vectors?
    • Add the 2 of them them piece wise ( each value) per part X/Y/Z
    • Subtract them but remember order of operation matters to go in the correct direction along the vector
    • Multiply them
    • Vectors of length 1 (normalized or normal vector) and how the Pythagorean theorem works to find it.


Then Maya crashed and took the stream to QA 🙂 but the rest of this is in the next video and our next breakdown as you should watch next!

QA: Use case for this math stuff?



Get involved:
Follow Raf on twitter for announcements and news
Follow the Streams live on Twitch
Subscribe and watch past broadcasts
Cult of Rig -YouTube
And keep up to date with news on the website

Cult of Rig : Season 00 Day004 – Nodelling the Components

Season 00 Day 004 – Nodelling the Components

Day 4, nodelling some components together and finally some amount of actual rigging

Continuing to build on the previous video with some updates to the core control shapes with better direction and selection and moved the model and nodes up from the world (this was done off screen due to crash recovery)

Myth: Having more than one shape node under a transform is a problem

Busted: You can have as many shapes as needed, the problem is that some scripts and tools assume there is only one shape node and or the shape node is the name of the transform+Shape. Write better tools.


Rigging up pedals:

  • Try to keep pivots clean, either world 000 or local in the position you need (put there by the buffer)
  • Rotate order for the pedal – make sure the driving axis is not influenced by the other two axis (like X in rotate order XYZ)
  • Build rig function in the graph and don’t relay on the hiearchy of nodes to make the rig work, use good graph connections so if there are changes in the hiearchy the rig function won’t break. (see rotate order comment previously ) need rotate order help check our infographic
  • Locking attributes are an interface issue not a “rig” issue, the rig shouldn’t break the actual functionality.

Make the pedals stay flat (oriented to the world) is the rigging goal (AKA anti-counter animation rig). Concept is rotation Data of the wheel control can be reversed and drive the pedal in order to have the rig do the counter animation.

Rigging Dojo Note:Raf starts talking about custom nodes vs. Maya default nodes and how connections like we are about to do cause Maya to create unitConversion nodes to deal with Angles and Radian conversions between connections. Rigging Dojo Alumnus Ryan Porter has release an open source set of angle nodes to help keep the graph clean
You can use the animBlendNodeAdditiveRotation node to do this without extra nodes or unit conversions to reverse the rotation if you need or want to to stay in vanilla Maya.


  • rotationX -> input A and B of the animBlendNodeAdditiveRotation node then set the Weight B to -1 you now have zeroed out the rotation from the input.

Video 30:00

  • Notes on Left and Rig components (example is the left and right pedals) It all can still be thought of as a middle component
    • We asked about a shot need like a gag that animators need to counter rotate the arms like they broke.
      GREAT TIP!!! as long as it is for  a single shot fine to do a single one off

      “Don’t complicate anything you design you can preemptively address any case you can think of…. address the minimal requirements. as well you can and quickly as you can and let them find out what they like about the main use cases”

Rig the other side:

  • Duplicate the pedals_M_pedalLeft_ctrl_srtBuffer and name it Right
  • Move the buffer to translate the rig over to the right pedal location
  • At this point Raf hit a point where there were some bad issues with the rig because of so many connections going to one node that was effecting many areas…time to break up the connections
  • Under pedals_M_cmpnt  break up the deform output system
    • deform (create new nodes)
      • pedals_M_pole_srt
      • pedals_M_pedalLeft_srt
      • pedals_M_pedalRight_srt
    • These new deform nodes replace the quick connections done before so re-connect the incoming connections from the controls to the deform nodes and then back out to the mesh
      the pedals_M_pedalLEft_ctrl_srtBuffer ->addDoubleLinear to the new deform-pedal_m_pedalLeft_srt– and back to pedal_L_footRest_mesh
    • Continue for the pole and the Right pedal



Wheel hook up 58:00

Time to drive the wheel mesh with the control rig so follow the process for component hookups outlined so far and check out the video

  • need to create an pedals_M_cmpnt- output
    • create (staves_srt)
  • hook up the connections to drive the wheel and we need world transform as this is the master control or close to master:
    pedals_M_staff_ctrl-decomposeMatrix- staves_srt-(wheel_input)localWorld_srt-wheel_M_main_ctrl_srtBuffer

When you do “god” nodes or master nodes always add offsets to these controls as a safety backup. The offsets allow you to expose it to animators without creating a problem with trying to deal with Maya pivots.


  • output
    • master_srt
  • control
    • godNode_M_master_ctrl_srtBuffer
      • godnode_M_master_Ctrl
        • godNode_M-masterOffset_ctrl


… This section gets a bit complex and hard to follow here in text, make sure you watch the video and build the nodes as you follow along


quality comes from Iterations, build a rig that you are not afraid to edit…building a robust and clean rig allows this.

Q: can you add an attribute to turn off the autocounter rotation on the pedals.

A: Adding an attribute to allow the effect to be turned off can create a bit of a cycle loop on the graph but it isn’t too bad, won’t cause a problem. Using a custom attribute “blend” to the pedals_m_sttaff_ctrl and feed it in to the multDoubleLinear value to change the multiplier.



NOTE: Thank you to the other TDs reading over our documents and catching problems, spelling or things we missed, it makes it better and we appreciate it.



Get involved:
Follow Raf on twitter for announcements and news
Follow the Streams live on Twitch
Subscribe and watch past broadcasts
Cult of Rig -YouTube
And keep up to date with news on the website