[Interest] [Qt3D] Frustum culling
Émeric MASCHINO
emeric.maschino at gmail.com
Wed Jun 29 22:38:13 CEST 2016
Hi,
I don't understand how frustum culling works with Qt3D (Qt 5.7 as time
of writing).
>From QFrustumCulling documentation [1]: "If present, only tries to
draw entities that are in the view of the camera. The camera is
selected by a QCameraSelector frame graph node in the current
hierarchy."
How "If present" should be interpreted? I mean, how/where in the
framegraph should QFrustumCulling be created/added/made a child of
what?
I thus had a look at Qt3DExtras::QForwardRenderer source code [2].
There, QFrustumCulling is simply made a child of a QClearBuffers
instance. But that's all. Is this sufficient to enable frustum
culling? And why not making it a child of the camera selector
(m_cameraSelector member)?
If there's a reason that QFrustumCulling is a child of a QClearBuffers
instance, how would it work for multiple viewports like in the Multi
Viewports QML Example (there's no FrustumCulling instance there, hence
my question) [3]? I mean, all the viewports in the framegraph there
"share" a common ClearBuffers instance, but each viewport selects a
distinct camera, with a different point of view. The view frustum is
thus different for each viewport. If I had to enable frustum culling
in this example, should I put one instance only as a child of the main
viewport (like the ClearBuffers instance) or should I have one
FrustumCulling as a child of the top left viewport, another one as a
child of the top right viewport, and so on?
Last but not least, is frustum culling really implemented? Source code
seems... well, simple [4]. There was a related bug report, but I can't
read that much history [5].
Thanks,
Émeric
[1] http://doc.qt.io/qt-5/qt3drender-qfrustumculling.html
[2] https://github.com/qt/qt3d/blob/dev/src/extras/defaults/qforwardrenderer.cpp
[3] http://doc.qt.io/qt-5/qt3d-multiviewport-example.html
[4] https://github.com/qt/qt3d/blob/dev/src/render/framegraph/qfrustumculling.cpp
[5] https://bugreports.qt.io/browse/QTBUG-42535
More information about the Interest
mailing list