Qt3d: Artifacts of displaying when applied Qt3DRender::QLayerFilter

前端 未结 2 2012
鱼传尺愫
鱼传尺愫 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:05

    Fixed. In the original example, an error found. I don't fully understand why it's the right thing to do:

    auto clearBuffers = new Qt3DRender::QClearBuffers(cameraSelector);
    

    insted

    auto clearBuffers = new Qt3DRender::QClearBuffers(renderSurfaceSelector);
    
    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题