Unlimited AE and Premiere Pro templates, videos & more! Unlimited asset downloads! From $16.50/m
  1. 3D & Motion Graphics
  2. 3D Studio Max

Quick Tip: Depth of field with 3DS Max and V-ray

Read Time:6 minsLanguages:

In today's tutorial, Ben Henry walks us through how he sets up Depth of Field (or DOF) in his renders using 3Ds Max and Vray. After covering the camera settings and adding DOF to the scene, Ben also takes a quick look at how to add Bokeh effects to your final render. If you're looking to create more photo-realistic results with 3Ds Max, look no further than today's Quick-tip.

Additional Files/ Plugins:
  • Download the Project Files for this tutorial

    • Background Knowledge

      Depth of Field (also known as DOF) is the effect of your foreground being in focus, while your background is blurred (or out of focus) or vice versa (the other way around).

      Before we begin with the tutorial however, we need to talk a little about some of the VrayPhysicalCamera properties and how they relate to a real camera :

      • The film gate is the part of the camera behind the shutter that catches the light and determines the final Aspect Ratio of the image. This works the same way on real life cameras as it does with the VrayPhysicalCamera.
      • The focal length is the range between the front of the lens to the place where the camera is focused, which can make the camera have a bigger viewing range or smaller viewing range. If you want the viewing range to be bigger then make that number smaller, and vice versa. Again this works the same way on both real life cameras and the VrayPhysicalCamera.
      • The zoom factor, as you can probably guess, is the zoom of the camera.
      • The f-number basically describes the iris of the camera; the lower the value, the more open the camera’s iris will be, which in turn creates a more blurred background. This works the same way on both real life cameras and the VrayPhysicalCamera.
      • The shutter speed is a camera'’s exposure time - the length of time that the shutter is open. It affects the motion blur in that the lower the shutter speed, the longer the streaks of the blur there will be and vice versa. This works the same way on both real life cameras and the VrayPhysicalCamera.
      • The ISO or film speed is the camera's sensitivity to light. The higher the value, the more sensitive the camera is, making the images/renders brighter, and vice versa. This works the same way on both real life cameras and the VrayPhysicalCamera.

      So as you can see, the VrayPhysicalCamera is identical to a real camera in a lot of ways. Now that you have learned a little about the different camera settings, let’s put it into action!

      Step 1

      Before we begin, we need to make sure that we change our renderer to V-ray. Bring up the Render Setup window, go to the Common tab, and then scroll down to the bottom where it says Assign Renderer. Click the button to the right of the Production line and choose V-ray in the dialog box that pops up. Click Ok.

      Step 1 Step 1 Step 1

      Step 2

      In order to test the DOF we need to out together a test scene. Head to the Create panel, select Geometry, and place a few boxes a little like I've done in the image below.

      Step 2 Step 2 Step 2

      Step 3

      Next, click on the Cameras button in the Create panel, click the Standard roll-down menu, click V-ray, and then create a VrayPhysicalCamera. Once created, move it into position as show, making sure that it's aimed at your objects, and that the target is where you want your focus to be.

      Step 3 Step 3 Step 3

      Step 4

      Next we are going to go in and change the settings on our camera. Select the camera, and go to Modify. Here we will set the F-Number to 1, the Shutter Speed to 1000, and then check the box that says Specify focus, which allows us greater control over the focal planes of the camera.

      Change the Focus Distance value until the blue grids in the top viewport are in the section you want to focus on. Then go down to the Sampling parameter and check the box next to Depth of Field, setting the Subdivs to 15.

      Step 4 Step 4 Step 4

      TIP : Changing the Subdivs will make the depth of field effect smoother. The higher the number, the smoother it will be, but the longer it will take to render.

      TIP 2 : The smaller you make the scene, the blurrier the depth of field will be, as shown in the image below. If your scene is far too big you might have trouble getting the depth of field effect at all. In essence, always try to scale your scene realistically.

      Tip 1 Tip 1 Tip 1

      Step 5

      Make your left viewport the camera-view by clicking Left > Cameras > VrayPhysicalCamera01. Now adjust the position of the camera using the other viewports until you get something you like!

      Step 5 Step 5 Step 5

      Step 6

      To create a Rack Focus effect (changing the focus point from one object in your scene to another over time), you can animate the Focus Distance parameter in the camera settings. Click Auto Key to create a first key for the value, and then move the timeline to frame 60 (2 seconds at 30fps) and change the value of the Focus Distance until the grids are where you want the camera to focus on at the end of the move. Now make sure to turn off Auto Key so you don't accidentally animate any more values!

      Step 6 Step 6 Step 6

      Step 7

      Now make a Vraylight in the top viewport by clicking Create > Lights >Vray and then choosing Vraylight. Make it as big as your scene. Then, in the camera viewport, click the VrayPhysicalCamera text and turn on Show Safe Frames”.

      Step 7 Step 7 Step 7

      Step 8

      Move the light up on the Z axis in the front view until it sits right above our scene as shown.

      Step 8 Step 8 Step 8

      Step 9

      With our focal distance set and our VRayLight in place, we'll now cover how to make bokeh effects in your final render. To do this, we're first going to need to create a few more lights in our scene. I added in four small VrayLights, stacked on top of each other, as shown below.

      Step 9 Step 9 Step 9

      Step 10

      Now click on the VrayPhysCamera, go to Modify, and scroll down to the bokeh tab. Lets go over the settings for bokeh:

      • Blades - If checked, the shape of the aperture (and therefore the shape of the bokeh itself) is polygonal, with the number of sides depending on the number of blades. If this is not checked, the aperture shape will be circular, as will the bokeh.
      • Rotation - If Blades is checked on, this controls the rotation of that polygonal shape.
      • Center Bias - This makes the brightness of each bokeh greater on either the inside or the outside of the shape. Negative values makes the center brighter, whilst positive values make the outer rim brighter, as shown below :
      Step 10 Step 10 Step 10

      Step 11

      Now let's take a look at the anisotropy setting. Anisotropy basically distorts the bokeh shape either horizontally (if you input a positive value) or vertically (if you use a negative value) as shown below.

      Step 11 Step 11 Step 11

      Step 12

      You're now ready to render! For more efficient results, you can change the Image Sampler in the Render Settings to Adaptive DMC, which gets us slightly better looking DOF in the scene.

      Step 12 Step 12 Step 12

      I hope you enjoyed this quick look at DOF and Bokeh in 3Ds Max and Vray. If you have any questions please feel free to leave me a comment below!

Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.