Incremental loading and non-blocking parsing and rendering #4397

Open
benbro opened this Issue Feb 9, 2014 · 7 comments

5 participants

@benbro

Hi,

I have large models > 20MB which blocks the browser when parsing and rendering them for several minutes.
In my case the 3D viewer is only part of the app and models are loaded in the middle of a session so showing a progressbar is not enough.

What part is the most expensive?

  • Parsing string to JSON
  • Parsing JSON object to three.js objects
  • Rendering

Are there plans to improve the browser responsiveness when loading large models?
Or maybe I'm missing existing features?

Some thoughts:

  • Break the JSON file to multiple chunks. Each file could be a separate geometry or the loader could load a large file with chunk encoding and parse and render geometries when it has enough data. (pdf.js does that).
  • Use a web worker to load and parse the data and pass it as a transferable object. I'm not sure if IE11 support this feature but FF and Chrome do. (pdf.js uses this technique).

Progressive loading of PDFs
mozilla/pdf.js#2719
Worker with transferable objects
mozilla/pdf.js#3904
http://updates.html5rocks.com/2011/12/Transferable-Objects-Lightning-Fast

@crobi

I've experienced similar problems when loading large models. I would guess that the most important optimization would be to reduce the amount of preprocessing done internally in three.js, see #4386

@bhouston

In http://Clara.io we use binary objects (like glTF and Sketchfab.com do) to reduce the need to do JSON parsing of large objects. JSON-based 3D meshes is good for debugging and prototypes, but it isn't a production solution.

Funny thing, Sketchfab and glTF are nearly the same format arrived at independently I believe.

@mrdoob mrdoob added the Enhancement label Feb 10, 2014
@benbro

Is there a way to use a BufferGeometry with the JSON format or binary format until #4386 will be implemented?

@benbro

@mrdoob Does the export include materials and textures?
Is there a command line tool to export a BufferGeometry?

@mrdoob
Owner

@mrdoob Does the export include materials and textures?

There is a MaterialExporter. You can use ObjectExporter with your mesh. Makes sure the geometry is using BufferGeometry though. There is no TextureExporter just yet.

All these exporters is what the editor uses. So you should be able to figure out how to use it by looking at the code.

Is there a command line tool to export a BufferGeometry?

Nope... Maybe you can write a node.js script for that?

@antont

we had good results with the ctm loader back last year, how it uses a worker for non- / less blocking loading too.

have been testing with gltf now, looks good so far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment