Interactive Depth of Field

From LightWiki

Jump to: navigation, search

Depth of Field has been easy to set up for a while in LightWave, but it takes some fiddling. Having an interactive way to do it makes things a lot easier and with LightWave 9.2 even more immediate.


Image:IDOF_1.Focus.pngImage:IDOF_2.Parent_in_Place.png
1. With an empty scene add a Null (Ctrl-n) and name it Focus (for arguments' sake, you can call it Melissa if you insist). 2. Have a look for the Parent in Place button and if it's turned on as in the image, turn it off for the next step (you can turn it back on afterwards).


Image:IDOF_3.Parenting.png
3. Now parent the Null to the camera as shown in the image and as you can see the Null jumps to the camera's location in the scene (this is the reason we turned off Parent in Place, because we want the null to jump to the camera. If you forget to turn off Parent in Place, you can always manually set the Null's Z value to 0).


4. Next step is to go into the camera Properties panel. This tutorial was written for LightWave 9 (certain parts of it are solely achievable starting with LightWave v9.2) although it will work with versions of LightWave as old as 7.0, and by preference you would be better using the Perspective camera. If you need to use the Classic camera you will need to set anti-aliasing to PLD7/Classic-Medium, however using the Perspective camera doesn't need this step.


Image:IDOF_5.GraphEd.png
5. Now turn on Depth of Field in the "Stereo and DOF" tab in the Camera Properties panel and set the Focal Distance to 0. It will jump back to 100 um, but for almost all purposes that's near enough to 0 to make no difference. Now hit the envelope button next to the Focal Distance field to call up a graph editor window.


Image:IDOF_6.ChannelFollower.png 6. In the Graph Editor window go to the Modifiers tab and choose "Channel Follower" from the drop-down list. In this window click the arrow pointing right next to the Camera to hide the channels so you can see our Focus Null. Double click the "Position.Z" channel to select it and hit OK.



Congratulations you just made an interactive focus puller for your camera. So far, all of this is achievable with LightWave 7.0 and above. You can now rotate your camera into the position and move the null onto the object you want in focus - the null will move with the camera and follow its rotation and you can move it along the camera's view. To really exagerrate the effect purely for the purposes of this tutorial, exit the Graph Editor and turn your Lens F-Stop down to 0.1, but be aware that severe DoF can make your images look like they were of miniatures shot with a macro lens.

Alternate set up for the autofocus using expressions

You can use an expression to set up the autofocus. This works extremely well if you can not parent the focus object to the camera.

The expression to use is:

vmag( Camera.wpos(Time)- FocusObject.wpos(Time))

Replace "FocusObject" with the name of your actual focus object.

Now for the really great step brought to you by the advancements added in LightWave 9.2.

For this I did a bit of prep to better demonstrate, but it's all summed up in the image and I've included the scene file necessary to replicate it. The object is the LightWave furnished with versions of LightWave going back some way. I've two viewports to better show the effect, but you don't need to. In addition if your scene is heavy with polygons, you can make a preview in which the Depth of Field is present. I've added a Cinepak AVI to show the effect with the cows.


As I am sure you will have spotted, the dropdown menu entry is not just for DoF, but also motion blur. You can preview any motion blur settings you making using Photoreal Motion Blur (PRMBlur) in exactly the same way and even combine both at the same time.

Views
Personal tools