Use JavaScript arrays instead of loading OBJ or GLTF in three.js for performance

300 views Asked by At

Loading OBJ/GLTF/GLB models into my three.js application takes some time, while declaring JavaScript arrays of vertices and indices of the same data and creating a new object is much faster (and less file size).

Is this good practice however? Is there a compelling reason as why to load a 3D file format instead of using JavaScript arrays which seem faster?

1

There are 1 answers

0
pailhead On

It is highly unlikely that the same data, can be so much smaller. You most likely have compression enabled for your "js arrays" format, and not for gltf, or obj