Bilateral blur denoising for Hair?

Hi all, I recently found this awesome bilateral denoising technique:
I downloaded it and saw that it doesn’t work on subsurface scattering and hair particles.
Thats typically since I have noise troubles with a hair animation, and it would take about a week to render it out if I increased the samples to get rid of the noise. :(:(:(:(:frowning:
I’m not experienced with using compositing nodes at this level, so could you please take a look at it and see if it’s possible to make it work for hair particles/SSS too?
I’m sure I’m not the only one who would save days of render time with this.

Link to the project:

It works for SSS if you include the SSS passes and perform the blur thing on them too. Hair should be ok as well, but remember a lot of hair noise is actually antialiasing noise which this trick can’t help with. You just need more samples for that. Or try using the minimum pixel width. And deformation motion blur or transparency on hair will murder your render times. If you are having issues with that, consider going without.

EDIT: typo

Hmm, when taking another look on this I see the that my problem isn’t about any noise, it’s some sort of halo that appears around my hair particles.
And when I take an even bigger look I realise that it’s no halo at all: it’s the particles that lie in front of a transparent background that adapt colour from it. If I turn the BG lighting off the “halo” is gone.
So that leaves me two alternatives: either I use no transparent background or I use no BG lighting. :frowning:
My .blend: bilateral_blur_denoising (2).blend (1.67 MB)

Pls somebody take a look :wink:

Took some time to untangle it from that ridiculously complex node group (always simplify your scene when troubleshooting!!!). The problem is coming when you add your environment pass back to the main scene before using the transparent background for anything. This breaks premultiplication, and does it in a way that is not recorded in the alpha channel, namely applying a blur and filter to RGB but not to alpha. Thus making it impossible to fix farther down the comp chain. (ie, with the alpha convert node).

The entire point of rendering with a transparent background + env pass is to add the environment to your backplate then comp it in all at once (or just discard the rendered background entirely). Adding it to the foreground before putting your backplate over the shot doesn’t make any sense.

If there was any way I could explain how much you’ve helped me… :smiley: :smiley: :smiley: :smiley:
I didn’t even know about that enviroment pass…
Thank you thank you thanks you thank oyu!!! :smiley:

Hmmm, if I could ask another question… I see that my normal maps isn’t included in the “normal” pass in cycles: which have all my precious details achieved with normal maps blurred. Is there a way to include the normals created with normal maps in the normal pass in cycles?