[Interest] Qt3D Multiple color targets not working

Gil H qt at tastytech.ca
Wed Aug 7 15:43:06 CEST 2019


Thanks, that is helpful to know for the future.  What I ended up doing is finally just use one RenderTarget for each sub-framegraph and different textures bound to Color0.  That is much easier for what I’m trying to do.  I guess I was expecting RenderTargetSelector to have the effect of specifying the output attachments of the fragment shader as well, and not require changes to the shaders themselves.

 

Really appreciate the help and all the great work on Qt3D!

 

Gil

 

 

From: Paul Lemire <paul.lemire at kdab.com>
Date: Wednesday, August 7, 2019 at 3:03 AM
To: Gil H <qt at tastytech.ca>, Qt Interest <interest at qt-project.org>
Subject: Re: [Interest] Qt3D Multiple color targets not working

 

Hi Gil,

You shouldn't have to actually modify the Material to add in more passes. 

What you have to do is edit the fragment shader  to have more than 1 color output:

e.g:

out vec4 fragColor1;

out vec4 fragColor2;

out vec4 fragColor3;

void main() {

fragColor1 = color;

fragColor2 = color;

fragColor3 = color;

}

By default the declaration order of the output maps to your attachments:

first output goes to ColorAttachment0, second output to ColorAttachment1 ...

On 8/6/19 6:14 PM, Gil H wrote:

Thanks Paul.  My understanding of how to accomplish that would be to create an Effect with multiple RenderPasses and then in the framegraph specify a filter for each pass and the output surface for it.  Is that all?  I don’t see anything in the shaders that is specific to the attachment… is anything needed on that side of things?

 

Gil

 

 

From: Paul Lemire <paul.lemire at kdab.com>
Date: Monday, August 5, 2019 at 2:36 AM
To: Gil H <qt at tastytech.ca>, Qt Interest <interest at qt-project.org>
Subject: Re: [Interest] Qt3D Multiple color targets not working

 

Hi Gil,

I'm pretty sure that's because you are using the PhongMaterial which only writes to Depth and Color0. You'd need to have your own material which writes to 3 different outputs to properly populate the 3 color attachments.

Paul

On 8/1/19 7:42 PM, Gil H wrote:

Hello everyone, I’m sure I’m doing something wrong here, but basically, I’m trying to render multiple frame graph subtrees into multiple texture targets, and then draw those as part of the final scene (kind of like seeing security camera feeds on a few textured quads).  Attached is my minimal test app which shows that only textures attached to Color0 seem to contain anything.  Is it because the surface is a QWindow?  I’ve tried a more complicated example with an offscreen render surface and an FBO with multiple color attachments added to it, but the textures I got back from that were still empty.

 

Tested this on Mac with Qt 5.13.0.

 

If anyone is curious about why you would want to do this, I need to render up to 3 different Qt3D scenes for integration into an external GL engine.  So different camera views and scene sub-trees need to be drawn onto separate textures each frame.

 

 

 

 




_______________________________________________
Interest mailing list
Interest at qt-project.org
https://lists.qt-project.org/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


_______________________________________________
Interest mailing list
Interest at qt-project.org
https://lists.qt-project.org/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/20190807/c8f34354/attachment.html>


More information about the Interest mailing list