really fast, smooth, ray-traced, indirect lighting, and occ

So, the idea of blurring the ray-traced indirect lighting and ambient occ passes some how, has been rattling around in my mind for awhile, the problem always was that the blur would bleed between the objects. Then a few days ago I was experimenting with the compositor and realized how ridiculously powerful it is. I also realized that there was this little node called ID mask…

So long story short: IDmask into 1x blur, inverted, mixed with (1 sample IL*OCC), into 16X blur mixed with black with the inverted IDmask as the fac mixed with the diffuse and spec=
http://www.dgdigital.net/blenderblurtrace/1smpl-blur-16sec.png
^16 seconds, 1 sample OCC & IL^

So here are a bunch of renders showing different settings:

without the blur but at 22 samples, 4min 18sec:
http://www.dgdigital.net/blenderblurtrace/IL-ray22-2b-4.18min.png

without the blur, 1 sample, 16sec:
![http://www.dgdigital.net/blenderblurtrace/ 1smpl-noblur-16sec.png](http://www.dgdigital.net/blenderblurtrace/ 1smpl-noblur-16sec.png)

without the blur, 1 sample with cache, 1min 2sec:
![http://www.dgdigital.net/blenderblurtrace/ 1smpl-cache-noblur-1min2sec.png](http://www.dgdigital.net/blenderblurtrace/ 1smpl-cache-noblur-1min2sec.png)

only IL, blur, 1 sample, 16sec:
![http://www.dgdigital.net/blenderblurtrace/ 1smpl-blur-16sec-onlyIL.png](http://www.dgdigital.net/blenderblurtrace/ 1smpl-blur-16sec-onlyIL.png)

only IL, noblur, 1 sample, 16sec:
![http://www.dgdigital.net/blenderblurtrace/ 1smpl-noblur-16sec-onlyIL.png](http://www.dgdigital.net/blenderblurtrace/ 1smpl-noblur-16sec-onlyIL.png)

approx IL, noblur, 0.25 error, cache, 20sec:
http://www.dgdigital.net/blenderblurtrace/approxIL-0.25-cache20sec.png

no IL or OCC, noblur, 10sec:
http://www.dgdigital.net/blenderblurtrace/noIL-noOCC-noblur-10sec.png

Basic explanation of what’s happening: blender renders the scene with the indirect light and OCC separated from the diffuse/spec. It then separately masks and blurs the indirect light and OCC for each object then mixes it back with the original image.

Also, my renders are all slow because I’m using a vintage single core Athlon64…

and here’s the .blend
btw, I’m using render branch 2.52 r29776 because it seems that there is no 2.53 render branch yet… if there is please let me know :slight_smile:

There are many many obvious issues, but I think if this were implemented into the renderer like the cache, and set to mask every face instead of every object it has the possibility of being a viable time saver…

Another option would be to do this but almost backwards: have a script that bakes OCC & IL then blurs that bake and applys it to all objects from only the camera’s perspective.

P.S. this is my first post I’m really sorry if it is in the wrong place/if I have set it up wrong…

very interesting and nicely illustrated, thanks

It took 4 seconds to render here. The result is impressive, but I have to admit that I have a preference for the built-in approx IL render in this case.
With the red room scene, there is no visual difference between approx and your node setup, but in this case, the node render is 50% faster than approx. (21 vs 45 sec). So it could be quiet helpful in some specific case
A draw-back is that reflection can’t be blur with your setup.

Approx

http://i1013.photobucket.com/albums/af260/steapheos/th_redroomapprox.png

With nodes
http://i1013.photobucket.com/albums/af260/steapheos/th_redroomnode.png

Btw, a 2.53 render branch build is out on graphicall, but the indirect light does noting at first bounce (At second bounce, results are a bit strange). Did I miss something or is it a bug?

Btw, a 2.53 render branch build is out on graphicall, but the indirect light does noting at first bounce (At second bounce, results are a bit strange). Did I miss something or is it a bug?

Same here, a mac build.

A draw-back is that reflection can’t be blur with your setup.

Yes Steaph, you are right about the reflections I did a few tests with mirrors and got some quite horrific results hahaha… it seems the only ways to get around it is include the reflection in the IDmask somehow (which would likely be very problematic due to all the various settings that mirrored objects can have) or to get the IL and OCC layers first then mirror. But I’m beginning to think that baking IL and OCC from the camera’s perspective and blurring might be more effective. This would completely avoid the problems with the mirror and if implemented efficiently could speed up animation render times greatly.

Also, thanks Steaph for testing my node setup on another scene! It’s good to see that it’s working well on something else, and also nice to know it’s still faster :slight_smile:

About the 2.53 render branch, I’ll have to check it out soon and see if I get the same problems.

dgriffin91 your results are good but theres a simpler way, use the bilateral blur node to blur the GI and AO, it uses normal and z-depth data to sorta aid in bluring so it doesnt bleed across the entire object. and if you want to blur reflections you can just create a reflection pass and exclude it from combined, blur it using bilateral blur then mix it back in. its pretty simple.

heres a link for more information on the bilateral blur node:http://wiki.blender.org/index.php/Doc:Manual/Composite_Nodes/Types/Filter

scroll down the page and you’ll see it

heres an example .blend using my technique

Attachments

bilateral blur.blend (650 KB)

Thank you deathmetal for your input, I didn’t know about the bilateral blur node.

So here’s my test image with a slightly modified version of deathmetal’s method using the bilateral blur.

http://www.dgdigital.net/blenderblurtrace/bilaterelblur22sec.png

It took 22 seconds to render, 6 seconds longer than the IDmask method, and 2 seconds longer than approx (only IL). One big advantage to this is the amount of objects in the scene does not affect the render time. Also, the blurring is in general more actuate. Another big advantage is that the order of applying the OCC and IL is correct: (image+IL)OCC… whereas with the IDmask method I had to do (ILOCC)+image which gives different results. The down side is the obvious artifacts created. Additionally the amount of time necessary to apply the bilateral blur exponentially increases with image size because the number of iterations must increase with the image size to blur the IL and OCC the same amount relative to the image.

[Here’s a blend file using the bilateral blur on my test image](http://www.dgdigital.net/blenderblurtrace/bilateral blur.blend)