RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Auto AnnotationBoosterCalibrate ESCCompile ImpostersCompile MeshesConfig List GeneratorDecal Roads EditorDependency TreeDoc CreatorVehicle ExporterFollow The White RabbitForest GeneratorGround Model DebugInput System UtilsInstanced Line Render DemoJBeam StatsLog StreamsMap TilesNode Beam ExportNode StreamPhotomodePrecompile ShadersPrecompile VehiclesProcedural Track GeneratorRectangle GeneratorRender Components APIResave MaterialsRich PresenceSave Dynamic DataScreenshot CreatorShowroomSort LinesStep HandlerTerrain GeneratorTest Extension ProxiesTest JSON Files SyntaxVehicle Rope DebugBatch WorkerWebSocket Test
Basic BordersBasic CentersBorder Wall MeshCamera TransitionCeiling MeshTrack MarkersMaterial UtilTrack MeshesMulti Track MergerObstacle PlacerTrack PiecesProcedural PrimitivesQuickrace SetupSegment To Procedural MeshSpline Track

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 ExtensionsutiltrackBuilder

Material Util

Reference for `extensions/util/trackBuilder/materialUtil.lua`. Manages track surface materials (colors, textures, glow, ground type) for the 8 material slots (A–H) used by the track editor.

Reference for extensions/util/trackBuilder/materialUtil.lua. Manages track surface materials (colors, textures, glow, ground type) for the 8 material slots (A–H) used by the track editor.


Exports

KeySignatureDescription
getMaterials() → tableReturns current materials with default values removed
setMaterials(materials, skipSet)Applies a table of materials keyed by letter
setSingleMaterial(letter, material, skipSet)Applies a full material definition to one slot
loadMaterials(?)Reference exists but function not defined locally
currentMaterialstableLive material state for all 8 slots
resetMaterialsToDefault(letter?)Resets one or all slots to original defaults

Internals

  • 8 material slots labeled A–H. Each slot has a center and border material object looked up via scenetree.findObject("track_editor_X_center/border").
  • Material properties: baseCenterColor, baseBorderColor, centerColor, borderColor, baseTexture, baseTextureN, baseTextureS, centerTexture, borderTexture, centerGlow, borderGlow, groundtype.
  • Defaults: Slots A–D are light gray asphalt with colored borders (orange/green/blue/red). Slots E–H are dark with glow-enabled neon strips.
  • removeDefaults(material, original) strips unchanged values for compact serialization.
  • fillDefaults(material, original) restores omitted values from the original template.

How It Works

  1. loadMaterial(letter) finds the scenetree material objects and reads their current state.
  2. setSingleMaterial(letter, material) writes all properties (textures, colors, glow, groundmodel) then flushes and reloads the engine material.
  3. getMaterials() loads all 8 slots, then returns a diff against the originals so only changed properties are included.
  4. setMaterials(materials) iterates the input table and applies each slot via setSingleMaterial.
-- Change slot A border to green
local mat = materialUtil.currentMaterials['A']
mat.borderColor = {0.2, 0.8, 0.2, 1}
materialUtil.setSingleMaterial('A', mat)

-- Get compact materials for saving
local mats = materialUtil.getMaterials()
-- mats['A'] only contains fields that differ from defaults

Additional Exports

  • M.currentMaterials - (undocumented)
  • M.getMaterials - (undocumented)
  • M.loadMaterials - (undocumented)
  • M.resetMaterialsToDefault - (undocumented)
  • M.setMaterials - (undocumented)
  • M.setSingleMaterial - (undocumented)

See Also

  • Track Builder - Basic Borders - Related reference
  • Track Builder - Basic Centers - Related reference
  • Track Builder - Border Wall Mesh - Related reference
  • Game Engine Overview - Guide

Track Markers

Reference for `extensions/util/trackBuilder/markers.lua`. Manages visual editor markers (bank, height, width, checkpoints, walls, ceiling) and interpolates track properties between control points.

Track Meshes

Reference for `extensions/util/trackBuilder/meshes.lua`. Defines cross-section profiles (tubes and side walls) used by the track builder's procedural mesh system.

On this page

ExportsInternalsHow It WorksAdditional ExportsSee Also