RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

server/commands - Camera & Input Commandsge_utils - Game Engine Utility Functionsmain.lua - GE Lua Entry Point & Game Loopmap.lua - Navigation Graph (AI Road Map)screenshot.lua - Screenshot Systemserver/server - Level Loading & Game ServerserverConnection - Client-Server Connection Manager`setSpawnpoint` - Default Spawn Point Persistence`simTimeAuthority` - Simulation Time & Bullet Time Control`spawn` - Vehicle Spawning & Safe Placement`suspensionFrequencyTester` - Suspension Natural Frequency Analysis
`adasUltrasonic.lua``cameraPreview.lua``capturePlayer.lua``license.lua``lidarTest.lua``multiscreen.lua``openDriveExporter.lua``openStreetMapExporter.lua``partAnnotations.lua``platoonFunctions.lua``pythonExport.lua``rawLidar.lua``rawLidarEmpty.lua``sensors.lua``sumoExporter.lua``techCore.lua``terrainImporter.lua``ultrasonicTest.lua``utils.lua`

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 Extensionstech

`terrainImporter.lua`

> This Source Code Form is subject to the terms of the bCDDL, v. 1.1.

This Source Code Form is subject to the terms of the bCDDL, v. 1.1. If a copy of the bCDDL was not distributed with this file, You can obtain one at http://beamng.com/bCDDL-1.1.txt

Module variable: M

Exported Functions

M.importHeightmap(data, w, h, scale, zMin, zMax, isYFlipped)

Line 36

Public interface.

M.terrainAndRoadImport(pngPath, roads, DOI, margin, zMax)

Line 72

Imports a terrain and lays a collection of roads on it along with some terraforming. The path of the terrain .png is provided. Roads are provided as a table/dictionary.

M.peaksAndRoadImport(peaks, roads, DOI, margin)

Line 80

Creates a a terrain from a collection of peaks and troughs on a grid, and lays a collection of roads on them, along with some terraforming. The peaks and roads are provided as table/dictionaries.

M.reset()

Line 88

Resets the terrain and roads created by a call to the terrain+roads or peaks+roads importer functions (see above).

M.toggleWorldEditor(isOpen)

Line 91

Opens/closes the world editor.

Returns: M

Internal Functions

Show internal functions
  • findBoundingSquare(s) (line 18)

    Computes the smallest square size above a value, which is also a power of two.

  • importHeightmap(data, w, h, scale, zMin, zMax, isYFlipped) (line 36)

    Imports a heightmap from a 2D array of 'pixel' values in the range given by [zMin, zMax]. The array should be indexable as [x][y]. The scale describes the resolution of the final generated heightmap - in both x and y, in metres-per-pixel. The scale is isotropic. Heightmaps must ultimately satisfy the following conditions, which this function will ensure (by cropping, if required): i) They must be square. ii) They must be a power of two in size. iii) They must be no larger than 8192 in size. The generated heightmap will assume the vertical range [0, zMax - zMin] to ensure maximum granularity in its height.

  • terrainAndRoadImport(pngPath, roads, DOI, margin, zMax) (line 72)

    Imports a terrain and lays a collection of roads on it along with some terraforming. The path of the terrain .png is provided. Roads are provided as a table/dictionary.

  • peaksAndRoadImport(peaks, roads, DOI, margin) (line 80)

    Creates a a terrain from a collection of peaks and troughs on a grid, and lays a collection of roads on them, along with some terraforming. The peaks and roads are provided as table/dictionaries.

  • reset() (line 88)

    Resets the terrain and roads created by a call to the terrain+roads or peaks+roads importer functions (see above).

  • toggleWorldEditor(isOpen) (line 91)

    Opens/closes the world editor.

`techCore.lua`

> This Source Code Form is subject to the terms of the bCDDL, v. 1.1.

`ultrasonicTest.lua`

> This Source Code Form is subject to the terms of the bCDDL, v. 1.1.

On this page

Exported FunctionsM.importHeightmap(data, w, h, scale, zMin, zMax, isYFlipped)M.terrainAndRoadImport(pngPath, roads, DOI, margin, zMax)M.peaksAndRoadImport(peaks, roads, DOI, margin)M.reset()M.toggleWorldEditor(isOpen)Internal Functions