[Interest] Split entities into groups and render them in custom order

Sean Harmer sean.harmer at kdab.com
Sat Jul 9 21:31:47 CEST 2016


On 09/07/2016 14:27, Oleg Evseev wrote:
> Hi,
> I'm trying to understand how can I split entities into groups and render
> them in custom order.
> That is, for example, first render SkyBox - behind all entities, than a
> Ground - plane mesh in front of SkyBox, but behind everything else. Then
> render a group of many transparent entities in order of creation. After
> that all other entities render "as usual" with ColorDepthBuffer.

Well, unless you're doing something very fancy, you would normally 
render the opaque objects first followed by the transparent objects in 
back to front order.

> For now I'm using one viewport and one camera.
> Do I understand right, that I can do such rendering with help of set of
> LayerFilters (like in example Deferred Renderer
> http://doc.qt.io/qt-5/qt3drender-framegraph.html) with different
> parameters of ClearBuffers?

Using Layer components on your entities and LayerFilter nodes in the 
framegraph is indeed the way to go. You only need one ClearBuffers per 
render target node typically.

Something schematically like this:

* Viewport
** RenderSurfaceSelector
*** CameraSelector
**** ClearBuffers
**** LayerFilter [layer = opaque]
**** LayerFIlter [layer = environment]
**** LayerFilter [layer = transparent]
***** SortPolicy [ front to back]
****** RenderStateSet [ disable depth writes ]

It is the leaf nodes which delimit the various stages of frame rendering.

I would suggest rendering the environment after the opaque objects to 
reduce the required fill rate.

Hope this helps,


> So that framegraph tree is look something like this:
> Viewport
> RenderSurfaceSelector
> LayerFilter1 LayerFilter2 LayerFilter3 ...
> CameraSelector1 CameraSelector2 CameraSelector3 ... [1to1 with LayerFilters]
> [one scene camera set to all cameraselectors]
> ClearBuffers1 ClearBuffers2 ClearBuffers3 ... [1to1 with CameraSelector]
> If I'm understand framegraph description
> http://doc.qt.io/qt-5/qt3drender-framegraph.html correctly. I can set
> one CameraSelector on top of viewport with same result, right?
> Thank you for corrections in advance. Thank you!
> ---
> Regards, Oleg
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest

Dr Sean Harmer | sean.harmer at kdab.com | Managing Director UK
KDAB (UK) Ltd, a KDAB Group company
Tel. +44 (0)1625 809908; Sweden (HQ) +46-563-540090
Mobile: +44 (0)7545 140604
KDAB - Qt Experts

More information about the Interest mailing list