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

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 Extensionsutil

Vehicle Exporter

Exports the current player vehicle as a glTF/GLB 3D file, including meshes, materials, textures, part hierarchy, and optionally node/beam data.

Exports the current player vehicle as a glTF/GLB 3D file, including meshes, materials, textures, part hierarchy, and optionally node/beam data.


Overview

util_export (aliased as extensions.export) provides full vehicle-to-glTF export. It captures GPU mesh data (vertices, normals, tangents, UVs, colors), reconstructs the vehicle's part tree, exports materials with PBR textures, and writes glTF JSON or binary GLB format. Supports animated recording.

Extension path: lua/ge/extensions/util/export.lua


Exports (M)

FunctionSignatureDescription
export(handler)Triggers GPU mesh capture, calls handler with glTF root.
exportFile(filename)Exports to a file (JSON or GLB based on gltfBinaryFormat).
startRecording(filename)Begins multi-frame recording.
stopRecording()Stops recording.
updateGFX(dt)Processes export when GPU data is ready.
suggestFilename()Returns next available export filename.
getGeInfo()Returns current export settings.

Configuration Properties

PropertyDefaultDescription
M.embedBufferstrueEmbed binary buffers as base64 in JSON.
M.gltfBinaryFormattrueOutput GLB instead of JSON.
M.exportNormalstrueInclude vertex normals.
M.exportTangentsfalseInclude tangents.
M.exportTexCoordsfalseInclude UV coordinates.
M.exportColorsfalseInclude vertex colors.
M.exportBeamstrueInclude JBeam node/beam data in extras.

Internals

Export Pipeline

  1. export() triggers GPUMesh.bng_getGPUMesh() to capture current vehicle mesh.
  2. When data is ready, processExport() builds the glTF structure:
    • Adds index buffer from GPU mesh.
    • Adds vertex attribute buffers (positions, normals, tangents, UVs, colors).
    • Creates mesh nodes for flexbodies and prop meshes.
    • Maps meshes to vehicle parts via partToFlexMesh.
    • Builds part tree from vehiclePartTree and slotMap.
    • Exports materials with PBR textures (v1 and v1.5 material formats).
  3. Handler receives the completed glTF root object.

Part Tree

The vehicle's JBeam part hierarchy is reconstructed:

  • Each part becomes a glTF node.
  • Flexbody meshes are assigned as children of their owning part.
  • Node/beam data is stored in BNG_JBeamData extension.
  • Vehicle direction stored in BNG_Direction extension.

Material Export

Supports Material v1 (legacy) and v1.5 (PBR):

  • Extracts all texture stages (color, normal, specular, metallic, roughness, emissive, etc.).
  • Converts DDS textures to PNG.
  • Handles CEF textures (dynamic paint textures via @ prefix).
  • Creates proper pbrMetallicRoughness glTF material structure.

GLB Format

Binary output merges all buffers into a single binary chunk:

  • Updates buffer view offsets to reference the merged buffer.
  • Writes proper GLB header (magic, version, length).
  • Aligns chunks to 4-byte boundaries.

How It Works

  1. Call exportFile('vehicle.glb') or use the UI.
  2. GPU mesh data is captured from the current vehicle.
  3. Mesh geometry, materials, textures, and part hierarchy are assembled into glTF.
  4. File is written as GLB (binary) or glTF (JSON).

Lua Examples

-- Export current vehicle to GLB
extensions.export.exportFile('vehicles/pickup/export_001.glb')

-- Suggest a filename
local fn = extensions.export.suggestFilename()
extensions.export.exportFile(fn)

-- Export with custom settings
extensions.export.gltfBinaryFormat = false
extensions.export.exportTexCoords = true
extensions.export.exportFile('vehicle.gltf')

-- Record animation frames
extensions.export.startRecording('animation.glb')
-- ... later ...
extensions.export.stopRecording()

Additional Exports

  • M.export - (undocumented)
  • M.exportFile - (undocumented)
  • M.getGeInfo - (undocumented)
  • M.startRecording - (undocumented)
  • M.stopRecording - (undocumented)
  • M.suggestFilename - (undocumented)
  • M.updateGFX - (undocumented)

See Also

  • Auto Annotation - Related reference
  • Booster - Related reference
  • Calibrate ESC - Related reference
  • Game Engine Overview - Guide

Doc Creator

Generates JSON data files and resources for the BeamNG documentation / Hugo system. Exports levels, vehicles, materials, JBeam defaults, controller info, and more across all available languages.

Follow The White Rabbit

A minimal text-adventure easter egg that runs in a custom console context.

On this page

OverviewExports (M)Configuration PropertiesInternalsExport PipelinePart TreeMaterial ExportGLB FormatHow It WorksLua ExamplesAdditional ExportsSee Also