RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
HDR Post-ProcessingOpenXR VRRender ViewsOffscreen View Demo

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 Extensionsrender

Render Views

Provides a utility to create offscreen render views and save them to disk. Used for programmatic screenshots from arbitrary camera positions.

Provides a utility to create offscreen render views and save them to disk. Used for programmatic screenshots from arbitrary camera positions.


Public API

FunctionSignatureDescription
M.takeScreenshot(options, callback)Creates a render view at a given position/rotation and saves to file

options Table

FieldTypeDefaultDescription
posvec3requiredCamera position in world space
rotquatrequiredCamera rotation (x, y, z, w)
resolutionvec3512 × 256Output resolution
fovnumber75Field of view in degrees
nearPlanenumber0.1Near clip distance
filenamestringrequiredOutput file path
renderViewNamestring"defaultRenderView"Unique render view identifier
screenshotDelaynumber0.1Delay before capture (seconds)

Internals

  • Creates a RenderViewManagerInstance view with luaOwned = true for GC cleanup
  • Builds a camera matrix from quaternion rotation + position
  • Sets up a Frustum with the given FOV, aspect ratio, near/far planes
  • Temporarily disables FXAA (if active) to avoid artifacts, re-enables after save
  • Hides UI and gameplay markers during capture via ui_visibility and gameplay_markerInteraction
  • Uses core_jobsystem to run the save asynchronously

How It Works

  1. takeScreenshot creates or reuses a render view by name
  2. Sets camera matrix, resolution, viewport, frustum, and named texture target
  3. If FXAA is enabled, temporarily disables it
  4. Spawns a job that:
    • Hides UI and markers
    • Sleeps for screenshotDelay
    • Calls renderView:saveToDisk(filename)
    • Destroys the render view
    • Restores UI, markers, and AA settings
    • Fires optional callback

Usage Examples

-- Take a screenshot from a specific camera position
render_renderViews.takeScreenshot({
  pos = vec3(100, 200, 50),
  rot = quat(0, 0, 0, 1),
  resolution = vec3(1920, 1080, 0),
  fov = 60,
  filename = "screenshots/myshot.png",
  screenshotDelay = 0.2,
}, function()
  log('I', '', 'Screenshot saved!')
end)

Key Notes

  • Render view is destroyed after each screenshot (not reused)
  • Far clip is hardcoded to 2000 units
  • Editor icons are disabled in the render view (renderEditorIcons = false)
  • The named texture target must match the render view name for correct output

See Also

  • Render HDR - Post-Effect Pipeline Initialization - Related reference
  • Render OpenXR - VR/XR Runtime Management - Related reference
  • Render View Demo - Render View Usage Example - Related reference
  • Game Engine Overview - Guide

OpenXR VR

Manages the OpenXR VR session lifecycle: toggling on/off, welcome dialog, debug ImGui panel, headset centering, state tracking, and error handling.

Offscreen View Demo

A minimal example extension demonstrating how to create and display an offscreen render view in an ImGui window. The camera orbits the origin.

On this page

Public APIoptions TableInternalsHow It WorksUsage ExamplesKey NotesSee Also