RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Flowgraph Base ModuleFlowgraph Base NodeFlowgraph Base State NodeFlowgraph Node BuilderFlowgraph GraphFlowgraph Group HelperFlowgraph LinkFlowgraph ManagerNew Node TemplateFlowgraph PinFlowgraph States ManagerFlowgraph UtilsFlowgraph Variable Storage
Blur (Flowgraph Node)DOF - Depth of Field (Flowgraph Node)

UI

Resources

BeamNG Game Engine Lua Cheat SheetGE Developer RecipesMCP Server Setup

// RLS.STUDIOS=true

Premium Mods for BeamNG.drive. Career systems, custom vehicles, and immersive gameplay experiences.

Index

HomeProjectsPatreon

Socials

DiscordPatreon (RLS)Patreon (Vehicles)

© 2026 RLS Studios. All rights reserved.

Modding since 2024

API ReferenceGE Extensionsflowgraphnodesgfx

DOF - Depth of Field (Flowgraph Node)

- **Node Name:** `DOF`

Overview

  • Node Name: DOF
  • File: extensions/flowgraph/nodes/gfx/dof.lua
  • Tags: gfx, dof

Animates Depth of Field blur in or out over a configurable fade time. Saves and restores the original DOF settings on reset.

Pin Schema

Input Pins

PinTypeDefaultDescription
flowflow-Inflow for this node
blurInflow-Start fading DOF blur in
blurOutflow-Start fading DOF blur out
fadeTimenumber1Duration of fade in seconds

Output Pins

PinTypeDescription
blurDoneflowFires when the fade animation completes

Internals

  • State: mode tracks current animation ("in", "out", or ""), timer tracks elapsed time.
  • On mode change, saves current TorqueScript DOF variables:
    • $DOFPostFx::BlurMin, $DOFPostFx::BlurMax, $DOFPostFx::FocusRangeMax, $DOFPostFx::BlurCurveFar
  • Sets $DOFPostFx::FocusRangeMax to 3 and targetBlur to 430.
  • Each frame, interpolates BlurMin, BlurMax, and BlurCurveFar based on timer progress.
  • On reset or execution stop, restores all saved DOF values.
  • Calls dofPostEffect.updateDOFSettings() via scenetree after every change.

How It Works

  1. When blurIn or blurOut flow activates, saves current DOF state and begins animation.
  2. Each frame, updates DOF parameters based on elapsed time vs fade duration.
  3. For blurIn: interpolates from 0 to 1. For blurOut: interpolates from 1 to 0.
  4. BlurCurveFar is scaled by targetBlur (430).
  5. When timer exceeds fadeTime, outputs blurDone = true.
  6. On reset, restores original DOF settings.

Lua Code Example

-- Manually set DOF blur via TorqueScript variables
TorqueScriptLua.setVar('$DOFPostFx::BlurMin', 0.5)
TorqueScriptLua.setVar('$DOFPostFx::BlurMax', 0.5)
TorqueScriptLua.setVar('$DOFPostFx::FocusRangeMax', 3)
TorqueScriptLua.setVar('$DOFPostFx::BlurCurveFar', 215)

local dofPostEffect = scenetree.findObject("DOFPostEffect")
if dofPostEffect and dofPostEffect.updateDOFSettings then
  dofPostEffect.updateDOFSettings()
end

Key Dependencies

  • TorqueScriptLua.setVar() / getVar() - reads/writes DOF TorqueScript globals
  • DOFPostEffect scene object - the depth of field post-processing effect

Additional Methods

C:_executionStopped()

Called when graph execution stops. Used for cleanup.

C:init(mgr, ...)

Initializes the node, setting up pins and default properties.

Parameters:

  • mgr
  • ...

C:updateSettings()

Node method.

C:work()

Main work function called each frame/tick when the node is active.


See Also

  • Blur (Flowgraph Node) - Related reference
  • FlowGraph Guide - Guide

Blur (Flowgraph Node)

- **Node Name:** `Blur`

Set Input Actions (Flowgraph Node)

- **Node Name:** `Set Input Actions`

On this page

OverviewPin SchemaInput PinsOutput PinsInternalsHow It WorksLua Code ExampleKey DependenciesAdditional MethodsC:_executionStopped()C:init(mgr, ...)C:updateSettings()C:work()See Also