Depth of field is a way to enhance the realism of a Track View sequence in CRYENGINE by simulating the way a real-world camera works.
You can use a broad depth of field to focus on all or nearly all of a scene. And if you only want to focus on objects that are within a certain distance from the camera, use a narrow depth of field.
Example: Changing Focus from the object in front to the object in the background
In CRYENGINE there are three values that allow you to adjust the depth of field: FocusDist(ance), FocusRange and BlurAmount. While the latter one should be self-explanatory, the other two (and especially the second one) are often misunderstood.
The effective distance in both directions is FocusRange / 2, which means half of the FocusRange is spread away from the FocusDistance.
For further illustration let me show you the following scene:
| |
|
First, this is an important command, remember it: r_hdrdebug 4
Create toolbox macros to be able to switch it on/off with a button click!
In Sandbox there are two ways to control DoF: by Trackview and by Flowgraph. Lets have a look at trackview first, because that's what you will use in 90% of the time!
In Trackview there a two node you can use to access DoF: you can add a DepthOfField node inside the Director node or you can add a Depth of Field track to any camera node.
If there are both, the latter takes precedence over the first one. You should use the node inside the Director node when you want to use the same DoF setup over different cameras, though most of the time you want specific DoF for each camera because you have more control over it!
You can add as many keys as you want, and of course use the curve editor to further tune your DoF changes over time.
If you have a scene with full player control, adding DoF through flowgraph may be the better choice. You can do that by adding the Image:EffectDepthOfField node. Usage is the same as with the trackview option.
Use Interpol:Float nodes to smoothly fade the DoF in and out. Generally you should avoid using to close and too much DoF through flowgraph, because its hard to track where and what the player is looking at.
In C2 we used it only to limit ViewDistances during cinematics to give it more of a "cinematic feeling".