-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Further improve 3D Map View performance #60672
base: master
Are you sure you want to change the base?
Conversation
Done by adding frustum culling early in the loop, results in a ~10x speedup in one project.
🪟 Windows buildsDownload Windows builds of this PR for testing. 🪟 Windows Qt6 buildsDownload Windows Qt6 builds of this PR for testing. |
Tests failed for Qt 6One or more tests failed using the build from commit a50d2b9 shaded_terrain_no_layers (testTerrainShading)shaded_terrain_no_layersTest failed at testTerrainShading at tests/src/3d/testqgs3drendering.cpp:406 Rendered image did not match tests/testdata/control_images/3d/expected_shaded_terrain_no_layers/expected_shaded_terrain_no_layers.png (found 211503 pixels different) terrain_theme (testMapTheme)terrain_themeTest failed at testMapTheme at tests/src/3d/testqgs3drendering.cpp:1387
flat_terrain_filtered_1 (testFilteredFlatTerrain)flat_terrain_filtered_1Test failed at testFilteredFlatTerrain at tests/src/3d/testqgs3drendering.cpp:1870
dem_terrain_filtered_1 (testFilteredDemTerrain)dem_terrain_filtered_1Test failed at testFilteredDemTerrain at tests/src/3d/testqgs3drendering.cpp:1917 Rendered image did not match tests/testdata/control_images/3d/expected_dem_terrain_filtered_1/expected_dem_terrain_filtered_1.png (found 52451 pixels different) pointcloud_3d_singlecolor (testPointCloudSingleColor)pointcloud_3d_singlecolorTest failed at testPointCloudSingleColor at tests/src/3d/testqgspointcloud3drendering.cpp:280
pointcloud_3d_singlecolor_clipping (testPointCloudSingleColorClipping)pointcloud_3d_singlecolor_clippingTest failed at testPointCloudSingleColorClipping at tests/src/3d/testqgspointcloud3drendering.cpp:322
pointcloud_3d_colorramp (testPointCloudAttributeByRamp)pointcloud_3d_colorrampTest failed at testPointCloudAttributeByRamp at tests/src/3d/testqgspointcloud3drendering.cpp:371
pointcloud_3d_classification (testPointCloudClassification)pointcloud_3d_classificationTest failed at testPointCloudClassification at tests/src/3d/testqgspointcloud3drendering.cpp:408
pointcloud_3d_classification_pointsizes (testPointCloudClassificationOverridePointSizes)pointcloud_3d_classification_pointsizesTest failed at testPointCloudClassificationOverridePointSizes at tests/src/3d/testqgspointcloud3drendering.cpp:447
pointcloud_3d_filtered_classification (testPointCloudFilteredClassification)pointcloud_3d_filtered_classificationTest failed at testPointCloudFilteredClassification at tests/src/3d/testqgspointcloud3drendering.cpp:487
pointcloud_3d_filtered_scene_extent (testPointCloudFilteredSceneExtent)pointcloud_3d_filtered_scene_extentTest failed at testPointCloudFilteredSceneExtent at tests/src/3d/testqgspointcloud3drendering.cpp:526
virtual_pointcloud_3d_overview (testPointCloud3DOverview)virtual_pointcloud_3d_overviewTest failed at testPointCloud3DOverview at tests/src/3d/testqgspointcloud3drendering.cpp:603
The full test report (included comparison of rendered vs expected images) can be found here. Further documentation on the QGIS test infrastructure can be found in the Developer's Guide. |
Tests failed for Qt 5One or more tests failed using the build from commit a50d2b9 shaded_terrain_no_layers (testTerrainShading)shaded_terrain_no_layersTest failed at testTerrainShading at tests/src/3d/testqgs3drendering.cpp:406 Rendered image did not match tests/testdata/control_images/3d/expected_shaded_terrain_no_layers/expected_shaded_terrain_no_layers.png (found 211503 pixels different) flat_terrain_filtered_1 (testFilteredFlatTerrain)flat_terrain_filtered_1Test failed at testFilteredFlatTerrain at tests/src/3d/testqgs3drendering.cpp:1870
dem_terrain_filtered_1 (testFilteredDemTerrain)dem_terrain_filtered_1Test failed at testFilteredDemTerrain at tests/src/3d/testqgs3drendering.cpp:1917 Rendered image did not match tests/testdata/control_images/3d/expected_dem_terrain_filtered_1/expected_dem_terrain_filtered_1.png (found 52451 pixels different) pointcloud_3d_singlecolor (testPointCloudSingleColor)pointcloud_3d_singlecolorTest failed at testPointCloudSingleColor at tests/src/3d/testqgspointcloud3drendering.cpp:280
pointcloud_3d_singlecolor_clipping (testPointCloudSingleColorClipping)pointcloud_3d_singlecolor_clippingTest failed at testPointCloudSingleColorClipping at tests/src/3d/testqgspointcloud3drendering.cpp:322
pointcloud_3d_colorramp (testPointCloudAttributeByRamp)pointcloud_3d_colorrampTest failed at testPointCloudAttributeByRamp at tests/src/3d/testqgspointcloud3drendering.cpp:371
pointcloud_3d_classification (testPointCloudClassification)pointcloud_3d_classificationTest failed at testPointCloudClassification at tests/src/3d/testqgspointcloud3drendering.cpp:408
pointcloud_3d_classification_pointsizes (testPointCloudClassificationOverridePointSizes)pointcloud_3d_classification_pointsizesTest failed at testPointCloudClassificationOverridePointSizes at tests/src/3d/testqgspointcloud3drendering.cpp:447
pointcloud_3d_filtered_classification (testPointCloudFilteredClassification)pointcloud_3d_filtered_classificationTest failed at testPointCloudFilteredClassification at tests/src/3d/testqgspointcloud3drendering.cpp:487
pointcloud_3d_filtered_scene_extent (testPointCloudFilteredSceneExtent)pointcloud_3d_filtered_scene_extentTest failed at testPointCloudFilteredSceneExtent at tests/src/3d/testqgspointcloud3drendering.cpp:526
virtual_pointcloud_3d_overview (testPointCloud3DOverview)virtual_pointcloud_3d_overviewTest failed at testPointCloud3DOverview at tests/src/3d/testqgspointcloud3drendering.cpp:603
The full test report (included comparison of rendered vs expected images) can be found here. Further documentation on the QGIS test infrastructure can be found in the Developer's Guide. |
@dvdkon i'm not sure if it's related to the previous set of optimisations, but on current master there's a regression in 3d movement when using the mouse wheel to zoom in -- if a small zoom is performed quickly, the map will zoom in a HUGE amount. The same amount of movement zooming out works correctly. |
I can confirm that without #60246 zooming in works as usual |
Yes, I think we should. We can reintroduce it later with a fix |
Description
This PR comprises two changes to the 3D view:
Decoupling entity visibility from the currently set near/far planes: Currently, which entities are visible depends on the near/far planes. However, adding/removing entities will likely change the near/far planes that are used as input. Currently, we just re-run the scene update once, but to do this properly we'd need to loop until the planes stabilise.
I instead propose not caring about the planes when selecting entities (by just choosing small/large enough constants), which is where the current process would converge to after enough frames anyway. This way, we get rid of the second (expensive)
updateScene()
call per frame, almost doubling frame rate, and reduce complexity as a bonus.Early culling in QgsVirtualPointCloudEntity: On each scene update, the VPC entity iterates over its constituent point clouds and calls their
handleSceneUpdate()
method. That will eventually do frustum culling somewhere inQgsChunkedEntity
, but we can get a significant speedup if we do the frustum culling on whole point clouds already in the VPC entity.