[Be Solved]What is the difference between loading objects in the editor and rendering objects using gltf-viewer?

Hi Everyone,
When I load an object in the editor, it will be stuck in this line
editor.execute( new AddObjectCommand( editor, scene) )
The browser crashed afterwards.
But using gltf-viewer to load objects can be rendered. Can you explain why this is the case?:thinking:

The mentioned line of code can produce problems in various way, depending on the context where it is executed. Without sharing more information from your side, it’s not possible to provide more feedback.

2 Likes

Sorry, this is my fault, which caused your distress.

I use import gltf file to the editor.

I just want to understand the difference between the two, whether there is a difference in the process from loading an object to rendering an object.

This is the GLTF file I tested.

I want to understand the principles and differences between loading objects using the editor( https://threejs.org/editor/ ) and loading objects using gltf-viewer( https://gltf-viewer.donmccurdy.com/ )

Both are using three.js and THREE.GLTFLoader. The difference in appearance will have to do with renderer and lighting settings, which could be anything you want. The lighting and renderer settings in the Editor are configurable. For my viewer you can inspect the code to find its lighting:

^of the two, the environment map usually matters much more than the ambient and directional lights.

1 Like

Thank you for your reply, I just can’t figure out why the same GLTF object can be rendered in gltf-viewer, but it will crash in the Three.js editor.

Could it be that the number of GLTF objects is too many and cause the crash? :thinking:

Ah yeah, this model has too many parts (11,000+ materials) and too many vertices (10,000,000+) for a realtime engine to handle it without some optimization. I think the Editor is crashing because it has to do more work when loading than a simple viewer does, e.g. to save the state of the scene for future editing.

1 Like

Are there any restrictions on loading GLTF objects in the editor? For example, the number of GLTF objects and the size of GLTF files.
Is there any way to avoid browser crashes and speed up loading? :dizzy_face:

No hard limits — they’d depend on the device, the GPU, and how low of a framerate you can accept. To maintain 60fps rendering in a realtime application, a good rule of thumb might be 100 draw calls and 100,000 vertices. You can go higher if you don’t mind the application slowing down, but I don’t know what numbers would cause the page to eventually crash.

With https://github.com/zeux/meshoptimizer you can bring the number of draw calls way down on this model, but it doesn’t remove enough vertices unfortunately. There might be other options that would do that.

1 Like