2008-03-01

Bokeh Effect

This is a phenomenon familiar to photographers and is one that I have been obsessed with over the last couple of days. Just recently I have tried to emulate the bokeh effect in my renderings. Simply put, this occurs when an object is out of focus, and a point of light happens to be much brighter than the surrounding points.
There is a very easy way to do this using Max 2008. There is actually a mia_lens_bokeh shader that Autodesk has developed. It’s one of the hidden shaders in architectural_max.mi file, and is useful for creating this type of depth of field as well as other effects such as chromatic aberration. You can unhide the shader by opening architectural_max.mi in a text editor and where you see mia_lens_bokeh, put a # in front of where it says "hidden". Next time you run Max you will see this shader when you click on Lens shader in your render settings. Remember to drag it into the material editor (instance) to control the properties.
The depth of field in this example was quite extreme, but I was trying to demonstrate the effect. It is important to note that this effect doesn’t work if Enable is checked under Multi-Pass Effect on your camera. In other words, let the shader on the lens do the DOF work not the camera. It will also render faster. If you have DOF on, in your camera settings, the bokeh lens shader just works on-top of this…blurring the image too much. To get the blades to show, I had to crank up my sampling to 64.

8 comments:

  1. excelent example..

    what combination and values use in bokeh for this example???

    ReplyDelete
  2. I've seen some of them. But I'm really thinking about one of memoriable render about bokeh effects. Take a look, it's great in quality and clean n sharp in effects. http://www.rayflectar-graphics.com/root-rayflectar/Maxwell/GalleryImages/Snaphooks-b.jpg
    Not to mention Maxwell, here you use MentalRay but he's done a great job with scene managing and lighting setup.

    ReplyDelete
  3. Any way to hook the focus plane up to an object? Otherwise controlling the focal point would be near impossible during an animation...

    ReplyDelete
  4. You can have your camera target follow an object and you can use the distance length in your camera settings to key the distance in your shader.

    ReplyDelete
  5. Great post!! Following on from Chris I cant seem to get the focus plane to change over time.. For example a value of 100 on the first frame moving to 1500 on the last frame?

    ReplyDelete
  6. This comment has been removed by a blog administrator.

    ReplyDelete
  7. just use camera target as dof focal point then u attach camera to a helper and animate the helper and target if needs be!

    ReplyDelete
  8. Ramy,

    can you do (or disect) an exterior rendering? i find those to be the most challenging, trying to capture accurate light, even with Mental Ray and Daylight system. I appreciate all your posts, and am a big fan of your work...was also in your class at the AU...great tutorial!!!

    Rafael

    ReplyDelete