RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

cdefDebugDraw ReferencecdefGpuMesh ReferencecdefImgui ReferencecdefMath Referencecdefs ReferencecontrolSystems Referencecsvlib ReferencedelayLine Referencedequeue ReferencedevUtils ReferenceEvent Referenceextensions Referencefilters Referencegraphpath Referenceguihooks ReferenceinputFilters ReferenceinterpolatedMap Referenceintrospection ReferencejbeamWriter Referencejson-ast Referencejson ReferencejsonDebug ReferencejsonPrettyEncoderCustom Referencekdtreebox2d Referencekdtreebox3d Referencekdtreepoint3d Referencelpack ReferenceluaBinding ReferenceluaCore ReferenceluaProfiler Referencemathlib Referenceparticles Referencequadtree Referencesettings ReferencetcpServer ReferencetimeEvents Referenceutils Reference
ExpressionParser ReferenceGroups ReferenceInteraction ReferenceIO ReferenceLinks ReferenceLoader ReferenceMaterials ReferenceOptimization ReferenceScaling ReferenceSectionMerger ReferenceSlotSystem ReferenceTableSchema ReferenceUtils ReferenceVariables Reference

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 Referencecommonjbeam

Materials Reference

Module defined in `lua/common/jbeam/materials.lua`. Processes material switches, glow maps, and deform group material bindings for vehicle 3D objects.

Module defined in lua/common/jbeam/materials.lua. Processes material switches, glow maps, and deform group material bindings for vehicle 3D objects.


Exports

Functions

M.process(vehicleObj, vehicle)

Processes the vehicle's glowMap and flexbody deformGroup data to set up switchable materials on the engine object. Creates material switches for glow maps (with simpleFunction or advancedFunction evaluators), binds deform group materials to beams, and pre-compiles all material states to avoid shader lag at runtime. Stores result in vehicle._materials.

  • Parameters:
    • vehicleObj - userdata - The C++ vehicle object (from scenetree)
    • vehicle - table - Assembled vehicle data with glowMap, flexbodies, beams sections
  • Returns: nil

Internal Notes

  • Glow map entries support two evaluator types:
    • simpleFunction: string (single trigger) or table {triggerName = coefficient} - summed and multiplied
    • advancedFunction: {triggers = {...}, cmd = "..."} - arbitrary expression
  • Evaluator functions are compiled via load() with a material variable environment (mv).
  • Deform groups link flexbody materials to beams: when a beam in a deform group deforms, its associated flexbody material switches to the damaged variant.
  • All material states are pre-switched during processing to force shader precompilation.
  • Output stored in vehicle._materials = { mv, triggerList, triggers, matState, deformMeshes }.
  • triggers copy sent to vehicle side has evalFunction stripped (not serializable).

Loader Reference

Module defined in `lua/common/jbeam/loader.lua`. Main orchestrator for the JBeam vehicle loading pipeline. Coordinates all processing stages from file loading to 3D mesh attachment.

Optimization Reference

Module defined in `lua/common/jbeam/optimization.lua`. Assigns continuous IDs (CIDs) to vehicle data entries, optimizes beam ordering, cleans up runtime-unnecessary data, and dereferences object point

On this page

ExportsFunctionsM.process(vehicleObj, vehicle)Internal Notes