[Interest] Qt3D Framegraphs

Andy asmaloney at gmail.com
Mon Sep 3 14:54:18 CEST 2018


Progress! Here's my current framegraph:

RenderSurfaceSelector:
  Viewport:
    ClearBuffers:
      buffers: ColorDepthBuffer
      clearColor: "#EEfaebd7"
      NoDraw: {}
    FrustumCulling:
      # OnScreen
      CameraSelector:
        objectName: onScreenCameraSelector
        RenderCapture:
          objectName: onScreenCapture
      # OffScreen
      CameraSelector:
        objectName: offScreenCameraSelector
        RenderTargetSelector:
          target:
            RenderTarget:
              attachments:
              - RenderTargetOutput:
                  attachmentPoint: Color0
                  texture:
                    Texture2D:
                      width: 512
                      height: 512
                      format: RGBAFormat
          ClearBuffers:
            buffers: ColorDepthBuffer
            clearColor: "#EEfaebd7"
            NoDraw: {}
          RenderCapture:
            objectName: offScreenCapture

Results of the render captures:

   onScreenCapture: https://postimg.cc/image/v26nfj36l/
   offScreenCapture: https://postimg.cc/image/68x3evrvx/

I fixed the offscreen aspect ratio issue by creating a new offscreen camera
and forwarding all but these two signals:

   Qt3DRender::QCamera::aspectRatioChanged
   Qt3DRender::QCamera::projectionMatrixChanged

Question:

   1) I am using an RGBAFormat for my texture. I changed the alpha in the
clear colour from 0x80 to 0xEE and I now see an alpha cleared background in
the offscreen (see image). I can just use RGB for my purposes right now,
but I'm curious why the onscreen clearing is not using the alpha channel? I
can confirm this by changing the clear colour to #FF000000 - I just get
solid black.

Problem:

   1) The resulting scene isn't the same in the offscreen capture:
      - the yellow cube is on top of everything
      - the red & blue arrows aren't clipped by the plane
      - it isn't antialiased

I'm wondering if this is because the shaders aren't being used for the
offscreen texture? I noticed in apitrace that when switching
GL_DRAW_FRAMEBUFFER to 0 (onscreen), glUseProgram(1) is called. This is not
called when switching GL_DRAW_FRAMEBUFFER to 1 (offscreen). Is the program
supposed to persist or does it need to be called again when switching
framebuffers?

(apitrace is super-cool. Thanks for the pointer.)

Thank you for your time & help!

---
Andy Maloney  //  https://asmaloney.com
twitter ~ @asmaloney <https://twitter.com/asmaloney>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20180903/f182f771/attachment.html>


More information about the Interest mailing list