Skip to content
Browse files
Switch 3D render policy from "Always" to "On Demand" (fixes #25390)
The on demand policy lowers the load quite significantly (top on my laptop
show the %cpu went from ~300% to ~50% when the 3D scene is idle).

Previously when I tried to enable the on demand policy in Qt 5.9.0, things
were not getting any better, but it seems things got fixed later in Qt 5.9.5:
  • Loading branch information
wonder-sk committed Apr 13, 2021
1 parent 9cf1edf commit 18642371e9ec2c143b34cd63fd65a6a5d4773579
Showing with 4 additions and 3 deletions.
  1. +4 −3 src/3d/qgs3dmapscene.cpp
@@ -91,9 +91,10 @@ Qgs3DMapScene::Qgs3DMapScene( const Qgs3DMapSettings &map, QgsAbstract3DEngine *
connect( &map, &Qgs3DMapSettings::backgroundColorChanged, this, &Qgs3DMapScene::onBackgroundColorChanged );

// TODO: strange - setting OnDemand render policy still keeps QGIS busy (Qt 5.9.0)
// actually it is more busy than with the default "Always" policy although there are no changes in the scene.
//mRenderer->renderSettings()->setRenderPolicy( Qt3DRender::QRenderSettings::OnDemand );
// The default render policy in Qt3D is "Always" - i.e. the 3D map scene gets refreshed up to 60 fps
// even if there's no change. Switching to "on demand" should only re-render when something has changed
// and we save quite a lot of resources
mEngine->renderSettings()->setRenderPolicy( Qt3DRender::QRenderSettings::OnDemand );

// we want precise picking of terrain (also bounding volume picking does not seem to work - not sure why)
mEngine->renderSettings()->pickingSettings()->setPickMethod( Qt3DRender::QPickingSettings::TrianglePicking );

0 comments on commit 1864237

Please sign in to comment.