Optimization for Lights

Discussion in 'Programming' started by Spencer Johnson, Sep 26, 2022.

  1. Spencer Johnson

    Spencer Johnson
    Expand Collapse

    Joined:
    Jul 11, 2016
    Messages:
    291
    Is there any code for adding a distance LOD for lights? As you know, lights are very intensive for this game and I'm working on a map with a ton of them. Is there any code / lua script I could implement to turn the lights off when the camera / vehicle is at a specified distance?
     
  2. vulcan-dev

    vulcan-dev
    Expand Collapse

    Joined:
    Jan 28, 2017
    Messages:
    245
    Not in-game right now but this should be fairly simple.
    You'll have to iterate over all lights and check whether that's in a certain radius of a player, if not then you can set "isRenderEnabled" to false.

    Note: Iterate over all lights when they load in the map, not every tick.
    If you need more help, let me know. I'll be glad to make a test mod for it :)
     
    • 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