- Qt 6.12
- Qt 3D
- QML Types
- Qt3D.Render (Deprecated)
- LevelOfDetail
- Qt 6.12.0 Reference Documentation

# LevelOfDetail QML Type

LevelOfDetail provides a way of controlling the complexity of rendered entities based on their size on the screen. More...

Import Statement: | `import Qt3D.Render 2.12`
In C++: | QLevelOfDetail
Inherits: | Component3D
Status: | Deprecated

This type is deprecated. We strongly advise against using it in new code.

- List of all members, including inherited members

## Properties

- ThresholdType : enumeration
- camera : Camera
- currentIndex : int
- thresholdType : int
- thresholds : QList<qreal>
- volumeOverride : int

## Detailed Description

LevelOfDetail can be used to control the representation of an entity based on distance from the observer or size on the screen.

In order to improve rendering performance, objects that are very small can be rendered using far fewer details, in geometry or texture.

The component is controlled by specifying thresholds of values which are interpreted as either distances from the camera or screen size.

As the point of view changes, the currentIndex property will change to reflect matching value in the range array.

The currentIndex property can then be used, for example, to enable or disable entities, change source in an EntityLoader, or material.

The LevelOfDetail component is not shareable between multiple Entity's.

     import Qt3D.Core 2.0
     import Qt3D.Render 2.0

     Entity {
         id: root

         // Scene
         Camera { id: mainCamera }

         LevelOfDetail {
             id: lod
             camera: mainCamera
             thresholds: [20, 35, 50, 65]
             thresholdType: LevelOfDetail.DistanceToCameraThreshold
         }

         GeometryRenderer {
             id: mesh
             view: CylinderMesh {
                 property var sliceValues: [20, 10, 6, 4]
                 slices: sliceValues[lod.currentIndex]
             }
         }

         Entity {
             id: renderableEntity
             components: [ mesh, lod ]
         }
     }

## Property Documentation

### ThresholdType : enumeration

Specifies how the values in the thresholds are interpreted

- DistanceToCameraThreshold Distance from the entity to the selected camera
- ProjectedScreenPixelSizeThreshold Size of the entity when projected on the screen as seen from the selected camera, expressed in number of pixels on the side of the bounding square in screen space.

See also Qt3DRender::QLevelOfDetail::ThresholdType.

### camera : Camera

Holds the id of the camera that is used to compute the actual distance or the screen size.

### currentIndex : int

The index in the range array which matches the current distance to the camera or screen size.

### thresholdType : int

Specifies how range values are interpreted.

### thresholds : QList<qreal>

Array of range values as float point numbers. The value for the most detailed representation should be specified first.

If LevelOfDetail::thresholdType is set to LevelOfDetail.DistanceToCameraThreshold, values should be specified in ascending order, in camera space coordinates

If LevelOfDetail::thresholdType is set to LevelOfDetail.ProjectedScreenPixelSizeThreshold, values should be specified in descending order, in screen space pixels.

### volumeOverride : int

Specifies what is used to evaluate the distance or screen size.

The default is a sphere of radius 1 and centered at the local origin of the entity. This proxy volume is used to compute the distance to the camera or the size of the screen projection.

If this value to null, the bounding volume of the entity is used. Care must be taken that this bounding volume never becomes invalid.

See also Qt3DRender::QLevelOfDetailBoundingSphere.