RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
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 Light Ray Effect

Volumetric light ray (god ray) post-processing effect. Two-pass pipeline: occlusion detection followed by radial light scattering.

Volumetric light ray (god ray) post-processing effect. Two-pass pipeline: occlusion detection followed by radial light scattering.


Overview

Declarative setup script (no M module). Registers:

  • LightRayOccludeShader - Occlusion pass shader
  • LightRayShader - Radial scatter/ray shader
  • LightRayStateBlock - 3-texture linear clamp sampler
  • LightRayPostFX - Root PostEffect (disabled by default, priority 10)
  • LightRayPostFXCallbacks - Handles resolution scaling and shader constants

Scene Objects

ObjectTypeDefault EnabledDescription
LightRayPostFXPostEffectfalseLight ray root (occlusion pass)
final (child)PostEffect-Ray scatter pass, composites to $backBuffer

Global Variables

VariableDefaultDescription
$LightRayPostFX::brightScalar0.75Brightness multiplier for occlusion
$LightRayPostFX::numSamples40Ray marching sample count
$LightRayPostFX::density0.94Ray density factor
$LightRayPostFX::weight10.0Ray intensity weight
$LightRayPostFX::decay1.0Falloff per sample
$LightRayPostFX::exposure0.0005Final exposure multiplier
$LightRayPostFX::resolutionScale0.20Render target scale (20% of screen)

Global Callbacks

GlobalCallbackDescription
LightRayPostFXCallbackspreProcess()Sets target scale from $LightRayPostFX::resolutionScale
LightRayPostFXCallbackssetShaderConsts()Pushes all light ray parameters to shader uniforms

Pipeline

$backBuffer + #prepass[RT0] + #prepass[Depth]
  → LightRayOccludeShader (at resolutionScale)
  → LightRayShader ("final") + $backBuffer
  → $backBuffer

Usage Example

-- Enable light rays
local pfx = scenetree.findObject("LightRayPostFX")
if pfx then pfx:enable() end

-- Adjust ray quality
TorqueScriptLua.setVar("$LightRayPostFX::numSamples", 60)
TorqueScriptLua.setVar("$LightRayPostFX::resolutionScale", 0.5)

Notes

  • Output format is GFXFormatR16G16B16A16F (HDR intermediate)
  • Renders at PFXBeforeBin / AfterPostFX
  • The final child is found via findObjectByInternalName("final")
  • Low resolution scale (20%) is a performance optimization for the scatter pass

See Also

  • PostFx Glow - Bloom/glow effect
  • PostFx SSAO - Ambient occlusion

Client Lighting

Discovers and initializes lighting system backends (Advanced Lighting, Basic Lighting) with fallback logic.

Advanced Lighting - Light Visualization

Debug visualization post effects for the Advanced Lighting deferred rendering pipeline: depth, normals, light color, light specular, and annotation buffers.

On this page

OverviewScene ObjectsGlobal VariablesGlobal CallbacksPipelineUsage ExampleNotesSee Also