Tuesday, 16 December 2014

Done!




Here is the fully rigged character for this semester! I enjoyed the challenge creating the rig with my custom character as he came to life! 

Wrap Deformer! 








I find that mayas wrap deformer tool is very useful. You can attach any object to a binded mesh which will then follow the same movement as the rig. As you can see here the bracers are deforming without error! 

Face


Eyes controller

Face Controls 
Here you can see the facial rig. The controls for expressions are attached via aim constraint. The eyes are controlled individually by locators and both are controlled by a main curve,

Shoulder Pad Setup 


Setup

Pad moves with clavicle joint 

Custom controller that allows movement only for the pad

I wanted more freedom with my rig. So I decided to add an extra bone that would allow me to control the shoulder separate to the body. It is connected via point constraint with none of the characters bones effecting influence. This became very handy as any clipping issues were fixable.  

Constrain Script Python 




I wanted a script that would become very handy throughout the rigging process. Constraints where used many times when rigging. Looking through many tutorials I came across digital tutors, they had a series called "Enhancing Maya Toolsets with Python". This became very helpful as it showed how to setup a basic button with windows and apply an function too. Once I figured that out it became easy  


here is the working code example : 

#Import Maya Command module
import maya.cmds as cmds

#Prevent the duplication of our window
if cmds.window("cnsWin", ex=True):
cmds.deleteUI("cnsWin", window=True)

#Create a window that is not resizable
cmds.window("cnsWin", wh=(200, 50), t="Constraining Tool", s=False)

#Create an adjustable column layout
cmds.columnLayout(adj=True)

#Add a Text Scroll List to our UI, and append 3 items: "Point Constrain", "Orient Constrain", and "Parent Constrain"
cmds.textScrollList("myList", h=50, a=["Point Constrain", "Orient Constrain", "Parent Constrain"])

#Add a check box to enable or disable "Maintain Offset"
cmds.checkBox("myChBx", l="Maintain Offset")

#This button will apply constraints
cmds.button(l="Click to Constrain!", c="constrain()")

#This button will remove constraints
cmds.button(l="Remove Constraint(s)", c="rmvConstraint()")

#Show the window
cmds.showWindow("cnsWin")

#This function is used to constrain objects
def constrain():

#Find the item selected in our Text Scroll List
tsl_item = cmds.textScrollList("myList", q=True, si=True)

#If "Maintain Offset" IS checked, apply the constraint WITH "Maintain Offset"
if cmds.checkBox("myChBx", q=True, v=True) == 1:
#This line checks if "Parent Constrain" is selected in our Text Scroll List
if tsl_item[0] == "Parent Constrain":
#This line creates a Parent Constraint WITH "Maintain Offset"
cmds.parentConstraint(mo=True)

#If "Maintain Offset" is NOT checked, apply the constraint WITHOUT "Maintain Offset"
else:
if tsl_item[0] == "Parent Constrain":

#This line creates a Parent Constraint WITHOUT "Maintain Offset"
cmds.parentConstraint()

if cmds.checkBox("myChBx", q=True, v=True) == 1:
if tsl_item[0] == "Orient Constrain":
cmds.orientConstraint(mo=True)
else:
if tsl_item[0] == "Orient Constrain":
cmds.orientConstraint()

if cmds.checkBox("myChBx", q=True, v=True) == 1:
if tsl_item[0] == "Point Constrain":
cmds.pointConstraint(mo=True)
else:
if tsl_item[0] == "Point Constrain":
cmds.pointConstraint()

#This function is used to remove constraints from selected objects
def rmvConstraint():

#Find the item selected in our Text Scroll List
tsl_item = cmds.textScrollList("myList", q=True, si=True)

#This line checks if "Parent Constrain" is selected in our Text Scroll List
if tsl_item[0] == "Parent Constrain":

#This variable stores our selection
selCnsObj = cmds.ls(sl=True)

#This variable searches for any Parent Constraint nodes connected to selected objects
getPrtCns = cmds.listRelatives(selCnsObj, type="parentConstraint")

#This line deletes the Parent Constraints connected to selected objects
cmds.delete(getPrtCns)

if tsl_item[0] == "Orient Constrain":
selCnsObj = cmds.ls(sl=True)
getOriCns = cmds.listRelatives(selCnsObj, type="orientConstraint")
cmds.delete(getOriCns)

if tsl_item[0] == "Point Constrain":
selCnsObj = cmds.ls(sl=True)
getPtCns = cmds.listRelatives(selCnsObj, type="pointConstraint")
cmds.delete(getPtCns)

Tuesday, 2 December 2014

Foot Setup 

Here you can see my foot rig with all its needed control shapes and functions. It has a main shape that moves and rotates the entire foot rig. A heel Ctrl that moves the entire foot from the heels pivot. Toe Ctrl that moves the foot and leg up from the end of the toes pivot and finally a center foot Ctrl that moves the ankle up without moving the toe. 



Middle ankle foot rotation

Toe rotation 


Heel rotate 

Group and Freeze Script



With my little experience with Python I made a script that allows you to group an object, in this situation it would be a control shape/locator and freeze its rotations and clean the transforms with one click! I found this tool very useful throughout my rigging process as it would be tedious moving all my shapes, grouping and fixing each and individual transform and rotation. 

Here is my work process - 


--------------------------------------------------------------------------------------------------------------------------

'''
Aaron's GRP TOOL
>This tool will group selected objects separately, preserve the orientation of selected object(s), and clean up their transforms
'''

#Import Maya Command module
import maya.cmds as mc

#Get selection
selObj = mc.ls(sl=True)

#'For' loop - for all objects in selection, run the following commands
for all in selObj:

#Create a null
grp = mc.group(em=True)

#Rename the null: "grp_" + name of selected object(s)
rnm_grp = mc.rename(grp, "grp_" + all)

#Now, it's time to align the group to the selection

#Parent the group to selection
mc.parent(rnm_grp, all)

#Zero the transforms of the group so that it aligned with selection
mc.setAttr(rnm_grp + ".tx", 0)
mc.setAttr(rnm_grp + ".ty", 0)
mc.setAttr(rnm_grp + ".tz", 0)
mc.setAttr(rnm_grp + ".rx", 0)
mc.setAttr(rnm_grp + ".ry", 0)
mc.setAttr(rnm_grp + ".rz", 0)

#Make sure group's pivot point is aligned to selection
mc.delete(mc.pointConstraint(all, rnm_grp))

#At this point, the group is aligned to selection
#It's now time to parent the selection to the group

#Unparent group
mc.parent(rnm_grp, w=True)

#Parent selection to group
mc.parent(all, rnm_grp)

#Freeze selection
mc.makeIdentity(all, apply=True, t=True, r=True, s=True)   

 Twist & Roll Function 


Here you can see the hip setup. It is setup the more complex way with two control shapes. One, which is connected to the spine for precise hip movement and another which is parented to the whole  upper torso for overall movement. This was setup by using the connection editor, hooking up each of the control shapes rotation axis to the spines IK's twist and roll attribute. 

Overall Torso movement. 
Hip movement only! 


Face & neck 


Here you can see my characters head rig. All joints that are attached to the face come from the neck joint and have a Point constraint on each of its control shapes so I can move the surface of his face. The head control shape (above his horns) is orient constrained to the neck joint for easier movement. He also has a jaw control shape which will control the opening and closing of his mouth and finally he has an eye setup with the locators oriented to the eyeball joint. I added a mouth sock so it can enable him to talk and I will setup a set driven key system in the eyes attributes with a separate eyelid mesh so he can blink.





New Joints

I have decided to add some new joints to my rig to support the extra areas of my character. This includes the shoulder pads, for more precise movement and so that it doesn't dig into his neck when the shoulder control moves. Also a new joint chain that goes out from the root and hangs down supporting his loin cloth. I will add a similar system to the back joints so I can easily manipulate the cloth and move it out the way of his legs when they move. If I have enough time, I will use an N-dynamics system to allow a real cloth simulation to the mesh while also allowing to move it with the control shapes parented to the curves clusters!