[Interest] Qt3D Framegraphs
Paul Lemire
paul.lemire at kdab.com
Mon Aug 20 07:20:29 CEST 2018
Hi Andy,
Please see my reply below
On 08/15/2018 02:59 PM, Andy wrote:
> I've been struggling with framegraphs for a very long time now and
> still don't feel like I understand their structure - what goes where
> or what kind of nodes can be attached to what. I can throw a bunch of
> things together, but when it doesn't work I have no idea how to track
> down what's missing or what's in the wrong place.
>
> Can anyone give an outline of what a framegraph would look like to
> facilitate all of the following for a given scene:
>
> 1. rendering in a window onscreen
> 2. depth pass for shaders to use
I assume you want to fill the depth buffer with a simple shader right?
> 3. render capture for taking "snapshots" of what the user is seeing
> onscreen
> 4. offscreen rendering of the current scene at a specified size (not
> the UI window size)
> 5. render capture of the offscreen scene to an image
I've not tested but the I would image what you want would look like the
frame Graph below:
RenderSurfaceSelector { // Select window to render to
Viewport {
// 1 Clear Color and Depth buffers
ClearBuffers {
buffers: ClearBuffers.ColorDepthBuffer
NoDraw {}
}
// Select Camera to Use to Render Scene
CameraSelector {
camera: id_of_scene_camera
// 2 Fill Depth Buffer pass (for screen depth buffer)
RenderPassFilter {
filterKeys: [ FilterKey { name: "pass"; value: "depth_fill_pass"] //
Requires a Material which defines such a RenderPass
}
// 3 Draw screen content and use depth compare == to benefit for z fill
passs
RenderPassFilter {
filterKeys: [ FilterKey { name: "pass"; value: "color_pass"] //
Requires a Material which defines such a RenderPass
RenderStateSet {
renderStates: DepthTest { depthFunction: DepthTest.Equal }
RenderCapture { // Use this to capture screen frame buffer
id: onScreenCapture
}
}
}
// 4 Create FBO for offscreen rendering
RenderTargetSelector {
target: RenderTarget {
attachments: [
RenderTargetOutput {
attachmentPoint: RenderTargetOutput.Color0
texture: Texture2D { width: width_of_offscreen_area;
height: height_of_offscreen_area; .... }
},
RenderTargetOutput {
attachmentPoint: RenderTargetOutput.Depth
texture: Texture2D { width: width_of_offscreen_area;
height: height_of_offscreen_area; .... }
} ]
} // RenderTarget
// Note: ideally 4.1, 4.2 and 4.3 and 1, 2, 3 could be factored
out as a reusable subtree (if using QML)
// 4.1 Clear FBO
ClearBuffers {
buffers: ClearBuffers.ColorDepthBuffer
NoDraw {}
}
// 4.2 Fill Depth Buffer pass (for offscreen depth buffer)
RenderPassFilter {
filterKeys: [ FilterKey { name: "pass"; value:
"depth_fill_pass"] // Requires a Material which defines such a RenderPass
}
// 4.3 Draw content into offscreen color buffer and use depth
compare == to benefit for z fill pass
RenderPassFilter {
filterKeys: [ FilterKey { name: "pass"; value: "color_pass"] //
Requires a Material which defines such a RenderPass
RenderStateSet {
renderStates: DepthTest { depthFunction: DepthTest.Equal }
RenderCapture { // Use this to capture offscreen frame buffer
id: offScreenCapture
}
}
}
} // RenderTargetSelector
} // CamerSelector
} // Viewport
} // RenderSurfaceSelector
>
> Using the forward renderer in Qt3DExtras, I can do (1) and (3), but
> I've been supremely unsuccessful at implementing any of the rest
> despite many many attempts - even working with the examples. (And the
> deferred renderer examples - which might help? - don't work on macOS.)
Have you tried the rendercapture ones ? which are in tests/manual
>
> I am using C++, not QML. I tried replacing my framegraph with a
> QML-specified one but can't get that to work either (see previous post
> to this list "[Qt3D] Mixing Quick3D and C++ nodes").
>
> Can anyone please help? I'm stuck.
>
> Thank you.
>
> ---
> Andy Maloney // https://asmaloney.com
> twitter ~ @asmaloney <https://twitter.com/asmaloney>
>
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
--
Paul Lemire | paul.lemire at kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel: France +33 (0)4 90 84 08 53, http://www.kdab.fr
KDAB - The Qt, C++ and OpenGL Experts
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20180820/dd441eab/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4282 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20180820/dd441eab/attachment.bin>
More information about the Interest
mailing list