Solar Tools for PlayCanvas
  • Overview
  • Installation
  • Uranus SDK Systems
    • Uranus GPU Instancer
      • Get started with instancing
      • Working with LODs
      • Working with Cells
      • Working with Data
    • Uranus Material Effects
      • Get started with effects
      • Working with Skybox
  • Changelog
Powered by GitBook
On this page
  • Preparing your scene
  • Controlling LODs per instance
  1. Uranus SDK Systems
  2. Uranus GPU Instancer

Working with LODs

PreviousGet started with instancingNextWorking with Cells

Last updated 2 years ago

Uranus Instancer makes it easy to add Level of Detail (LOD) support in your scene.

To enable LOD support find the Uranus Instancer script component and make sure all required global LOD levels are set in the Lod Levels property:

You can add up to 10 unique LOD levels. Each level requires:

  • index: the Lod Level index used for identifying each level of detail(LOD0, LOD1 etc.).

  • start: the distance from the active camera this LOD level will get enabled at.

  • end: the distance from the active camera this LOD level will get disabled at. If set to 0 this LOD level will remain enabled even after the end distance is reached (useful for the last LOD).

LOD levels can be overlapping if required, but a good practice is to have them start/end at the exact distances.

From Wikipedia: "In computer graphics, level of detail (LOD) refers to the complexity of a 3D model representation. LOD can be decreased as the model moves away from the viewer or according to other metrics such as object importance, viewpoint-relative speed or position. LOD techniques increase the efficiency of rendering by decreasing the workload on graphics pipeline stages, usually vertex transformations. The reduced visual quality of the model is often unnoticed because of the small effect on object appearance when distant or moving fast."

Preparing your scene

For an object to use LOD levels there are some simple rules that need to be followed:

  • Entities should be using a render component.

  • The entity name should have the required suffix in its name: _LOD0 _LOD1 _LOD2 etc.

  • LOD entities should be in order under the same parent.

These entities will automatically toggle on/off based on their distance from the active camera.

Controlling LODs per instance

Whereas global LOD levels make it easy to quickly get started with level of details, in most cases your application will require finer control over LOD distances.

You can easily override the global LOD levels per entity by attaching the uranus-instancer-lod.js script.

There is a simple rule on how that should be done:

  • Attach the script in all LOD entities and set the exact LOD levels (LOD0, LOD1, LOD2) in all entities at the same time (multi-select the entities and set the required levels).

This script provides additional options when compared with the global LOD levels. These options are:

  • layer: you can override the LOD levels only for a specific scene layer by adding a comma separated list of layer names. If set to empty, LOD levels will be overridden for all layers.

  • layerType: When specifying a layer to override you can also target if the LOD settings affect the Model or the Shadow or both (All). This is useful for setting different LOD levels for certain render states (e.g. have a billboard LOD for casting tree shadows or water reflections to improve performance).

uranus-instancer.js, Lod Levels
Uranus GPU Instancer, LOD entities
uranus-instancer-lod.js, Lod Levels override
uranus-instancer-lod.js, setting up LOD entities