Bokeh Effect in 3ds Max

01 Jun 2010

Bokeh effectIn this beginner’s tutorial we’re going to create a bokeh effect in 3ds Max. The term bokeh is familiar from photography. When depth of field is shallow, part of the photo is blurred. Bokeh refers to that blur or the quality of it. There are a few different methods of creating shallow depth of field in 3ds Max, but this time we concentrate on the ‘Depth of Field / Bokeh’ camera shader which is a new feature in 3ds Max 2011. The Bokeh shader gives us nice tools to control the quality and the look of the out of focus areas.


Step 1 Mental Ray Renderer

We’re going to render the bokeh effect with Mental Ray. By default 3ds Max uses the Scanline renderer so we have to change that. Change the renderer to Mental Ray ( Rendering > Render Setup… > Common tab > Assign Renderer > Production > mental ray Renderer ).

Step 2 The Background

We’re going to create a simple 3d scene and finally add the bokeh effect to it. If you are just interested about the bokeh effect itself, go ahead and skip to step 13.

We’re going to create a simple scene with some text in it but first we create a background. Create a Plane ( Create panel > Geometry > Standard Primitives > Plane ) in the front viewport . Modify the Plane ( Make a selection > Modify panel ) according to the following parameters:

  • Length: 200
  • Width: 300
  • length Segs: 1
  • Width Segs: 1

Plane object

Step 3 The Material for the Background Plane

Open Material Editor ( Press ‘m’ in keyboard ) and create the material for the plane:

  1. Click “Get Material” button and select ( doubleclick ) ‘Arch & Design (mi)’ from the list ( Materials > mental ray > Arch & Design ).
  2. Select the plane and assign the material to it.
  3. Color: dark gray ( RGB 0,16 0,16 0,16 ).
  4. Roughness: 0,2 ( smoothens the highlights )
  5. Reflectivity: 0 ( perfectly matte surface )

Matte material settings

Step 4 Text

Create a Text shape ( Create panel > Shapes > Splines > Text ) in the front viewport . Modify the text ( Make a selection > Modify panel ) according to the following parameters:

  • Interpolation
    • Steps: 14 ( the default value is probably enough is you do only a low resolution render )
  • Parameters
    • Font: Century Gothic
    • Alignment: Center
    • Size: 60
    • Text: bokeh effect

Feel free to select different font or write something different. I chose Century Gothic because those round shapes are good at catching highlights.

Text shape in 3ds Max

Step 5 3D Text

At this point the text is just a shape and can’t even be seen in renderings. Let’s turn it to a 3d surface. Add Bevel modifier to the text ( Make a selection > Modify panel > Modifier List > Object-Space Modifiers > Bevel ). Apply the following parameters ( Make a selection > Modify panel ) to the Bevel modifier:

  • Parameters
    • Surface
      • Curved Sides: YES
      • Segments: 10 ( 3 is probably enough if you do only a low resolution render )
      • Smooth Across Levels: YES
  • Bevel Values
    • Level 1
      • Height: 4
    • Level 2
      • Height: 1,1
      • Outline: -0,6

3d text

Step 6 Material for the Text

Open Material Editor ( Press ‘m’ in keyboard ) and create the material for the text:

  1. Click “Get Material” button and select ( doubleclick ) ‘Arch & Design (mi)’ from the list ( Materials > mental ray > Arch & Design ).
  2. Select the text and assign the material to it.
  3. Color: beige/brown ( RGB 0,734 0,655 0,5 ).
  4. Glossiness: 0,7
  5. Metal material: YES

Settings for a shiny arch & design material

Step 7 Prepare the Scene for Rendering

Let’s prepare the scene for rendering:

  • Place the text into the center of the plane like in picture below.
  • Create a Target camera ( Create panel > Cameras > Target ) in the top viewport.
  • Right-click on the Perspective view and press ‘c’ in the keyboard to change it to the Camera view.

Rendering text in 3ds Max

Step 8 First Test Render

Now is a good time to render the scene for the first time so hit render ( Main toolbar > Render Production ) and you should see something like the picture below.

default render of text

This is our first render so obviously there are some problems:

  • First of all the image is boring, there is nothing interesting
  • There are some rough edges because of low sampling values

Let’s adjust the sampling settings to get a more polished render. Go to the render setup and increase antialiasing quality by increasing Mental Ray’s sampling values ( Rendering > Render setup… > Renderer > Sampling Quality ):

  • Samples per pixel
    • Minimum: 4
    • Maximum: 64
  • Filter
    • Type: Mitchell ( For most scenes the Mitchell filter gives the best results. )

Now the aliasing issues are fixed and it’s time to illuminate the text. By the way, if rendering time is an issue you could use the default sampling values for now and use these high quality settings only in the final rendering.

Step 9 Illumination

Create Mental Ray area omni ( Create panel > Lights > Standard > mr Area Omni ) in the front viewport and apply the following parameters to it ( Make a selection > Modify panel ):

  • Intensity/Color/Attenuation
    • Multiplier: 1,5 ( the intensity of the light )

Place the omni light according to the picture below.

Mental Ray area omni placement

When you render the scene you should get something like the picture below. Move the light if necessary.

illuminated with one omni light

The illumination is improved but the text is too dark and therefore merges with the background. Let’s address these issues with soft shadows and glare. Modify the omni light ( Make a selection > Modify panel ) to get softer shadows:

  • Area Light Parameters
    • Radius: 10

Apply Glare Camera Shader ( Rendering > Render Setup > Renderer > Camera Effects > Camera Shaders > Output > Glare ) Just turn the output shader on, the glare shader should be selected by default. Open Material Editor ( Press ‘m’ in keyboard ) and drag and drop the Glare shader from Camera Shaders to an empty material slot in Material Editor ( make sure to select ‘instance’ when asked ). Make the following adjustments to the Glare shader:

  • Quality: 4
  • Spread: 6

Render the scene the see the effect of these changes. Now shadows are softer and the text is brighter and has a nice glow.

Effect of mr area omni and glare shader

Step 10 Creating Particles

At the moment our scene is really flat so there is no point in adding a bokeh effect just yet. First we’ll create something that will be out of focus in the final rendering. Let’s add some sparkles to the scene. Create a super spray ( Create panel > Geometry > Particle Systems > Super Spray ) in the top viewport and apply ( Make a selection > Modify panel ) the following parameters to it:

  • Particle Generation
    • Particle Quantity
      • Use Total: 1000
    • Particle Motion
      • Speed: 4
    • Particle Timing:
      • Emit Start: -500
      • Emit Stop: 0
      • Life: 500
    • Particle Size
      • Size: 0,5
  • Particle Type
    • Standard Particles: Sphere

Step 11 Path for the Particles

Next we’re going to create a spline and force the particles to travel along it. Create the spline:

  • Activate the Line tool ( Create panel > Shapes > Splines > Line ) and create a line with 4 vertices in the top viewport. The first vertex should be farthest from the camera and the last vertex should be closest to the camera.
  • Select the spline, go to the modify panel, and set ‘Steps’ to 40 ( Interpolation > Steps ).
  • Activate Vertex sub-object level.
  • Select all four vertices, right click on them, and select ‘Bezier’ from the menu.
  • Move the vertices and adjust the bezier handles to create a spline like in the picture below.

    ( For the sake of this tutorial it’s not required to create exactly the same kind of line. However, to be able see
    the effect of a bokeh shader, at least some part of the spline should be close to the camera.
    )

  • Place the super spray to the starting point of the line.

Spline in 3ds Max

Create a path follow object ( Create panel > Space Warps > Forces > Path Follow ), go to the modify panel, and apply the following parameters to it:

  • Current Path: Click ‘Pick Shape Object’ and select the spline we just created
  • Motion Timing
    • Start Frame: -500
    • Travel Time: 500
    • Variation: 20 ( Some variation to the travel time )

Bind the super spray to the path follow object:

  1. Activate ‘Bind to Space Warp’ ( Main toolbar > Bind to Space Warp )
  2. Click and hold on top of the super spray
  3. Release over path follow object

Particles should immediately follow the path like in the picture below.

Binding to space warp

Tip. If you’d like the particles to stray away from the spline, try increasing the particle speed in super spray and/or adjusting Particle Motion settings in the path follow object.

Step 12 Material for the Particles

Open Material Editor ( Press ‘m’ in keyboard ) and create the material for the sparkles:

  1. Click “Get Material” button and select ( doubleclick ) ‘Arch & Design (mi)’ from the list.
  2. Select the super spray and assign the material to it.
  3. Turn self illumination on
  4. Orange (RGB 0,996 0,737 0,459)
  5. Luminance: 2

Glowing material with Mental Ray

Render the scene the see the particles. The glow is really strong but wait till you see it with the Bokeh effect.

Glowing sparkles

Step 13 The Bokeh Effect

Apply ‘Depth of Field / Bokeh’ Camera Shader ( Rendering > Render Setup > Renderer > Camera Effects > Camera Shaders > Lens > Depth of Field / Bokeh ). Open Material Editor ( Press ‘m’ in keyboard ) and drag and drop the bokeh shader from Camera Shaders to an empty material slot in Material Editor ( make sure to select ‘instance’ when asked ). Make the following adjustments to the Bokeh shader:

  • Focus Plane: The distance from the camera to the text ( 301 in my case ). The easiest way to measure the distance is to align the camera target with the text and check the camera target distance from the camera parameters ( Select the camera > Modify panel > Parameters > Target Distance ). Focus plane is the area of the scene that’ll appear sharp in the rendering.
  • Radius of Confusion: 2 ( The amount of blurriness )
  • Samples: 32 ( The quality of the blur. ) This value has a dramatic effect to the rendering time. If the rendering takes too long, decrease this value. I rendered my image with 256 samples to get silky smooth noise free bokeh. The downside was the 7h rendering time with my quad core 2,33GHz Q8200.

Depth of Field / Bokeh settings

Now we’re ready to render the final image with the bokeh effect. I made some adjustments in Photoshop as well:

  • Brightness: +25
  • Contrast: +40

Bokeh effect in 3ds Max

Let’s continue in the discussion. Patience with the rendering!

Click to share if you like it!

55 Responses to “Bokeh Effect in 3ds Max”

  1. FAQPAL says:

    Fantastic effect, thanks for the share.

  2. stupid flandish says:

    Hi,

    great tutorial. I can not choose the the Depth of Field / Bokeh efect. It is not in my list. I use Max 2010

    • polygonblog says:

      Hi!
      Unfortunately the Bokeh shader can be found only in 3ds Max 2011.

    • Joe says:

      The Bokeh shader in Max 2010 is hidden from the user interface, however it can be easily made available to you. Located in the file:

      C:\Program Files\Autodesk\3ds Max 2010\mentalray\shaders_standard\include

      is the file architectural_max.mi which includes the lines:
      gui “gui_mia_lens_bokeh” {
      control “Global” ”Global” (
      “uiName” ”Arch: DOF / Bokeh”,
      “hidden”

      Simply put a # before the line that says “hidden”, save the file, open Max and you will now have the Bokeh lens shader available.

      • polygonblog says:

        Thanks for the brilliant tip Joe!

      • 3alisha says:

        Great ! Works beautifully :D

        Cheers !

      • Mathias says:

        thank you very much! works perfect!

      • Spencer T says:

        Wow! Works great. I assume this applies to all of the other effects marked “hidden” in this folder?

        - Spencer

      • Benno says:

        Great! :D

      • Jared says:

        Awesome find. Thanks a lot!

  3. Esphan says:

    Awesome tutorial… Looking forward to more like this. Holla

  4. Balaji says:

    Great! You Guys Improving the site with the best tutorials!

  5. Tyler Woods says:

    For the samples a good value for testing is 2 or 4, for the final render more than 32 is overkill…

    • polygonblog says:

      Thanks for the tip! I made a change to the tutorial. 256 samples might be insane but it produces nice noise free bokeh. I can still see difference between 128 and 256 samples.

  6. Mimo says:

    Good job, It made me try it out

  7. cookiesze says:

    Where is the Area Light Parameters ?

    • Mathias says:

      When you place your Mr Area Omni Light and you press the modify button (normally on the right on youre screen, the 7th tab is the Area Light Parameter. So you got General Parameters, than Intensity/color/attenuation, than Advanced effects, and when you keep getting down you find the parameters where you search for…

      but i have a question to :o )
      because i’m stuck over there…when you now press render, do you get the smooth vision and clearder words than before? because on my render there isn’t changed something…

      good luck!

      • polygonblog says:

        In the second rendering in step 9, you should get brighter glowing text (because of the glare shader) and softer shadows because the ‘Radius’ value in Area Light Parameters have been increased.

  8. Mathias says:

    Hi,
    I’m a bit stuck on step 9 :s when I instance copy the glare to the material editor en put quality on 4 and spread on 6 and render than i dont see a clearder picture or some blurrie words… i’m using 3D Studio Max 2010…

    thanx a lot!
    greetz

    mathias

  9. SY Design says:

    thanks for your step by step tutorial..

    it’s very useful for beginer..

    by. SY Design

  10. SY Design says:

    helo..host..

    is it depth of field/bokeh effect take long time to render??

    how long u get to finish render?

    • polygonblog says:

      High samples value in Bokeh shader means long rendering time. I rendered my scene in about 7 hours because I used 256 samples. You could try for example with 32 samples to keep the rendering time reasonable.

  11. 3alisha says:

    Thank you for sharing this great tutorial, very useful :)

  12. cookiesze says:

    Thank you Mathias.

  13. cookiesze says:

    super spray does not follow the line
    Please tell the more detailed with this.

    Thank you.

    Postscript Sorry if English is not good

    Translation from google.

    I am no good at English

    • Mathias says:

      I had the same problem, be sure that you bind the super spray with the path follow…you do this like Polygonblog explaned :) you click on bind button allmost in the left corner of your screen, click on superspray and don’t let your mouse button go, and move to path follow… (you will see striped lines)because when you entered your path follow and connect with your line on the modify panel like written in this tutorial, the super spray should folow the line…try a few times, it was oslo new for me but it works for sure ;)

      good luck!

  14. ariez says:

    Great effect bro. Btw, is this thing can be animated? If this couldn’t, then how? Thanks.

    Can wait for next awesome tutorials…

  15. Leandro 263 says:

    This lens shader is also hidden in Max 2008. The same procedure Joe detailed for Max 2010 can be made to turn it on in the 2008 version. I’ve used it once in a simple scene, worked fine.

  16. cookiesze says:

    thanx a lot.

    Mathias

  17. suhana says:

    hye..really great tutorial but i stuck in how to apply the super spray..i cant make it appeare..(picture above the step 12)really need ur help..hee im a newbie by the way…thx alot! =]

  18. suhana says:

    owh..u already answer in above..
    sory for my poor english..=[

  19. Thank you for sharing this great step by step tutorial, very useful, mental ray is really good.

  20. Meme says:

    wo0o0ow, thanks for brining up this useful tutorial. You did a great job. I will check ur blog often so keep it up ;-)

  21. DiSFR says:

    I’m kind of stuck… My particles just show up small and with poor glare… I checked all values and it still with no “life”… Everything else is OK, it’s following the path and everything… Some help, please?

  22. Uzair says:

    When i drag the line over the square thing, it says “cannot bind: Would create dependency loop” :(

  23. Uzair says:

    Like 2 people above, im also lost. Al though they might have figured it out, but i haven’t.

    Please help :’(

    Also, you might want to have videos of it too :D

    • polygonblog says:

      Make sure you bind the super spray to the path follow object.

  24. soah says:

    Great tutorial :D

  25. Surean says:

    thanks for the great tutorial

  26. Lucas says:

    I just had a little problem with the tutorial, it was time to render it took too long and could not finish more than otherwise excellent tutorial blog polygon always recommend to my friends

  27. Nojvok says:

    Excellent Tutorial. The only issues I had were self induced and quickly corrects to get the awesome effects once I re-read the section. lol… Particle Quantity, use TOTAL: 1000

    Thanks for such useful stuff. :)

  28. sadvel says:

    July 3,

    I’ve finally found this. Great tutorials!

  29. Lucas Ragnarson says:

    Why I can’t set my samples to 256? The max here is 128.

    • polygonblog says:

      I have no idea. In my system the max is 1024. Perhaps a different version of 3ds Max or a memory related problem…

  30. momo says:

    Hi,

    great tutorial. I can not choose the the Depth of Field / Bokeh efect. It is not in my list. I use Max 2009
    can i use Bokeh effect

  31. Aparna B R says:

    Thanks a tons… Its a lovely effect!!!

  32. ckppixy says:

    Hi
    Great Tutorials! Its a lovely effect!!!! Thanks!

  33. Quik says:

    Thanks! very very good tutorial! easy as heck to follow, and i got a nice result from it! thanks!

  34. Hagane says:

    Awesome, keep on rockin’

  35. Naz says:

    Awesome tutorial. I’m just having a problem with the rendering. When I try to render I get an error, “Missing Map Files – bokeh.tif”. I’d really appreciate it if someone could post me a link to the file. Using max 2011. Thanks.

  36. Leo says:

    Hi i don’t have the glare shader is it my 3ds max i have 3DS MAX 2009

    • polygonblog says:

      It’s there but it’s hidden. Read the comments.

      • Leo says:

        oh yea :D

  37. Leo says:

    Me again i have another problem when you have to put the material on the particles i don’t have self illumination (Glow) can someone please respond i have 3DS MAX 2009

Leave a Reply