GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - razluta/UnityLightsLodSystem: A Unity system to downgrade light quality (all the way to completely disabling them) as the camera gets further or as the light's area of influence is out of frustum with the purpose of improving performance.

BranchesTags
Open more actions menu

Latest commit

 

History

38 Commits
38 Commits

Folders and files

NameName
Last commit message
Last commit date
Assets
Assets
 
 
Documentation
Documentation
 
 
Editor
Editor
 
 
Runtime
Runtime
 
 
Samples
Samples
 
 
Screenshots
Screenshots
 
 
Tests
Tests
 
 
.gitignore
.gitignore
 
 
Assets.meta
Assets.meta
 
 
CHANGELIST.md
CHANGELIST.md
 
 
CHANGELIST.md.meta
CHANGELIST.md.meta
 
 
Documentation.meta
Documentation.meta
 
 
Editor.meta
Editor.meta
 
 
LICENSE
LICENSE
 
 
LICENSE.meta
LICENSE.meta
 
 
README.md
README.md
 
 
README.md.meta
README.md.meta
 
 
Runtime.meta
Runtime.meta
 
 
Samples.meta
Samples.meta
 
 
Screenshots.meta
Screenshots.meta
 
 
Tests.meta
Tests.meta
 
 
package.json
package.json
 
 
package.json.meta
package.json.meta
 
 

Repository files navigation

Unity Lights LOD (Level of Detail) System License

A Unity runtime system to downgrade light (Point, Spot) quality (all the way to completely disabling them or downgrading shadow quality) as the camera gets further (and also based on frustum) in order to improve performance.

The tool has been verified on the following versions of Unity:

  • 2021.3 (LTS)

Branches

  • main = the main active branch of the project, representing the stable main thread approach to the system
  • development-singlethreaded = the (sometimes unstable) development branh for the main thread approah to the system
  • multithreaded = a (very experimental) Unity Jobs + Burst version of the system - may perform better or worse, depending on your own game performance

Features

  • Adjustment of light LOD based on player distance
  • Disable lights that have areas of influence outside the camera's frustum
  • Ability to set custom LOD values for each light in the scene
  • Supports different types of lights (recommended only for Point and Spot)
  • Easy-to-use user interface and setup
  • In editor visual debugging using gizmos (a sphere for the light range - if applicable and a line from the camera to the light that shows the distance)

Installation

To use the Unity Lights Lod System in your Unity project, simply:

Option A) Clone or download the repository and drop it in your Unity project.

  1. Clone or download the repository
  2. Import the UnityLightsLodSystem folder into your Unity project's Assets folder

Option B) Add the repository to the package manifest (go in YourProject/Packages/ and open the "manifest.json" file and add "com..." line in the depenencies section). If you don't have Git installed, Unity will require you to install it.

{
  "dependencies": {
      ...
      "com.razluta.unitylightslodsystem": "https://github.com/razluta/UnityLightsLodSystem.git"
      ...
  }
}

Option C) Add the repository to the Unity Package Manager using the Package Manager dropdown.

The repository is at: https://github.com/razluta/UnityLightsLodSystem.git


Dependencies

While the tool has no dependencies outside of the core Unity Editor and Engine, I recommend using the Unity Lights Audit Tool to first sort the lights in the scene in order to be critical about what lights you are targetting.

Alternatively, you can use the default Unity Search to sort and examine your lights.


Using the tool

To implement the Unity Lights Lod System in your Unity project, simply:

Step 01 - Add the LightLodManager.prefab in your scene (or add the 'LightModManager.cs' script to an empty GameObject in your scene)

You can simply drag the LightLodManager.prefab in your scene. The manager acts as a singleton. The main parameter in the UI is the Update Rate, which dictates how often the the LightLodManager will update LODs in the scene. By default, it is set to 0.1f, which means it will run try to run about 10 times per second.

Step 02 - For each light you want to LOD, add a LightLod.cs script in their GameObject

The LightLod component will be the one to tell the manager what properties we want to LOD on each light. The "Is Disable After Last Lod" property will disable the light after the last LOD's max distance is surpassed. If the light should be visible at high distances, feel free to keep this flag disabled. Note: make sure the min and max distances are not overlapping otherwise you might experience unexpected behavior. Include as many LODs as you need. The screenshot below shows an LOD setup example.


Special notes

Please note that I highly recommend you only use the LOD component on Point and Spot lights. Any type of LODing optimizations would be very noticeable and jarring on other light types.


Use-cases

I recieved enough questions about why this is useful that I figured I would address it: in large dynamic worlds with many lights (especially small range, low intensity point lights), there's a not insignficant CPU cost to the calculating the lights (direct light influence, shadow casting, etc). This tool allows you to significantly reduce (possibly to completely eliminate on some lights, at certain distances) the calculations needed to be performed every frame.

This project is most useful for large levels with many small lights, especially if there are objects blocking the player's line of sight (so they don't see the quality change or the light pop on or off).


Contributing

If you would like to contribute to the Unity Lights LOD System, please:

  1. Fork the repository
  2. Create a new branch
  3. Make your changes
  4. Submit a pull request

License

The Unity Lights LOD System is licensed under the MIT License. See the LICENSE file for details.

About

A Unity system to downgrade light quality (all the way to completely disabling them) as the camera gets further or as the light's area of influence is out of frustum with the purpose of improving performance.

Resources

Readme
Activity

Stars

12 stars

Watchers

1 watching

Forks

4 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.