Maximum spheres that can be displayed in Qt3D.
-
I m trying to put >1M spheres on the 3D display. Currently I m able to display only ~32k points beyond which following error is displayed:
Qt Concurrent has caught an exception thrown from a worker thread. This is not supported, exceptions thrown in worker threads must be caught before control returns to Qt Concurrent. terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc 17:07:55: The program has unexpectedly finished. 17:07:55: The process was ended forcefully. 17:07:55: /home/suraj/Qt_projects/build-simple-cpp-Desktop_Qt_5_15_2_GCC_64bit-Release/simple-cpp crashed.
What is the maximum number of items that can be displayed?
What does above error message mean? -
@surajj4837 you ran out of memory?
-
Thanks @artwaw for your reply. I observed the memory usage for multiple runs, the program is consuming ~3.7GB of RAm and I have a 16GB RAM machine.
-
Don't put so many geometries in a scene, you couldn't possibly draw them anyway.
-
@ofmrew said in Maximum spheres that can be displayed in Qt3D.:
@kshegunov One solution is to put the spheres in a spatial database and only draw those that are within some space.
A k-d tree, possibly, but how you store them is really beside the point. The OpenGL API puts a limit on the indirect indexing of vertices at 32k, so you can't possibly have as many points in a mesh. If they are different meshes, then that means millions of draw calls and data flushes to the OGL pipeline, which is going to take forever anyway.
-
But this a simple rendering of spheres, I have seen more complex rendering using Qt. Here is an example. How this is possible and current sphere plotting problem not?
-
@surajj4837 said in Maximum spheres that can be displayed in Qt3D.:
But this a simple rendering of spheres, I have seen more complex rendering using Qt. Here is an example.
This makes no sense. The visual appearance is irrelevant, the only thing that matters is how much draw primitives you have/are using.
How this is possible and current sphere plotting problem not?
Did you read my last post?
-
Thanks @kshegunov, I read your last post but still I had that doubt of complexity of scenario.
-
@surajj4837 said in Maximum spheres that can be displayed in Qt3D.:
Thanks @kshegunov, I read your last post but still I had that doubt of complexity of scenario.
You claim that because addition is much, much simpler than division, then a quadrillion additions should be simpler than a few billion divisions.
Or to give you another example:
Because we can do nuclear fusion in the lab - fusing a few thousands nuclei or so, then it's just the same to build a fusion reactor and get energy out of it. If that were the case how come we don't have commercially viable fusion reactors?
Scale matters! It is a complexity by itself! You can't just claim that because the sphere is a simple element you can arbitrarily put billions of them in a 3D scene and expect it to "just work", that's not how the real world works ...
-
Thanks @kshegunov for resolving my doubts. Thanks @artwaw and @ofmrew for your valuable inputs.
-
@surajj4837 We ran into this problem in the early days of GIS: too many graphical object to display in a reasonable amount of time. The solution is selection: Not all the spheres are in view nor or most of a size to be seen at the current scale, so only select those that are viewable and discard the rest.