Home Website Youtube GitHub

Rigging Spherical Eyes with Just a skinCluster and Sin and Cos

hello team mgear , i have problem in this graph
Rigging Spherical Eyes with Just a skinCluster and Sin and Cos (rigmarolestudio.com)](Rigging Spherical Eyes with Just a skinCluster and Sin and Cos)
I cant understan
can you help me or send me this file

im sorry for my english

Hello @hary_jack .
Which part you don’t understand? In the tutorial Chris describes circle using sine and cosine of angle and maya provides nodes to calculate those values.
Here is the video which I think will help to understand the trig part of this tutorial.

1 Like

Thanks alot for replay ,i have a problem in graph maya i dont know how get calculate for all joint not just one joint , for example my mesh eye have 5 edge loop i need 5 joint for an edge loop chris exapling just one joint

Hi @hary_jack

I’m extremely busy this week, but I can try to explain more or send a file next week.

Can you describe more where you are stuck?

1 Like

Hello teacher this my file i wanna get your result but i cant please help me or send me your file

my file

In your file, you are driving all of your joints with only one eulerToQuat node. You need to make the same graph for each single joint.

And then your driver attribute goes from 0.0 to 1.0. 1.0 would be as small as it goes. 0.0 would be as big as it goes at the center of your eye.

But if the radius of your eye is 2.3, then the driver would have to be multiplied or remapped, so it goes from 0 to 2.3.

The neutral input of each driver is the translateZ of each edge loop.

But the values for how big or small your iris and pupil get will depend on your eye and model. You could use driven keys, or remapValue nodes to make them move from the neutral pose, towards smaller and bigger.

Here is what it could look like. These would be the neutral inputs for each joint’s graph. And then you’d have to remap them somehow so you can drive them all with one attribute. (I personally use remapValue.)

1 Like

I was just checking this and wondered if I am doing this correctly and maybe if you can give me some tips how to implement this to mGear as custom step.

This is the code I am using to build. It looks like exploding because joint at the tip has 0 scale by default, tried to invert remap node’s output min and max but I don’t know if thats the right way

import maya.cmds as mc

sphere = mc.polySphere(n = 'test_sphere', ax = (1,0,0))[0]
mc.addAttr(sphere, ln = 'effect', at = 'double', dv = 0, k = 1)

jointsList = []

for i in range(0,11):
    
    # Create joint
    mc.select(cl = 1)
    joint = mc.joint(n = 'joint_{}'.format(i))
    
    # Create nodes
    remap = mc.createNode('remapValue', n = 'remap_{}'.format(i))
    mult = mc.createNode('multiplyDivide', n = 'mult_{}'.format(i))
    quat = mc.createNode('eulerToQuat', n = 'quat_{}'.format(i))
    
    # Make Connections
    mc.connectAttr(sphere + '.effect', remap + '.inputValue')
    mc.connectAttr(remap + '.outValue', mult + '.input1X')
    mc.connectAttr(mult + '.outputX', quat + '.inputRotateX')
    mc.connectAttr(quat + '.outputQuatX', joint + '.translateX')
    mc.connectAttr(quat + '.outputQuatW', joint + '.scaleY')
    mc.connectAttr(quat + '.outputQuatW', joint + '.scaleZ')
    
    # Set node values
    mc.setAttr(remap + '.outputMin', float(i)/10)
    mc.setAttr(remap + '.outputMax', 0)
    mc.setAttr(mult + '.input2X', 180)
    
    # Append joints to a list, then use for skinning
    jointsList.append(joint)
    
mc.skinCluster(sphere, jointsList)

Just tested something, excluıded tip joint from skinning and here is the result. But in your blog post, sphere doesnt seem to lose spherical shape when I look at the silhouette. Am I right?

Well I skipped a few details. But what I do is have a “result” node, rather than driving the joint directly. And then constrain or drive the joint relative to it’s neutral position. So the joint stays at 0,0,0,0,0,0,1,1,1 and then grows or shrinks from there.

In fact, the “result” nodes don’t even have to perfectly line up with the edge-loops, necessarily. They can be linearly-interpolated from 0-1. And then drive joints from their neutral position, relatively.

For losing the sphere shape, it looks like you might be driving all the joints equally. And what you’re going to have to do, based on your own model and style is define where your iris and pupil borders are. And then ease in and out from those places. And the tip joint would almost certainly have to stay in place to stay spherical.

So the falloffs for iris and pupil (another remapped layer on top of the “result”) might look something like this. Where a full strength of 1.0 would be at the iris and pupil border edge, and then falling off from there:

(Hope that made sense.)

2 Likes