Scripting Tip: Useful equation to blend between two values.

This is a simple but very useful equation to blend between two values A and B.

( A * w ) + ( B * ( 1 – w ) )

w is a weight value.

Blend maths for compositing and rigging

When w = 0 the answer is B,
and when w = 1 the answer is A.

( A * 0 ) + ( B * ( 1 – 0 ) ) = A
( A * 1 ) + ( B * ( 1 – 1 ) ) = B

This equation is used all over computer graphics. It the basis of compositing pixels, and can be used to make controls for technical animation ( see this eye rig setup for 3dsMax )

Tutorial: Using the maths as an expression in Eyeon fusion.

In this tutorial I use an expression script to animate a blend between two changing positions. This allows the creation of a new point based on the current position of two other points.

You can download a sample file here

 

Note: using *  in algebra …

The convention is write equations concisely without the * for multiplication like this:

A w  + B ( 1 – w )

This is because hand written algebra tends to use single letters for variables, and multiplication signs can get confused with the variable x. While this form is easier to read, it can be confusing were people are  used to reading computer code, and are expecting * for multiplication and long variable names.

Merge Tool Maths

This is a brief breakdown of the maths behind Fusion’s Merge Tool.

The Operator modes are well documented. But, I’ve done some digging around to uncover the maths behind the Apply mode, Alpha Gain and Burn In.

Continue reading

Rigging eyes in 3dsMAX

3dsMax script controllers are enormously powerful tools for creating custom character rigs. This tutorial will show you how to make a very simple eye rig in 3dsMax and introduce script controllers to make an animator GUI.

Setting up the scene

Continue reading

Converting between Gain and f-Stops

So cameras work in Stops and composite packages use Gain. To convert between the two we need to do a bit of log maths. Heres how.

To convert from Stops (f) to Gain

Gain = 2f

To convert from Gain to stops (f)

f = logGain

This is equivalent to:

f = ( log10 Gain ) / ( log10 2 )

If you want to see why then we’ll need to look a little deeper at log maths
Continue reading