-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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
Import a large glb file (778MB) which contains 800 models will crash the editor. #93587
Comments
Can you check 4.3? The cow data size was increased to a larger number |
Tried on latest from github (4 or 5 days ago). I hang on import. Restarting the editor restarts and re-hangs the import, automatically. |
@lvcivs I created this file just for testing purpose, want to see how godot will handle it :P |
After transferring the model to Godot 4.3 beta2, it still didn’t load for me, I waited 28 minutes, then closed it. Godot v4.3.beta2 - Windows 10.0.19045 - Vulkan (Mobile) - dedicated Radeon RX 560 Series (Advanced Micro Devices, Inc.; 31.0.14001.45012) - Intel(R) Core(TM) i5-4570 CPU @ 3.20GHz (4 Threads) |
Next steps is to get profiles for the load. My recommendations is use either https://github.com/mstange/samply or https://superluminal.eu/ |
Yes. I have been able to load the file. I did some quick benchmarking with Visual Studio and have a couple of very small efficiencies made locally. I need to benchmark the before and after when I get some really good changes made to this. |
I will try to review any pull requests that can improve load times on the 777mb glb with nothing broken. |
Oh... Nothing broken? Ah, nevermind then. |
Created in response to: godotengine#93587 Large glb file (778 MB) would hang, crash or load after extremely long time. This first set of optimizations focuses on sending SVec3 objects by reference instead of by value. Local tests in debug mode caused one iteration of GenerateSharedVerticesIndexList to go from 552ms to 470ms, on average. Unsure of the performance gains on release mode.
Created in response to: godotengine#93587 Large glb file (778 MB) would hang, crash or load after extremely long time. This first set of optimizations focuses on sending SVec3 objects by reference instead of by value. Local tests in debug mode caused one iteration of GenerateSharedVerticesIndexList to go from 552ms to 470ms, on average. Unsure of the performance gains on release mode.
Ok, I didnt know github would add these comments from my own fork because I referenced the Issue in the description. I will be avoiding that in the future. |
Since I ended up looking into this a little bit, I'll share my findings in hopes that it will help. Measured by clicking "Reimport" on the scene in an otherwise empty project, --verbose says import took 276 seconds (that's a little under 5 minutes). perf profile on Linux / editor build with default settings with fno-omit-frame-pointers -- please note that timings add up to 45% (perf doesn't normalize them): Renormalizing the percentages by dividing by 0.45, and focusing on significant underlying components, we get:
In aggregate, LOD generation takes ~78% here, so definitely good to focus on that. When looking at something like a 5-minute import though, my expectations are usually that small gains are not terribly exciting, so something more significant needs to happen. A note on the scale here: each mesh gets approximately 6 LOD levels generated. The work for meshopt_simplify scales with that; the work for normal reprojection scales with the total number of rays, which scales with the total number of triangles in all LODs, times the area factor - looks like we cast 16..64 rays which is a lot of rays :) If I were tackling this problem, I would entertain the following projects:
I would not advise trying to optimize the internals of
Hopefully this is helpful :) I would be happy to discuss (3)/(5) further and/or maybe contribute a patch or two as I'm generally interested in making sure simplification integration is working well for Godot; I'll leave 1/2/4 to others if they are motivated to work on this. |
On "I'm not 100% sure the current normal processing in the importer for LODs is generally beneficial", I decided to do a quick comparison on the scene from this file. It looks like it's easy to disable normal override, basically just need to disable the ray caster creation (as mentioned earlier, I believe current splitting logic to be generally beneficial for faceted meshes). I then look at a few low LODs (where the risk of picking a bad normal due to ray casts is maximized), by tuning the LOD bias to be a very small value. On the left (yes, left, I double checked!) is the import without using the raycaster. On the right is current master (raycaster enabled). Both levels are at ~2200 triangles. I see somewhat similar issues on a few other models - this is not universal, this happened to be the first model I checked, and some models from this scene look about the same with or without the raycaster enabled. But this to me is strong evidence that raycaster should be optional, and probably opt-in. I've switched to using a smaller version of the scene from the original post (that one has 800 meshes but each mesh is duplicated 8 times, I've switched to a deduplicated version where there's only 100 meshes, easier to work with and faster to reimport). Reimport takes 37 seconds on master and 22 seconds without raycaster enabled. |
Wow, well that is surprising. Are there any examples where the raycaster was better in visual fidelity. (I understand that's somewhat subjective but your above screenshot feels fairly objective as to which is "better.") |
As someone who works on this, I am supporting changes that improves quality and performance. Can review and help test. |
After trying to import this glb file on a s23 + mobile it ends up crashing after some time, so this does not look to be the cow fault , using #93064 |
@Saul2022 does it also crash on your pc? Edited: I would expect like 10-20 gigabytes of cpu ram to be used too. |
Can't test on pc, sorry , it dead, only black screen despite the light thing is working, so prob screen issue. Edit: Also tried without lods or shadow mesh, lightbake enabled , by adjudting it on import defaults, and still crashes , so it not lods.. |
I've tried this with v4.3.stable.official [77dcf97] and this is the resulted Godot's memory crash dump: My specs: |
I suspect that developers loading that 3d asset require more than 16GB of ram. We can check how big the difference is. If the requirements is closer to 32 gb then it's a lot harder than like 18gb. Godot Engine 4.3-stableEdited: I'll try to get a cpu usage chart via samply or https://superluminal.eu/ using a custom build of 4.3-stable Edited:
Godot Engine masterEdited:
Notes
|
What is the expected behaviour if we exceed the ram (like 19gb usage on a 16 gb - 14gb free) on the system? Edited: Personally I think requiring more ram and crashing is expected on large datasets. We can attempt to use less memory, but there will always be a dataset that exceeds a limit. |
Ye i guess, i tried with multithread import off, vsync dissable and continous update ,but still crash. Though the image files did import though, except the glb scene. Maybe to avoid crash instead of crashing the engine, make it so before a crash happens, quit the import process and print an error message about not enough ram to import the scene. |
Tested versions
4.2 stable
System information
macOS 14.5 - forward+ - godot 4.2 stable
Issue description
Import a large glb file (778MB) which contains 800 models will crash the editor.
Steps to reproduce
Minimal reproduction project (MRP)
Here is the glb file
https://drive.google.com/file/d/1f74-29422AmZQJohng74ySdELGJptgSA/view?usp=sharing
The text was updated successfully, but these errors were encountered: