How to use the LOD function from three

Find comprehensive JavaScript three.LOD code examples handpicked from public code repositorys.

I'm sorry, but I am not familiar with three.LOD. It seems like an incomplete or incorrect name. Can you please provide more information or context?

83
84
85
86
87
88
89
90
91
92
var _a;
var map = null;
if (this._options.textureUrl) {
    map = new THREE.TextureLoader().load(this._options.textureUrl);
}
var detailedObj = new THREE.LOD();
var levelsOfDetail = this._options.levelsOfDetail || [
    { radii: 0, segments: 64 },
];
var radius = this.getScaledRadius();
fork icon0
star icon0
watch icon1

+ 25 other calls in file

How does three.LOD work?

three.LOD is a built-in Three.js object that represents a level of detail object, which is used to represent an object at different levels of detail. The object has a list of child objects, each representing a different level of detail, and it uses distance from the camera to determine which level of detail to display. When the camera is far away from the object, the object is represented by a low-poly version, and as the camera gets closer, higher-poly versions are displayed until the most detailed version is shown. The three.LOD object is used to create complex scenes with high levels of detail while still maintaining good performance.

Ai Example

1
2
3
4
5
6
7
8
9
10
11
12
13
// create high-poly and low-poly versions of the same mesh
const highPolyMesh = new THREE.Mesh(highPolyGeometry, material);
const lowPolyMesh = new THREE.Mesh(lowPolyGeometry, material);

// create a new LOD object
const lod = new THREE.LOD();

// add the meshes to the LOD object with a distance threshold
lod.addLevel(highPolyMesh, 0);
lod.addLevel(lowPolyMesh, 100);

// add the LOD object to the scene
scene.add(lod);

In this example, the THREE.LOD object is used to create an LOD mesh that displays the high-poly mesh when the camera is closer than 100 units to the object and the low-poly mesh otherwise.

Other functions in three

Sorted by popularity

function icon

three.Vector3 is the most popular function in three (22341 examples)