PDA

View Full Version : Poor Man's Difference Matte


zuzzabuzz
11-07-2003, 08:21 PM
Howdy folks,

I'm one of the new guys that took advantage of the Lightwave + DFX+ with Modules 1 and 4.

Unfortunately, no module 2 (which has difference mask). I filmed some footage thinking I did have Difference mask, and got disappointed when I realized I didn't. Anyhoo. I've been trying to come up with an alternative.

At first I tried stuff like Difference merges...which sort of works...but it produces an odd technicolor mask which doesn't always filter out stuff. Being kind of a white guy, and the sky here being kind of bright when i filmed, the difference between my pasty yellow skin and the pale blue sky doesn't really matter when using difference: when converted to grayscale, it's about the same value.

So, i thought, why not find the distance between colors in color space, and use that for the alpha?

Long story short, I used the Custom Tool (in Miscellaneous) and used the following for the Alpha Expression.

1-if((sqrt((r2-r1)*(r2-r1)+(g2-g1)*(g2-g1)+(b2-b1)*(b2-b1))-n1)<n2,255,0)

It uses the Number in 1 and Number in 2 to sort of provide a threshold for how far apart the two colors are to be considered different.

I've just done this over lunch, so when I have time I may refine it.

All the other difference mask tricks still apply (blurring input to remove field noise, filming it correctly to begin with), but hopefully somebody who doesn't have the bucks to shell out for Module 2..but still has the need to help clamp down a mask will enjoy this.

Any feedback or suggestions are welcome.

zuzzabuzz
11-08-2003, 05:15 PM
Forget that last bit, this one is paired down and not so odd:

1-if((sqrt((r2-r1)*(r2-r1)+(g2-g1)*(g2-g1)+(b2-b1)*(b2-b1)))<n1,1,0)

Just paste that in your Alpha expression box (and your r,g,b if you want), and use the Matte control and some garbage mattes to tweak it. Should cut down on time for some, i hope.

sample:
http://www.unm.edu/~buzzbuzz/dmFront.jpg
http://www.unm.edu/~buzzbuzz/dmBack.jpg
http://www.unm.edu/~buzzbuzz/dmMask.jpg

LyonHaert
11-09-2003, 11:59 AM
ooooh, nifty. and I'd just been wondering how to do that when I saw a commercial where a logo was comped onto the side of a barn, but was masked where two guys were walking between the barn and the camera. now I know the term

CGTalk Moderation
01-16-2006, 03:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.