Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved Maximum spheres that can be displayed in Qt3D.

    General and Desktop
    4
    12
    321
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      surajj4837 last edited by

      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?

      artwaw 1 Reply Last reply Reply Quote 0
      • artwaw
        artwaw @surajj4837 last edited by

        @surajj4837 you ran out of memory?

        For more information please re-read.

        Kind Regards,
        Artur

        1 Reply Last reply Reply Quote 1
        • S
          surajj4837 last edited by

          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.

          kshegunov 1 Reply Last reply Reply Quote 0
          • kshegunov
            kshegunov Moderators @surajj4837 last edited by

            Don't put so many geometries in a scene, you couldn't possibly draw them anyway.

            Read and abide by the Qt Code of Conduct

            O 1 Reply Last reply Reply Quote 2
            • O
              ofmrew @kshegunov last edited by

              @kshegunov One solution is to put the spheres in a spatial database and only draw those that are within some space.

              kshegunov 1 Reply Last reply Reply Quote 0
              • kshegunov
                kshegunov Moderators @ofmrew last edited by

                @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.

                Read and abide by the Qt Code of Conduct

                1 Reply Last reply Reply Quote 4
                • S
                  surajj4837 last edited by

                  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?

                  kshegunov 1 Reply Last reply Reply Quote 0
                  • kshegunov
                    kshegunov Moderators @surajj4837 last edited by

                    @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?

                    Read and abide by the Qt Code of Conduct

                    1 Reply Last reply Reply Quote 1
                    • S
                      surajj4837 last edited by surajj4837

                      Thanks @kshegunov, I read your last post but still I had that doubt of complexity of scenario.

                      kshegunov 1 Reply Last reply Reply Quote 0
                      • kshegunov
                        kshegunov Moderators @surajj4837 last edited by kshegunov

                        @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 ...

                        Read and abide by the Qt Code of Conduct

                        1 Reply Last reply Reply Quote 2
                        • S
                          surajj4837 last edited by

                          Thanks @kshegunov for resolving my doubts. Thanks @artwaw and @ofmrew for your valuable inputs.

                          O 1 Reply Last reply Reply Quote 0
                          • O
                            ofmrew @surajj4837 last edited by

                            @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.

                            1 Reply Last reply Reply Quote 1
                            • First post
                              Last post