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

Advanced Lighting - Shaders

Defines all shader data, state blocks, and custom materials for the Advanced Lighting deferred rendering pipeline: vector lights (sun), point lights, spot lights, and particle point lights.

Defines all shader data, state blocks, and custom materials for the Advanced Lighting deferred rendering pipeline: vector lights (sun), point lights, spot lights, and particle point lights.


Module Overview

PropertyValue
Sourcelua/ge/client/lighting/advanced/shaders.lua
Returns- (side-effect module)
DependenciesSampler states from client/core

Light Type Materials

Vector Light (Directional / Sun)

ObjectTypePurpose
AL_VectorLightStateGFXStateBlockDataAdditive blend, stencil-tested, no z-write
AL_VectorLightShaderShaderDatafarFrustumQuadV.hlsl + vectorLightP.hlsl
AL_VectorLightMaterialCustomMaterialFull-screen quad, targets lightinfo

Point Light

ObjectTypePurpose
AL_ConvexLightStateGFXStateBlockDataAdditive blend, z-test (reversed depth aware), CW cull
AL_PointLightShaderShaderDataconvexGeometryV.hlsl + pointLightP.hlsl
AL_PointLightMaterialCustomMaterialConvex geometry, targets lightinfo

Spot Light

ObjectTypePurpose
AL_SpotLightShaderShaderDataconvexGeometryV.hlsl + spotLightP.hlsl
AL_SpotLightMaterialCustomMaterialConvex geometry, targets lightinfo

Particle Point Light

ObjectTypePurpose
AL_ParticlePointLightShaderShaderDataparticlePointLightV/P.hlsl
AL_ParticlePointLightMaterialCustomMaterialParticle-emitted lights

Default Materials

ObjectTypePurpose
AL_DefaultPrePassMaterialMaterialFallback for objects without materials (prepass)
AL_DefaultShadowMaterialMaterialFallback for shadow rendering; double-sided for terrain

State Block Details

AL_VectorLightState

  • Blend: One + One (additive)
  • Stencil: enabled, ref=4, func=Less
  • Cull: None (full-screen quad)
  • 7 sampler slots: G-buffer (0,1,5,6), shadow map (2), SSAO (3), random direction (4)

AL_ConvexLightState

  • Same additive blend
  • Z-enable with reversed depth support (GFXCmpLessEqual or GFXCmpGreaterEqual)
  • Cull: CW (back-face of light volume)
  • Stencil: ref=4, func=Less

Sampler Bindings (Vector Light)

SlotSamplerTexture
prePassBuffer-#prepass[RT0]
prePassDepthBuffer-#prepass[Depth]
ShadowMap-$dynamiclight
ssaoMask-#ssaoMask
prePassBuffer1–5-#prepass[RT1]–[RT5]

Notes

  • All shaders use pixel version 5.0.
  • Reversed depth buffer is detected via $Scene::useReversedDepthBuffer.
  • The convex light state is shared between point and spot lights.
  • Shadow material is double-sided to handle terrain at sunset/sunrise angles.

See Also

  • client/lighting/advanced/init - Advanced Lighting activation
  • client/lighting/advanced/lightViz - Debug visualizers
  • client/lighting/advanced/shadowViz - Shadow debug

Render Manager

Initializes the Advanced Lighting (AL) render format token and MSAA copy PostEffect. Ensures driver MSAA does not interfere with deferred lighting passes.

Basic Lighting - Shadow Filter

Two-pass (horizontal + vertical) Gaussian blur filter for Basic Lighting projected shadows.

On this page

Module OverviewLight Type MaterialsVector Light (Directional / Sun)Point LightSpot LightParticle Point LightDefault MaterialsState Block DetailsAL_VectorLightStateAL_ConvexLightStateSampler Bindings (Vector Light)NotesSee Also