JesterWest
JesterWest

Reputation: 499

Render only part of 3D model

I have a big 3D model of a house and I would like to load only a small part of it instead of the whole model, e.g. only a 5*5*5 cube at specific position.

Is there a way to modify or truncate a 3D model in Three js? Is there another way to achive something like this?

Upvotes: 0

Views: 911

Answers (1)

Mugen87
Mugen87

Reputation: 31036

You could load the whole model and use BufferGeometry.drawRange to determine what part of the geometry should be rendered.

Simple example with a box geometry: https://jsfiddle.net/f2Lommf5/3435/

var geometry = new THREE.BoxBufferGeometry( 0.2, 0.2, 0.2 );
geometry.drawRange.count = 18; // draw half of the geometry

If you don't want to load the entire model, i suggest you split it into subparts with a 3D modeling tool like Blender. You can then load and manage the parts separately.

Upvotes: 2

Related Questions