Editor - Visualization
Central visualization management tool for the BeamNG editor, providing toggles for debug rendering modes, object visibility/selectability, material debug overlays with legends, and navgraph visualizat
Central visualization management tool for the BeamNG editor, providing toggles for debug rendering modes, object visibility/selectability, material debug overlays with legends, and navgraph visualization.
Module Exports
| Export | Type | Description |
|---|---|---|
M.dependencies | table | {'editor_aiViz'} - for navgraph visualization |
M.onEditorGui | hook | Renders the Visualization tool window and material debug legend |
M.onEditorInitialized | hook | Registers all visualization types and material debug modes |
M.onEditorRegisterPreferences | hook | Registers visualization preferences |
M.onEditorPreferenceValueChanged(path, value) | hook | Applies preference changes to visualization state |
Key Internals
| Variable | Type | Purpose |
|---|---|---|
materialDebugVisualizationType | IntPtr | Selected material debug mode index |
materialDebugVisualizationTypes | table/nil | List of material debug mode definitions |
vizFilter | TextFilter | Search filter for visualization types |
legendDefs | table | Legend definitions for material debug overlay |
renderDebugFlags | table | Bitfield constants for material debug flags |
Three Tabs
Debug Tab
- Material Debug combo box with 20+ modes (None, Triangle Size, Mip Level, Base Color, Opacity, Metallic, Roughness, Normals, UV channels, etc.)
- Per-mode legend overlay with gradient bars, color chips, and description bullets
- Toggleable visualization types (wireframe, bounding boxes, frustum lock, triggers, terrain, decals, lighting, navgraph, etc.)
Visible Tab
- Checkbox per renderable object class to toggle scene visibility
- Classes from
worldEditorCppApi.getRenderableObjectClassNames()
Selectable Tab
- Checkbox per object class to toggle editor selectability
Material Debug Modes
| Mode | Flag | Description |
|---|---|---|
| None | FlagsDebugNone | No debug overlay |
| Triangle Size | FlagsDebugTriangleSize | GPU overdraw visualization (Vulkan only) |
| Base Color Mip | FlagsDebugMipBaseColor | Mipmap LOD level coloring |
| Base Color | FlagsDebugBaseColor | Albedo color |
| Opacity | FlagsDebugOpacity | Alpha channel grayscale |
| Metallic | FlagsDebugMetallic | Metallic grayscale |
| Roughness | FlagsDebugRoughness | Roughness grayscale |
| Normals WS | FlagsDebugNormalsWS | World-space normal vectors |
| AO | FlagsDebugAmbientOcclusion | Ambient occlusion |
| Emissive | FlagsDebugEmissive | Emissive color |
| Clear Coat | FlagsDebugClearCoat | Clear coat intensity |
| UV0/UV1 | Various | UV coordinate encoding, checkerboard, color grid |
| Deprecated | FlagsDebugMaterialDeprecated | Old vs new material pipeline |
| Layer Count | FlagsDebugLayerCount | Number of material layers |
Registered Visualization Types
- BeamNG waypoints, navgraph (road type, drivability, speed limit, hidden)
- Advanced text drawing, wireframe, bounding boxes, frustum lock
- Sound emitters, triggers, terrain, decals, light frustums
- Zone culling, terrain occlusion disable
- NavMesh, portals, BV tree
- Shadow disable
- Advanced Lighting: color/specular/normals/depth visualizers
- Annotation visualizer (research license only)
Lua Code Example
-- The visualization window is registered on editor init:
-- editor.registerWindow(toolWindowName, im.ImVec2(500,600))
-- Material debug mode switching:
-- materialDebugSetFlag(renderDebugFlags.FlagsDebugTriangleSize)
-- enableMaterialDebug(true)
-- Legend overlay renders at 80% viewport height, centered:
-- im.SetNextWindowPos(vec2(vp.Size.x * 0.5, vp.Size.y * 0.8), im.Cond_Always, vec2(0.5, 0.5))
-- Gradient bars drawn via TextureDrawPrimitive with jet/grayscale palettes
-- Jet colormap for triangle size / mip visualization:
-- function _jetRGB(t)
-- local r = max(0, min(1, 4*t - 2))
-- local g = max(0, min(1, 2 - abs(4*t - 2)))
-- local b = max(0, min(1, 2 - 4*t))
-- return r, g, b
-- end
-- Visualization type registration:
-- editor.registerVisualizationType({
-- type = editor.varTypes.LuaVar,
-- name = "GFXDevice.renderWireframe",
-- displayName = "Wireframe Mode"
-- })
-- Custom visualization types with setter/getter:
-- editor.registerVisualizationType({
-- type = editor.varTypes.Custom,
-- name = "$AL_LightColorVisualizeVar",
-- displayName = "Advanced Lighting: Light Color Viz",
-- setter = function(on) setConsoleVariable(varName, on and "1" or "0") end,
-- getter = function() return getConsoleVariable(varName) == "1" end
-- })
-- Preferences stored under gizmos.visualization:
-- visTypes (table), visible (table), selectable (table)
-- visualizationDrawDistance (int, default 250, range 50-2000)
-- saveVisualizationSettings (bool, default true)
-- showMaterialDebugLegend (bool, default true)
-- Reset to defaults via preference registry
-- Filter search supports multi-token case-insensitive matchingSee Also
- Editor AI Tests - Related reference
- Editor AI Visualization - Related reference
- Editor – Assembly Spline Tool - Related reference
- World Editor Guide - Guide
Vehicle Editor Main
Main entry point for the Vehicle Editor - manages static/live editor modes, headless editor activation, extension loading, menu creation, and vehicle data management.
Editor Viz Helper
Provides an in-editor visual helper tool for level designers to place temporary decal markers on surfaces. Uses dynamic decals from `art/vizhelper/` with mouse-driven placement, rotation, and scaling