WIP Beta released Generate Lights - World Editor Plugin

Discussion in 'Utilities and programming' started by AlexKidd71, Oct 10, 2025 at 12:06 AM.

  1. AlexKidd71

    AlexKidd71
    Expand Collapse

    Joined:
    Mar 16, 2022
    Messages:
    609
    Generate Lights - World Editor Plugin

    I'm so tired now, that I used AI to write this description here. Sorry :) I will shorten it someday.

    _lights_westcoast.png
    quick test on west coast with existing streetlamps placed as forestitems

    Author: AlexKidd71
    Version: 1.0
    Release Date: October 9, 2025

    Overview
    Generate Lights is a World Editor plugin that automates the placement of lights for repeating objects in your BeamNG.drive maps. Whether you're working with TSStatic objects from Scenetree or Forest items, this tool saves hours of manual light placement by automatically generating lights at the correct positions and rotations for all matching objects in your scene.

    Key Features
    • Supports both TSStatic objects and Forest items
    • Preserves light rotation and all properties from template lights
    • Automatically creates organized SimGroups for generated lights
    • Handles multiple lights per object
    • Skips the template object to avoid duplicating source lights
    • Simple 3-step workflow

    Installation
    1. Download the .zip file in this thread article.
    2. Open up the file and place its content into your userfolder.
    3. Alternatively, open up the file and place its content into your BeamNG.drive root directory (can be easily found by right-clicking on BeamNG Drive in Steam → Manage → Browse local files): Place the lua folder where the lua folder is.
    4. Alternatively, navigate through all folders in the .zip attached and place the .lua files in BeamNG.drive\lua\ge\extensions\editor.
    5. Restart BeamNG.drive or reload the World Editor
    6. Access the plugin from the World Editor menu: Editor → Generate Lights

    How It Works
    The plugin calculates the relative position and rotation of lights compared to a template object, then replicates those lights at all matching objects in your scene with the correct transformations.

    Step-by-Step Tutorial

    Example Scenario: Street Lamps

    Let's say you have 50 lamp posts placed as Forest items in your map, and you want to add lights to each one.

    Step 1: Set Up Your Template
    1. Select ONE lamp post that will serve as your template
    2. Place and configure your lights on this lamp post:
      • Position them exactly where you want them
      • Configure all properties (color, brightness, radius, angles, etc.)
      • Adjust rotation for spotlights to point in the correct direction
    3. Make sure you're happy with the result - these will be your reference lights

    Step 2: Select Template Object
    1. Open the Generate Lights window from the Editor menu
    2. In the World Editor Scene Tree, select your template lamp post
      • For TSStatic objects: Select the object in the Scene Tree
      • For Forest items: Use the Forest Editor to select the item
    3. Click the "Get Object by Selection" button in the plugin window
    4. You should see the shape filename displayed (e.g., "lamp_post_01.dae")

    Step 3: Select Template Lights
    1. In the Scene Tree, select the light(s) you placed on the template object
      • You can select multiple lights by holding Ctrl
      • Only PointLight and SpotLight objects are supported
    2. Click the "Get Light(s) by Selection" button
    3. The plugin will show how many lights are selected

    Step 4: Generate Lights
    1. Click the "Generate Lights" button
    2. The plugin will:
      • Find all objects matching your template shape
      • Skip the template object itself (no duplicate lights)
      • Create copies of your lights at each matching object
      • Preserve all light properties and rotations
      • Place all generated lights in a numbered SimGroup (e.g., "generated_lights_1")

    Step 5: Review and Adjust
    1. All generated lights are organized in a SimGroup in your Scene Tree
    2. You can easily delete all generated lights by removing the SimGroup
    3. If you need to regenerate, just delete the group and run the plugin again

    Working with TSStatic Objects
    TSStatic objects are regular scene objects like props, signs, or decorative elements.

    Process:
    1. Place your TSStatic template object
    2. Add and configure lights on it
    3. Select the TSStatic object in the Scene Tree
    4. Follow the 3-step workflow above

    The plugin finds all TSStatic objects with the same shapeName field and generates lights for each one.

    Working with Forest Items
    Forest items are BeamNG's optimized system for placing many identical objects (trees, rocks, lamp posts, bollards, etc.).

    Process:
    1. Place your forest items using the Forest Editor
    2. Select one forest item as your template
    3. Add and configure lights near that forest item's position
    4. In the Forest Editor, select the template forest item
    5. Follow the 3-step workflow above

    The plugin finds all forest items with the same shapeFile and generates lights for each one.

    Tips and Best Practices

    Light Configuration:
    • Configure all light properties (color, range, brightness, shadows) on the template lights before generating
    • For spotlights, pay special attention to rotation - it will be preserved
    • Use realistic light ranges to maintain good performance

    Organization:
    • Each generation creates a new numbered SimGroup (generated_lights_1, generated_lights_2, etc.)
    • This makes it easy to manage and delete light batches
    • Keep your template lights in a separate group for easy reference

    Performance:
    • Generated lights use the same SimGroup system as manual lights
    • Consider using lights with appropriate ranges to avoid performance issues
    • Test with a small section first before generating lights for hundreds of objects

    Iteration Workflow:
    • If you need to adjust lights, delete the generated_lights group
    • Modify your template lights
    • Regenerate - the plugin will skip the template object automatically

    Multiple Light Types:
    • You can select multiple lights (e.g., one spotlight + one point light)
    • All selected lights will be generated at each target object
    • Useful for complex lighting setups like lamp posts with both main and ambient lights

    Troubleshooting

    "No valid TSStatic or Forest item selected"
    • Make sure you're selecting the actual object, not a light
    • For Forest items, use the Forest Editor selection tool

    Lights have wrong rotation
    • The plugin preserves rotation from template lights
    • Check your template light rotation before generating

    Lights not appearing
    • Check the console log for error messages
    • Verify the template object type matches target objects

    Too many/too few lights generated
    • The plugin finds ALL objects matching the template shape
    • Check how many matching objects exist in your scene
    • Template object is automatically skipped

    Technical Details

    Supported Light Types:
    • PointLight
    • SpotLight

    Supported Object Types:
    • TSStatic (scene tree objects)
    • Forest Items

    Light Properties Preserved:
    • All fields from template lights (color, brightness, range, etc.)
    • Rotation (critical for spotlights)
    • Light type and class

    Coordinate System:
    • Uses quaternion math for accurate rotation handling
    • Calculates relative positions in local coordinate space
    • Applies rotations correctly regardless of object orientation

    Use Cases
    • Street lighting for roads with lamp posts
    • Decorative lights on repeating architectural elements
    • Navigation lights on multiple identical structures
    • Interior lighting for instanced building props
    • Warning lights on safety barriers or bollards
    • Atmospheric lighting for forest or environmental objects

    Version History

    Version 1.0 (October 9, 2025)
    • Initial release
    • Support for TSStatic objects
    • Support for Forest items
    • Automatic template object skipping
    • Multi-light support
    • Organized SimGroup creation

    Credits and License
    This plugin is released under the bCDDL v. 1.1 license.
    Developed by AlexKidd71
    @stuffi3000 and @Barbent Servo GT for inspiration and good talks!

    For support, bug reports, or feature requests, please use this thread..

    Happy map making!

    Planned Features:
    --- Post updated ---
    • randomization option for variations in brightness and color for a more natural look.
    • better names for generated lights
    • select lights and optional static objects for generation. Usecase: Select a building as template object place a doorlamp dae file and place the lights, then generate lamp and lights for all similar buildings.
     

    Attached Files:

    #1 AlexKidd71, Oct 10, 2025 at 1:03 AM
    Last edited: Oct 10, 2025 at 9:47 AM
    • Like Like x 4
    • Agree Agree x 1
  2. alissonebengenharia

    alissonebengenharia
    Expand Collapse

    Joined:
    Sep 17, 2025
    Messages:
    2
    This is really good, I was hoping for something like this — thank you!
     
    • Like Like x 1
  3. fooj

    fooj
    Expand Collapse

    Joined:
    Mar 2, 2025
    Messages:
    9
    Ill def be checking this out this might help me alllott

    --- Post updated ---

    EDIT: Works great and will make my life alot easier, however would it be possible or planned for numerical naming as in "light1, light2, light3" and so forth?
     
    • Like Like x 1
    • Agree Agree x 1
  4. AlexKidd71

    AlexKidd71
    Expand Collapse

    Joined:
    Mar 16, 2022
    Messages:
    609
    should be possible.
     
  5. stuffi3000

    stuffi3000
    Expand Collapse

    Joined:
    Feb 6, 2022
    Messages:
    62
    Very cool, Alex! Great work!
     
    • Agree Agree x 2
    • Like Like x 1
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice