Category Archives: Math

Nuke multiGrad

an advanced 4-point gradient gizmo for rotoscoping

***updated 3/9/2015

I’ll be the first to admit that I’m no expert on rotoscoping, but in my experience one of the first tools I look for is a multi-gradient – something that I can use to paint out large sections of the image, and then add detail to. So I was surprised that, besides this shake-like 4-point gradient there wasn’t anything in Nuke that was what I wanted. The shake gradient is nice, but I was really looking for one that would allow me to move the points around in space, and would interpolate colors around the points as well as in between. With some patience and a lot of math (point-slope anyone?) I created a gizmo that will do just that. Below you can see the results on a racecar:

Of course, it’s not perfect, and there would need to be fine tuning around the edges, but all the rotoing in that image was done just with this tool. The user pipes in the source image to “Source” and a mask to “matte”, and the gizmo will comp it onto the source automatically, preserving the source alpha (the user can turn this feature off under the “Matte” tab. It also includes python scripting that will automatically grab the color of the source at the points, which makes painting out areas really quick and easy.

Control Panel

Because of the math involved, points 1 & 2 must be at the top, and 3 & 4 at the bottom, or it will start to act screwy. If it needs to rotate, you’re better off translating the whole result.

Download:

4pointgradient.txt
tested on Nuke 9.0v4

Houdini Animation Curves otl

being an operator that can extrapolate one set of values to another using curves
curves

I’ve recently been working on an idea that requires me to do separate luminance values in an image into x discreet “steps”, such as 0-12. However I don’t want to do the distribution linearly (read: equally distributed), I need to account for the fact that luminance is non-linear.

Continue Reading →

Technodolly Focus, Z-Depth, and Lens Distortion

being one of the only google search results on the technodolly
techno_dolly

Any comp lives or dies on subtle qualities of a scene – color, depth of field, lens distortion, etc etc. Solving lens distortion with nuke is pretty easy once you understand the process (and immensely easy if you prepare ahead of time!); without a good lens distortion solve you’ll never get a convincing composite. Depth of field is easier to do a guess-and-check method, but of course we’d much rather get an accurate result. We’ll discuss both, but first a quick overview of the technodolly itself.

Continue Reading →

Luminance Curves

being an exploration on converting values from one set to another using curves
grayscale_curve-perceptual

Often in compositing, I will need to take one set of values and convert it to a different set of values. Say I have a linear image, with luminance values in a range from 0 – 4.589:

Input: Output:
0 0
4.589 1
If I want to do some fancy operation on that image based on it’s luminance, I’ll probably want to convert that range to 0-1, so it’s easier to work with. The easiest and most straight-forward type of conversion is a linear one, of course, where we simply divide all the luminance values by the largest value, giving us a range of values between 0 and 1:

Continue Reading →