Level of Detail - show meshes with more or less geometry based on distance from the camera.
Every level is associated with an object, and rendering can be switched between them at the distances
specified. Typically you would create, say, three meshes, one for far away (low detail), one for mid range (medium detail)
and one for close up (high detail).
const lod = new THREE.LOD();
//Create spheres with 3 levels of detail and create new LOD levels for them
for( let i = 0; i < 3; i++ ) {
const geometry = new THREE.IcosahedronGeometry( 10, 3 - i )
const mesh = new THREE.Mesh( geometry, material );
lod.addLevel( mesh, i * 75 );
}
scene.add( lod );
[example:webgl_lod webgl / lod ]
Creates a new [name].
See the base [page:Object3D] class for common properties.
Whether the LOD object is updated automatically by the renderer per frame or not. If set to false, you have to call [page:LOD.update]() in the render loop by yourself. Default is true.
Read-only flag to check if a given object is of type [name].
An array of [page:Object level] objects
Each level is an object with the following properties:
[page:Object3D object] - The [page:Object3D] to display at this level.
[page:Float distance] - The distance at which to display this level of detail.
[page:Float hysteresis] - Threshold used to avoid flickering at LOD boundaries, as a fraction of distance.
See the base [page:Object3D] class for common methods.
[page:Object3D object] - The [page:Object3D] to display at this level.
[page:Float distance] - The distance at which to display this level of detail. Default 0.0.
[page:Float hysteresis] - Threshold used to avoid flickering at LOD boundaries, as a fraction of distance. Default 0.0.
Adds a mesh that will display at a certain distance and greater. Typically the further away the distance,
the lower the detail on the mesh.
Returns a clone of this LOD object with its associated levels.
Get the currently active LOD level. As index of the levels array.
Get a reference to the first [page:Object3D] (mesh) that is greater than [page:Float distance].
Get intersections between a casted [page:Ray] and this LOD. [page:Raycaster.intersectObject] will call this method.
Create a JSON structure with details of this LOD object.
Set the visibility of each [page:levels level]'s [page:Object3D object] based on distance from the [page:Camera camera].
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]