RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

server/commands - Camera & Input Commandsge_utils - Game Engine Utility Functionsmain.lua - GE Lua Entry Point & Game Loopmap.lua - Navigation Graph (AI Road Map)screenshot.lua - Screenshot Systemserver/server - Level Loading & Game ServerserverConnection - Client-Server Connection Manager`setSpawnpoint` - Default Spawn Point Persistence`simTimeAuthority` - Simulation Time & Bullet Time Control`spawn` - Vehicle Spawning & Safe Placement`suspensionFrequencyTester` - Suspension Natural Frequency Analysis
Client CanvasCaustics PostFXChromatic Lens PostFXClient CoreDepth of Field PostFXEdge AA PostFXPostFx Flash EffectPostFx Fog EffectsPostFx FXAA Anti-AliasingGamma PostFXPostFx Glow EffectShadow Maps InitClient LightingPostFx Light Ray EffectAdvanced Lighting - Light VisualizationPostFx Masked Screen BlurMotion Blur PostFXObjects Required for StartupClient Parse ArgsClient PostFX ManagerRender ManagerAdvanced Lighting - ShadersBasic Lighting - Shadow FilterAdvanced Lighting - Shadow VisualizationPostFx SMAA Anti-AliasingPostFx SSAO (Screen-Space Ambient Occlusion)PostFx Turbulence EffectPostFx Utilities

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 ExtensionsClient

PostFx Fog Effects

Atmospheric fog and underwater fog post-processing effects. Creates two independent PostEffect chains for above-water and underwater fog rendering.

Atmospheric fog and underwater fog post-processing effects. Creates two independent PostEffect chains for above-water and underwater fog rendering.


Overview

Declarative setup script (no M module). Registers two fog systems:

Atmospheric Fog

  • FogPassShader - ShaderData sampling the prepass texture
  • FogPassStateBlock - Alpha-blended state block (SrcAlpha / InvSrcAlpha)
  • FogPostFx - PostEffect (enabled by default, priority 5, renders before translucent bin)

Underwater Fog

  • UnderwaterFogPassShader - Underwater fog pixel shader
  • UnderwaterFogPassStateBlock - Clamp-point sampler states
  • UnderwaterFogPostFx - One-frame PostEffect (enabled, priority 4, renders before translucent bin)
  • UnderwaterFogPostFxCallbacks - Enables/disables CausticsPFX in sync

Scene Objects

ObjectTypeDefault EnabledPriorityDescription
FogPostFxPostEffecttrue5Atmospheric distance fog
UnderwaterFogPostFxPostEffecttrue4Underwater fog with depth gradient

Global Callbacks

GlobalCallbackDescription
UnderwaterFogPostFxCallbacksonEnabled()Enables CausticsPFX when underwater fog activates
UnderwaterFogPostFxCallbacksonDisabled()Disables CausticsPFX when underwater fog deactivates

Texture Inputs

-- Atmospheric fog reads:
fogPostFx:setField("texture", 0, "#prepass[RT0]")
fogPostFx:setField("texture", 1, "#prepass[Depth]")

-- Underwater fog reads:
underwaterFogPostFx:setField("texture", 0, "#prepass[RT0]")
underwaterFogPostFx:setField("texture", 1, "#prepass[Depth]")
underwaterFogPostFx:setField("texture", 2, "$backBuffer")
underwaterFogPostFx:setField("texture", 3, "#waterDepthGradMap")

Notes

  • Underwater fog uses oneFrameOnly = true - it only renders when explicitly triggered per frame
  • Both effects render in PFXBeforeBin at ObjTranslucentBin
  • Atmospheric fog uses alpha blending for smooth distance falloff
  • CausticsPFX is automatically toggled with the underwater fog effect

See Also

  • PostFx Flash - Screen flash effect
  • PostFx Light Ray - Volumetric light rays

PostFx Flash Effect

Screen flash post-processing effect for damage and whiteout visual feedback. Creates a `FlashFx` PostEffect driven by shader constants for damage flash intensity and whiteout amount.

PostFx FXAA Anti-Aliasing

NVIDIA FXAA 3.11 (Fast Approximate Anti-Aliasing) post-processing effect by Timothy Lottes. Provides edge-smoothing as an alternative to SMAA.

On this page

OverviewAtmospheric FogUnderwater FogScene ObjectsGlobal CallbacksTexture InputsNotesSee Also