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 SMAA Anti-Aliasing

Enhanced Subpixel Morphological Anti-Aliasing (SMAA) post-processing effect. Three-pass pipeline: edge detection, blending weight calculation, and neighborhood blending.

Enhanced Subpixel Morphological Anti-Aliasing (SMAA) post-processing effect. Three-pass pipeline: edge detection, blending weight calculation, and neighborhood blending.


Overview

Declarative setup script (no M module). Registers a 3-pass SMAA pipeline:

  1. Edge Detection - Finds edges using luma/color differences
  2. Blending Weight - Calculates blend weights using area/search lookup textures
  3. Neighborhood Blending - Final anti-aliased composite

Scene Objects

ObjectTypeDescription
SMAA_StateBlockGFXStateBlockData3 linear clamp samplers
SMAA_EdgeDetectionShaderDataShaderDataEdge detection pass
SMAA_BlendingWeightShaderDataShaderDataBlending weight calculation
SMAA_NeighborhoodBlendingShaderDataShaderDataFinal neighborhood blend
SMAA_PostEffectPostEffectRoot (edge detection), disabled by default
SMAA_PostEffect1PostEffectBlending weight child
SMAA_PostEffect2PostEffectNeighborhood blending child

Global Callbacks

GlobalCallbackDescription
SMAA_PostEffectCallbacksonEnabled()Disables FXAA_PostEffect (mutual exclusion)
SMAA_PostEffectCallbackspreProcess()Updates SMAA_RT_METRICS shader macro when render target size changes

Pipeline

$backBuffer → Edge Detection → Blending Weight (+ AreaTex + SearchTex) → Neighborhood Blend → $backBuffer

Lookup Textures

-- Pre-computed lookup textures for blending weight calculation
smaaPostEffect1:setField("texture", 1, "shaders/common/postFx/smaa/AreaTexDX9.dds")
smaaPostEffect1:setField("texture", 2, "shaders/common/postFx/smaa/SearchTex.dds")

Resolution Tracking

The preProcess callback dynamically updates the SMAA_RT_METRICS macro when resolution changes:

local rtSize = smaaPostEffect:getRenderTargetSize()
local rtResolution = string.format("float4(1.0 / %d, 1.0 / %d, %d, %d)",
  rtSize.x, rtSize.y, rtSize.x, rtSize.y)
smaaPostEffect:setShaderMacro("SMAA_RT_METRICS", rtResolution)

Notes

  • Mutually exclusive with FXAA - enabling SMAA disables FXAA and vice versa
  • All passes clear their targets on draw (PFXTargetClear_OnDraw)
  • Renders after diffuse (PFXAfterDiffuse)
  • preProcess() is called once at load time after object creation
  • Shader pixel version 5.0

See Also

  • PostFx FXAA - Alternative anti-aliasing (mutually exclusive)
  • PostFx Utils - Preset management

Advanced Lighting - Shadow Visualization

Provides a shader and custom material for visualizing shadow maps in the editor/debug views.

PostFx SSAO (Screen-Space Ambient Occlusion)

Dual-radius screen-space ambient occlusion effect. Provides small-radius detail occlusion and large-radius contact shadows with configurable quality levels.

On this page

OverviewScene ObjectsGlobal CallbacksPipelineLookup TexturesResolution TrackingNotesSee Also