Obj format models load slowly

QQ%E5%9B%BE%E7%89%8720190808181538
There are five models, but 2.obj loaded nine times, 5.obj loaded four times, 7.obj loaded eight times. Graphics display too slow. Is there a way to optimize it? Thanks!

Hello,

If you are reusing the 3D models, instead of loading them repeatedly, load them only once, clone and reuse it. It helps with the load time. Also try to use GTLF format along with Draco compression to help with the file size.

By saying that the graphics is slow, i assume that you mean the rendering. You might have a large number of draw calls per frame which will reduce the frame rate.

Type the below in your console to see the number of draw calls per frame.

renderer.info.render

To reduce the draw calls, there is concept called Instancing. There are multiple examples in the official site however I cannot talk much about instancing as i myself is yet to figure that out completely.

Regards,

1 Like

Thank you for your reply,
From the beginning until the display image in more than two seconds of time, it doesn’t take long to load a single obj file, but it does take several loads. I’ve seen clone methods available.
Object3D.clone
But I don’t understand how to use it.
Regards,

1 Like

OBJ files tend to be large, and also take a long time to process before being shown. Using glTF will get you a slightly smaller file and much less processing time. Using glTF with Draco mesh compression (see glTF-Pipeline) can make the size of the geometry in the file much smaller, but increases the processing time.

Try not to load the same file twice. Instead load it once, and make copies:

loader.load( 'foo.gltf', function ( gltf ) {
  var model1 = gltf.scene;
  var model2 = model.clone();
  var model3 = model.clone();
  // ...
} );

1 Like