Display performance decreasing a lot when segment tool is enabled

Feel free to ask any question here
ryukisai
Posts: 9
Joined: Tue Aug 24, 2021 3:27 pm

Display performance decreasing a lot when segment tool is enabled

Post by ryukisai »

Hey there, i noticed that the display performance (FPS) is decreasing a LOT while the segment tool is enabled.
On my laptop, with a ≈3 Mpts cloud, the display is perfectly smooth (50 to 60 fps), but when i open the segment tool it drops to ≈ 7 fps on average. I’m here referring to fps while moving the cloud around.
Is that expected / normal behavior?
Note that this laptop is nothing mighty (GPU is an Nvidia MX130). On powerful PCs the effect is less visible but still present.
Thanks in advance for any feedback!
daniel
Site Admin
Posts: 7721
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Display performance decreasing a lot when segment tool is enabled

Post by daniel »

Yes, that's possible, because in this mode CC changes the display mode (instead of loading the points on the GPU and display them all at once, it has to choose only a subset dynamically).

Still, it's a bit strange to observe such a drastic drop... Especially for such a small cloud. Is the laptop switching automatically to use an Intel chipset instead of the NVidia card maybe? (this can be seen in the Console, at the beginning).
Daniel, CloudCompare admin
PablerasBCN
Posts: 297
Joined: Sat Jan 20, 2018 1:57 pm

Re: Display performance decreasing a lot when segment tool is enabled

Post by PablerasBCN »

I confirm that as you go on with segmentation it gets choppier to the point I've to save what I've done and continue the segmentation by relaunching the tool.
daniel
Site Admin
Posts: 7721
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Display performance decreasing a lot when segment tool is enabled

Post by daniel »

Was it better before, or is it a general observation?
Daniel, CloudCompare admin
ryukisai
Posts: 9
Joined: Tue Aug 24, 2021 3:27 pm

Re: Display performance decreasing a lot when segment tool is enabled

Post by ryukisai »

Honestly i'm unsure if it was better before or always like that…
I usually work on decent computers so i did not really pay attention to this performance drop before honestly. However on my field work laptop it's pretty obvious.
Also worth mentionning, i used to work only in orthographic mode, without a 3d mouse. Now i'm trying to improve my workflow, i got myself a spacemouse and i'm beginning to use it together with viewer-based perspective and the new far clipping plane. So i need much more movement of the view.
I'll test with 2.11 and report!
ryukisai
Posts: 9
Joined: Tue Aug 24, 2021 3:27 pm

Re: Display performance decreasing a lot when segment tool is enabled

Post by ryukisai »

Hey! Ok i just tried with a ≈4 Mpts cloud on 2.11.3 on our nice processing PC, it's the same, when i wiggle the cloud in the 3d view i get 55 to 60 fps when the segment tool is inactive, 5 to 10 fps when the tool is active and on pause.
Also worth mentioning: the GPU and CPU usage only marginally increases between the two,
GPU is 30 to 40% in the 1st case, 40 to 48% in the second.
CPU is 4 to 7% in the 1st case, 7 to 9% in the second.

Is there a way to change CC so that the display mode/buffer changes only when you begin a polygon (i.e. clicking the first vertex)??
In my mind it's not needed before that (but i'm not seeing the whole picture and might be wrong)…
I tried to have a look at the code to find this change, but honestly i confess it's beyond me…
Do you want me to create a github issue for this? Thanks anyway :-)

edit: our processing PC does not have an integrated GPU, so the performance drop can’t be linked to a that.
daniel
Site Admin
Posts: 7721
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Display performance decreasing a lot when segment tool is enabled

Post by daniel »

Yes, the main difference between the 2 modes is the transfer from CPU to GPU memory (in the standard case it might not even be needed, or in the worst case a big block of memory is copied at once, while in the segmentation mode, we always have to copy them and it takes time to pack the data before sending them to the GPU).

I modified the code so as to avoid enabling the 'visibility array' right from the start, but it will only speed-up things until the first segmentation is performed. Of course, after this point the number of visible points might be much smaller. Or the user can close the tool and restart to speed up things a little.

I'll warn you when the online version will be updated.
Daniel, CloudCompare admin
daniel
Site Admin
Posts: 7721
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Display performance decreasing a lot when segment tool is enabled

Post by daniel »

The new 2.13.alpha version is now online.
Daniel, CloudCompare admin
ryukisai
Posts: 9
Joined: Tue Aug 24, 2021 3:27 pm

Re: Display performance decreasing a lot when segment tool is enabled

Post by ryukisai »

Hey Daniel, i just tried, that's a great improvement! And thanks to your feedback i now understand better what's happening.
The visibility array depends on the point of view, that's why it needs to be "uploaded" to the GPU every time the display is updated?

Speculative/candid: What if instead of handling this with a visibility array on the source cloud, we used a copy of the resultant cloud? We would need more ram for sure but then also only 1 write operation per segmentation, isn't it?
Please take into account that i'm not a programmer so ignore the above paragraph if this is impossible to achieve / would not help / stupid! ;-)

Anyway, this change makes it possible to automate stuff in order to get the best performance all the time.
I think i'm going to try and make an autohotkey script to automatically run when the 1st segmentation is done, close the tool, deal with the results and restart it. I'll let you know if that works (could help other users).
Thank you!!
ryukisai
Posts: 9
Joined: Tue Aug 24, 2021 3:27 pm

Re: Display performance decreasing a lot when segment tool is enabled

Post by ryukisai »

Hey! So this simple autohotkey code is a way to automate the end of the selection and restart of the segment tool in order to always get the best performance.

Code: Select all

#IfWinActive, ahk_exe CloudCompare.exe	; Whenever the active window is CC
   <!o::					; Whenever Alt+o is pressed:
      MouseGetPos, xpos, ypos		; Gets the current cursor position
      Send, o{Enter}			; Ends the selection with "o" and the segment tool with {Enter}
      Click, 95 118 1, Left 		; Click in the DB tree to focus it (x y might vary depending on your settings)
      Send, {End}{Up}{Space}{Down}	; hides the "remaining" cloud and selects the "segmented" cloud
      Click, %xpos% %ypos% 0		; Goes back to the cursor's original position
      Send, t				; Re opens the segment tool
   return
Post Reply