Qt3d: Artifacts of displaying when applied Qt3DRender::QLayerFilter

前端 未结 2 2013
鱼传尺愫
鱼传尺愫 2021-01-20 20:55

I am trying to use layer filtering as shown in this answer. For this I wrote a simple test (see below). This is a continuation of the question.

At a certain position

2条回答
  •  不思量自难忘°
    2021-01-20 21:23

    You can fix that by adding a QNoDraw node as a child of clearBuffers, as shown in this answer. The "artifact" is not caused by the layer filters, it is a problem of QClearBuffers itself.

    Making clearBuffers a child of cameraSelector may seem to work on the surface, but what's actually happening is that everything is being rendered twice, so the transparent sphere will appear darker. You can verify this by commenting out either one of the filters: the objects in the corresponding layer will get rendered anyway.

    By leaving clearBuffers as a child of renderSurfaceSelector and adding the QNoDraw, you don't get undesired stuff drawn on top of your viewport, and the filters behave as expected.

提交回复
热议问题