Surface Blur

July 11th, 2006 . 5 comments

I did a bit of an experiment the other night as a proof of concept for a new node type that would be very nice. Although it’s unfinished and disabled for version 2.42, it’s planned that we’ll be able to extract an Ambient Occlusion pass into the compositor with Blender’s pass rendering system, which will make it much easier to manipulate, doing colour corrections, changing blend modes (screen/multiply/overlay are better blender modes than the built-in add/subtract/add+sub).

One very useful manipulation that could be done is to blur the AO pass along the surface of the geometry, to smooth out noisy sampling.

blend iconA test .blend file


Blurred AO - rendered results

I’d like to be able to blur the AO pass in post, in order to get away with having less samples (faster render time) and to prevent flickering during animation. However just evenly blurring across the entire AO pass image won’t work, as the shading will blur outside the edges of objects and look ugly. Photoshop has a filter called ‘smart blur’ which does some kind of edge detection and masking in order to only blur the smooth areas, and leave sharp areas intact. Something like that would be a help, but that’s just doing an edge detect on the image itself, which probably isn’t all that accurate. Since we have plenty of information about the objects’ 3D geometry in the compositor via the Normal and Z passes, we should be able to make better use of it, and make the blur mask based on that information, to blur the smooth areas of the surfaces, but not across edges or corners.

If I knew more about filter programming, I might have a go at this myself, otherwise consider this a feature request 🙂 I mocked up a test using a whole bunch of nodes – A screenshot of the node setup is below. Basically, it takes each of the normal channels, does an edge detect on them, then tweaks and combines them back together as a mask for a blur. I’m sure a properly coded approach would be much better, perhaps doing things like comparing normal vector angles, masking and sorting based on Z depth, etc. but the results I have already with nodes are decent. The example image above shows the render without AO, with 4 sample AO, and the same thing with the AO pass ‘surface blurred’. 4 samples is usually ridiculously low and noisy, but it’s not too bad with the blur. If anyone wants to have a go at coding this, I (and I’m sure many others) will be most delighted!

Surface blur nodes setup

§ 5 Responses to Surface Blur"

  • Jiri says:

    Hi Matt,
    this is very good suggestion. I guess, that something like this exist in Gimp … run Gimp, open image rendered with AO, RMP, Filters, Blur, Selective Gaussina Blur … Is this case, what you want?

  • Matt says:

    Hi Jiri:

    It’s not really what I want – Photoshop has something similar called ‘smart blur’ too. In both cases, those filters are just using the existing RGBA pixels to decide what to blur and what not to blur – basically just guessing with an edge detect filter. In Blender we have a lot more information about the geometry’s surface (with the Normal and Z passes) so it would be good if we could use that information to make a more accurate mask for the blur.

    cheers

  • Darek says:

    Hey Matt, that really would be useful. I’m tired of waiting for all those extra passes to render.

  • Jiri Hnidek says:

    Hi Matt,
    aha, I can see it at screenshot. You do sobel filtering of two directions of normal map, etc. That’s true … we can get much better result using such methods.

  • RC says:

    Hi Matt,

    cant this approach be also used to avoid the “UV islands” problem with http://mke3.net/weblog/fast-fake-sss/ ?

Leave a Reply

Your email address will not be published. Required fields are marked *

What's this?

You are currently reading Surface Blur at Matt Ebb.

meta