Rust Wiki

Revision Difference

Depth_Of_Field#522340

<cat>Dev.Cinematic</cat> <title>Depth Of Field</title> # Getting Started Enable depth of field using the command `dof 1` ## Aperture `dof_aper <amount>` - Adjust the focus range for the camera's depth of field, i.e. the area size which is in focus. Smaller values produce a wider area of focus, higher values create a narrower focus range. ## Blur Amount `dof_blur <amount>` - Specify the amount of blur applied in out of focus areas. Decent results can be achieved by matching the blur amount to the [aperture](/rust/Depth_Of_Field#aperture) amount, then modifying from there. # Focus Modes Depth of field currently has two modes - **auto** and **manual** focus. Use the command `dof_mode <0/1>` to switch between modes. `0` = auto, `1` = manual ## Auto Focus This is the default mode for depth of field. Focus distance is automatically adjusted to a point of interest being looked at in the centermost part of the screen - eg. an entity (player, npc, deployable, etc) or a world object. Auto focus is generally good for achieving quick results, but it's not perfect. For finer control use [manual mode.](/rust/Depth_Of_Field#manualfocus) ## Manual Focus Manual mode allows setting focus to a specific distance from the camera by using the [focus distance](/rust/Depth_Of_Field#focusdistance) command and adjusting the time it takes to reach that distance by using the [focus time](/rust/Depth_Of_Field#focustime) command. # Manual Focus Settings The following commands are only applicable when `dof_mode 1` is enabled. ## Focus Distance `dof_focus_dist <amount>` - Distance from camera to focus - measured in units. ## Focus Time `dof_focus_time <amount>` - The time it takes (in seconds) to reach a new focus distance. 0 will be an instant change. Useful for lerping between focus points triggered either by a bind or when [nudging](/rust/Depth_Of_Field#focusnudging) the focus distance. ## Focus Nudging `dof_nudge <amount>` - Incrementally modify the focus distance by a specified amount. Both positive `+` and negative `-` values are accepted in the amount parameter, eg. `dof_nudge 1.5` will increase the focus distance by 1.5 units and `dof_nudge -1.5` will decrease it by 1.5 units. Nudging is also useful when applied as a bind. You can pull focus by setting nudge amounts to the <key>mousewheel</key> Example: `bind mousewheelup "dof_nudge 1.5"` and `bind mousewheeldown "dof_nudge -1.5"` # Focus Debug `dof_debug <1/0>` - Enable/disable a debug depth pass; a monochromatic preview of the current focus settings. Black indicates areas in focus, white indicates areas out of focus.