Roll Your Own Matte Blur

Here is how to build a “matte blur”, which is a blurring method that will ONLY blur inside of the matte and not incorporate pixels outside of the matte. I’m posting it here becuase I used to post it every few months on the facebook page and it was always popular.

  1. draw your matte
  2. combine your fill and matte with a COMP node by plugging the fill into the red input and the matte into the first blue input. You don’t need to change any settings. This creates what we in the biz call a “multiplied fill”, but is also often called a “premultiplied fill” by fans of unnecessary prefixes.
  3. plug both COMP outputs (fill and matte) into a regular old BLUR node (you can use any blur-type node provided it does not mess with the color, so if you use the defocus setting make sure highlight gain is set to 1), and wind up the blur.
  4. plug both BLUR outputs (fill and matte) into another COMP node, same as you did before, but this time set the output’s fill state to “unpremultiplied” (which any sane person would call “divded” but I digress)
  5. with yet another COMP node, plug your source image into the back input (green), your divided (or, um, un-pre-multiplied) fill into the red front input and your original matte into the first matte output. like the first comp node, you do not need to adjust any of the settings on the node. An ACTION node works just as well.

and there you go: a matte blur.

That there are muliple matchbox shaders (y_blurs, and K_BlurMask) that do exactly this under the hood and work great.

Nonetheless, knowing how this works is very useful.

14 Likes

This is great, especially with your added “asides”…
Clever AND useful!
Me like!
Thank you!

3 Likes

Great Tip, @andy_dill
I think step 4 requires setting the the input state to “premultiplied” for correct unpremultiplication… if I’m not mistaken?

4 Likes

You are right! Good catch!

Thank you Chris!

2 Likes

ok, I’m probably an idiot but what is the benefit to this method over Use Matte in the Blur node? Please feel free to mock me for missing the point. Or for any.other reason.

1 Like

How can you be mocked when you deliver this geniusness?

“ Horizontal, like the direction my body is laying the day i use vertical reels”

1 Like

LEGIT QUESTION GREGBLURS !

The way “use matte” works is it blurs the image and then comps it through the matte. The problem with that is if you have a color near the edge of your matte, it will be blurred into the masked region. For example, if you are doing beauty work on someone’s nose, the dark area of their nostril could get blurred into your masked region.

by doing the “roll your own” you isolate ONLY the colors inside the matte, so when blurred no other colors in the area are incorporated.

With the attached pic I applied both, and you can see the difference.

4 Likes

Ah, I see. Thank you for sharing that insight. I honestly thought blur was smart enough to not pull from beyond the matte edges. Good to know.

1 Like

For what it’s worth there is a feature request to implement this: FI-00721

2 Likes

For anyone that’d like to learn how to upvote Flame Feature Requests, I’ve made that a post. Lemme see if I can link to it.

1 Like

Hey @andy_dill you are up to 10!

1 Like

Thank you. This one would be a real win for the community, even if there are multiple matchboxes that do this. Native-built functions are a good thing because people don’t wade into Matchbox Town until they know what they want.

Population: Us

Here because of @digitalbanshee’s briliant logk live the other week,

Thanks for breaking this down @andy_dill this is a very very useful tip, cant believe i have lived without it!

3 Likes