Monday, 22 April 2013

Feature Feature: Noise Jitter Controller

In making the heavy damage animation for the bark basher, I had to apply some noise to the torso as he strains to stand up. I could have done this with key frames, but that would have been both messy and time intensive (not to mention difficult to change). To get round this, I came up with a way of applying noise to the movement. Its probably not the best way, but it's pretty simple and it works.

Note: I didn't make the rig, credit for that goes to Hollie Sheppard, who did an awesome job in a very short time.

Okay, first thing we'll need is some noise. I simply used a noise texture for this, and plugged in the time node to the time attribute in the map to keep it randomized. This will give you random noise every frame, which is perfect for my straining animation, but not for smooth, slower noisy movements.

To start, open the Hypershade and go to Create > 2D Textures > Noise, this will add a noise texture to your graph. We won't need to create the time node, as its always present in every Maya scene. The easiest way, in my opinion, of getting it into the Hypershade graph is to get it from the Outliner.

To make it visible, you have to make sure DAG Objects Only is unchecked. This will show everything in Maya in your outliner, but you can type *time* into the filter to find the time node. Once you have it, select it and add to graph.

 Now connect up the outTime from the time1 node to the Time attribute of the noise texture. This will give it random values over time. The graph will look something like above. If the middle conversion node doesn't show up, don't worry, so long as the Time attribute value shows yellow, you know it's connected to something.

We could wire up the noise texture directly if we wanted to, but the values would be tiny, as they'd be between 0 and 1. So to give us more control, we'll want a multiply divide node in there. So go to Create > General Utilities > Multiply Divide. Now connect the outColor of the noise map to the input1 of the multiply divide node. This will let you scale the magnitude of the noise using the input 2 of the multiply node

To let us retain fill control, I recommend grouping the control you're planning on adding the modifier to, and applying the noise to that. That will let you still move the controller underneath as normal. Add a vector attibute to the group using the attribute editor to control the noise in X, Y, and Z. Now put this node into the Hypershade. 

Finally, we do a simple two way wire to set up the control. Wire the output of the noise node into the translate/rotate/scale (whatever you want to jitter) of the group node. Then wire the vector attribute you just set up on the group node into the input2 attribute of the noise node.

And done! What we basically have now is a noise attribute scalable in each axis. The magnitude of the noise will be equal to the random noise value (between 0 and 1) multiplied by the value you put into the relevant axis in your channel box control. The nice thing is that because this is keyable, you can smoothly scale the amount of noise applied up and down.

No comments:

Post a Comment