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!

111 Responses to “Bokeh Effect in 3ds Max”

« Older Comments
  1. anilee13 says:

    Hello,
    I have 3ds max 2009 and don’t have the bokeh/depth of field how can i get or what do i use?

    • KEN says:

      get 3ds 2010

    • pras says:

      1. Open architectural_max.mi file using notepad. The location of this file is in Program Files \ Autodesk \ 3ds Max 2009 \ mentalray \ shaders_standard \ include
      better backup this file first to be safe if there are mistakes.
      2. Find the line of code like this:

      gui “gui_mia_lens_bokeh” {control “Global” “Global” (“uiName” “Arch: DOF / bokeh”, “hidden”

      in the text “hidden” add a # in front of it so that it becomes # “hidden”.
      3. Save the file architectural_max.mi

      restart your 3ds max, Now mia_lens_bokeh shader ready for use.

  2. evandro says:

    in Brazil’s like to work
    keep it up
    P.S my english no good

  3. Todd says:

    Is bokeh/depth of field in Max 2011. I have 2009 and can’t find it.

  4. Anirudha says:

    @anilee13.
    the shader is hidden in max 2009. you have to unhide the shader by editing a mental ray settings file. check this link http://www.mastering-mentalray.com/blog/?p=84

  5. gfxfreak says:

    Really nice!

    Hope you can throw up some iray tutorials soon also!

  6. Dila says:

    I’m a newbie, sorry for asking but… I’m stuck at “pick shape object” in the path follow properties… It wont let me use that to click on the line.

    Its probably something really easy.

    Thanks for the tutorial anyway!

  7. Sareth says:

    3ds max at the begginning of it has different material editor. How can i change it so it looks like urs?

    • polygonblog says:

      Open Compact material editor ( Rendering > Material Editor > Compact Material Editor ).

  8. somyadeep says:

    hey dude , thanks for this tutorial …………. it helped me a lot …carry on ..

  9. Sareth says:

    Hi I got a problem

    In Step 9 ”
    * Area Light Parameters
    o Radius: 10 ”

    I cant find that. Can u explain it to me?

    • polygonblog says:

      Make sure you have created ‘mr Area Omni’ and not Omni.

  10. Sareth says:

    Hey one more thing

    In the last step when i am rendering (finish proces, btw i still need heplp with this omni light shadow) it says that bookeh.tf is missing. I got 3ds max 2011

    • polygonblog says:

      I have no idea about that error message. Does it work anyway?

      • Sareth says:

        Everything renders fine (except its taking quite long xd) but it shows everytime I render it or open a file. I dont really see the difference when using Bokeh effect, could you explain to me what it does?

  11. Jose says:

    Im trying to make a infinite loop with the particles on an animation, problem is at frame 100 it explodes and does not follow the path anymore.
    Any tips?
    thanks and great tutorial.

  12. patrick says:

    Thanks for the great tutorial, but I have a question about the self illumination. This option isn’t visible in my workspace. Do i have to enable something?

    Thanks for your help!

    Keep up the good work!

  13. Vale says:

    Great work…I must be an idiot because I followed it EXACTLY word for word, line by line and my project looked NOTHING like this. I applaud the outstanding work!!

  14. harish says:

    hi,

    awesome work that u shared with us, Thank u so much. but i want to ask u, How can i decrease the super spray particle?
    Please tell me.its urgent

    • polygonblog says:

      In step 10 se set the particle quantity to 1000 (Particle Generation > Particle Quantity > Use Total: 1000). Just decrease the value.

  15. Beaner500 says:

    Never mind my last comment. GREAT TUTORIAL! Thanks!

  16. nick says:

    The result for my render after applying glare effect with the settings as your turned out to be different. I can see glow on one alphabet only…How come?? can i know what is the problem?? I am using 3dsmax 2010 but i cant find bokeh effect in my camera shader lens….can anyone help me??

  17. LEOLJZ says:

    thank you very much~

  18. MemoNick says:

    Where do the spheres get their orange light from?

    PS Thanks for a great tutorial.

  19. Habibie says:

    hi.. could u share the project file too? ;)

  20. sir i have a doubt .
    its quiet difficult for me to render such a scene with the help of mental ray as my system can’t afford that much ram . its just 3 gb .and could u please let me know if i could add glare and render out a fine scene without using mental ray ?

  21. very grateful & unique bokeh effect thanks

  22. Calibur25 says:

    Nice tutorial, I followed your instruction with little difficulty. I’m looking forward to learning more little tricks to round out my knowledge in 3DS.

  23. metus says:

    awesome tutorial, looks great.

  24. Ganesh Srivastav says:

    Sir i didnt get the depth of feild in my lens options. What to do?

  25. Patryk J. says:

    This is incredibly stunning. Thank you for sharing that with the world, haha!

    But I do come across two tiny bugs: 1) When I’m rendering after I’ve placed that ‘mr Area Omni’, I see a strong light just in the middle in the like of a bulb.. Which is unlike what this tutorial shows; 2) I don’t know how, but now,(that is a few minutes after messing up around~I’m very much of a newb, hah), whenever I select to render the whole thing, I get a nice black render.. I mean, nothing – just plainly all black!

    I don’t know if that matter, but I run with the 2009 version (64Bits).

    • Patryk J. says:

      Never mind the second problem; it has been fixed by importing then exporting the whole thing. :)

      • Patryk J. says:

        Also, the first problem has somehow vanished… Anyways, thanks a lot again for this BRILLIANT tutorial.

        Peace!

  26. Patryk J. says:

    Oh, Can someone help me out here….

    Whenever I render up, I get that: http://img811.imageshack.us/i/twfo.jpg/

    ANd here is how everything is placed: http://img811.imageshack.us/img811/9980/twfw.jpg

    Any help would be nice, thx!

  27. Patryk J. says:

    Alrighty. I finally figured it out how to get rid of the light bulb when rendering the whole thing.
    Select your camera, go to Modify – Parameters, before the Stock Lenses, uncheck ‘Orthographic Projection’. And voila!

    but I was unable to complete the Bokeh Effect because of the incredible lag I’ve been getting. I suppose because of the low cache size on my CPU.

    http://img38.imageshack.us/img38/1271/twfbw.jpg

  28. Digiart247 says:

    Awesome simple and neat. Only heard about new bokeh depth of feild in an article i read about max 2011 saying how great it was. well just got max 2012 update and figured i should look that up. your tutorial was simple and awesome. only needed the last bit cuz my scene was already made but man did it make a difference! thanks so much!

  29. rulax says:

    step 11 is driving me crazy! I go through the steps of creating a path follow object, but i can not click ‘Pick Shape Object’, it is grayed out! so i cant select the spline, which in part i think is also the reason why i cant bind the super spray to the path follow object. (which was the next step)

    any help!? i have been doing well through this process and i’d hate to stop now!

    • Okomikeruko says:

      The “Pick Shape Object” will be grayed out in the Create Tab, but should work once created and you go to the Modify Tab.

  30. irishd00d says:

    Hi, great tutorial. But I can’t get the “Depth of Field / Bokeh” it’s not anywhere to be seen. I have 3ds2010 so it should be there..
    Please help :)

    • Okomikeruko says:

      The “Arch: DOF / bokeh” lens shader is hidden in both 2009 and 2010 versions. Follow this previous post to unhide it.

      pras says:
      October 12, 2010 at 8:24 am

      1. Open architectural_max.mi file using notepad. The location of this file is in Program Files \ Autodesk \ 3ds Max 2009 \ mentalray \ shaders_standard \ include
      better backup this file first to be safe if there are mistakes.
      2. Find the line of code like this:

      gui “gui_mia_lens_bokeh” {control “Global” “Global” (“uiName” “Arch: DOF / bokeh”, “hidden”

      in the text “hidden” add a # in front of it so that it becomes # “hidden”.
      3. Save the file architectural_max.mi

      restart your 3ds max, Now mia_lens_bokeh shader ready for use.

  31. ENS says:

    Hi

    great tutorial!
    but I have a problem.

    I get a sign saying “Missing Map Files”, and the file is “Bokeh.tif”. Anyone know where I can get?

    I’m using Max 2012

    Regards!

    p.s.: forgiveness for my bad English, I’m using an online translator :S

  32. Aca says:

    Hi, I have the same problem as ENS, but I use max 2011. Somebody could help us?

  33. adrian says:

    gracias ya e entendido mejor este software

  34. ashwin says:

    hello , i am so confused how to place super spray and how to create particles .. as u shown here .. i mean i am so confused in step 10 and 11 pls help .. me

  35. DV says:

    Hi, Does someone have bokeh.tif file? I’m using Max Design 2012. Eveything perfectly done. But when redering it says bokeh.tif missing…

  36. Fen says:

    hey. where can i find Glare??

« Older Comments

Leave a Reply