Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incremental loading and non-blocking parsing and rendering #4397

Closed
benbro opened this issue Feb 9, 2014 · 8 comments
Closed

Incremental loading and non-blocking parsing and rendering #4397

benbro opened this issue Feb 9, 2014 · 8 comments

Comments

@benbro
Copy link
Contributor

benbro commented Feb 9, 2014

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
Copy link
Contributor

crobi commented Feb 10, 2014

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
Copy link
Contributor

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.

@benbro
Copy link
Contributor Author

benbro commented Feb 10, 2014

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

@mrdoob
Copy link
Owner

mrdoob commented Feb 11, 2014

Yes. You can use BufferGeometryLoader and BufferGeometryExporter.

@benbro
Copy link
Contributor Author

benbro commented Feb 11, 2014

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

@mrdoob
Copy link
Owner

mrdoob commented Feb 11, 2014

@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
Copy link
Contributor

antont commented Feb 28, 2014

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.

@donmccurdy
Copy link
Collaborator

Some updates since this bug was last opened:

Closing this issue, as there is more recent discussion in #11746.

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

No branches or pull requests

6 participants