cesium: Performance degradation with large point clouds and show condition on M1 Mac
Hello!
I observed a performance degradation when rendering large points clouds that use the conditional show
attribute. I’m certain that the performance was much better, in a project I’m using such a technique to filter for attributes from the tileset’s batch table and now the framerate drops a lot when the filters are applied. Maybe it only affects macOS / arm architecture — on a Linux / Intel workstation with NVIDIA GPU it works fine.
A quick performance monitoring in the dev tools showed that readPixels
consumes a lot of time which is called for scene picking. Is there a way to turn off picking for Cesium3DTileset
? That might help in my case.
I can reproduce this in a sandcastle with the Melbourne point cloud, and you can see the framerate drops from ~100 fps to ~10 fps when zooming in:
https://user-images.githubusercontent.com/449600/236436953-c1d84f1b-3a67-4a1e-a663-8de8214e834a.mov
Browser: Google Chrome Version 113.0.5672.63 (Official Build) (arm64)
But similar experience with Safari / Firefox
Operating System: macOS 13.3.1 (a) on M1 Max
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 21 (9 by maintainers)
I have a similar observation with a large performance hit on integrated Intel graphics (in particular Intel® UHD Graphics for 10th Gen Intel® Processors as in the i7-10510U). The issue does not show on the dedicated GPUs I have access to.
I have found a one-line fix, that improves the performance a lot in my case:
In packages/engine/Source/Shaders/Model/CPUStylingStageVS.glsl in
cpuStylingStage()
, comment out the following line:Note that you may need to re-build Cesium to re-generate the
CPUStylingStageVS.js
file. Otherwise the changes won’t take effect.To anyone who is able to reproduce this performance issue, please check if this improves the performance for you.
My theory is as follows:
positionMC
to zero, in case it is hidden (i.e.show
is zero)positionMC
is in model coordinates (not screen space yet), so we just move the points to the origin of the tile / tileset, which is likely to still be in viewA proper fix for that would be to actually move the hidden points off-screen, i.e. setting
gl_Position
accordingly.Thanks @ulrichson ! I’ll try to take a look by the end of this week 😃
Hey @ulrichson,
Sorry about the delay. This completely slipped my radar. I’m happy to take a look – I should have a moment by the end of this week.
There was a fairly large refactor that went in with that change. @j9liu would you be able to recommend a place to start looking regarding changes from ModelExperimental related to performance picking point clouds?