[Interest] Qt3D - Render to QImage
Philip Schuchardt
vpicaver at gmail.com
Sat Dec 3 22:16:13 CET 2016
I prototyped a framegraph using 5.8-beta and RenderCapture, but was unable
to get anything to save to disk. It creates a RenderCaptureReply. The reply
gets completed but the image is null and nothing is saved. I'm currently
saving to "~/testShot.png". Any ideas why it's not working? I probably set
up the framegraph wrong or something. I would be really helpful if there
was an example in the documentation.
Here's my test example. You can run through Qt Creators -> Tools ->
External -> Qt Quickt - > qmlscene
https://dl.dropboxusercontent.com/u/13470469/Renderer3D.qml
On Mon, Nov 28, 2016 at 11:33 AM Philip Schuchardt <vpicaver at gmail.com>
wrote:
> Cool! I didn't see RenderCapture class in 5.7. I glad it was added in 5.8.
> I'll try to prototype something with custom framegraph in 5.8.
>
> Phi|ip
>
> On Mon, Nov 28, 2016 at 6:48 AM Juan Jose Casafranca <jjcasmar at gmail.com>
> wrote:
>
> I will have a better look to how the aspect translates the framegraph node
> to opengl commands.
>
> Thanks!
>
> 2016-11-28 12:42 GMT+01:00 Sean Harmer <sean.harmer at kdab.com>:
>
> On Monday 28 November 2016 12:34:01 Juan Jose Casafranca wrote:
> > How does QRenderCapture works? When a capture is requested it sets a
> flags
> > and when generating the view, it creates a job that will render the
> image?
> > I imagine the QRenderCapture in the framegraph is important. If you put
> it
> > right after the ClearBuffers, it will render an empty image, wont it?
>
> I suspect the issue here is not being clear on the frame graph. Each leaf
> node
> of the frame graph results in a phase of rendering. The RenderCapture node
> essentially gets translated into a glReadPixels call for that rendering
> phase.
> If the sub-tree containing the ClearBuffers and RenderCapture also does
> some
> drawing (i.e. doesn't have a NoDraw node) the glReadPixels will happen
> after
> the draw calls so should read back the framebuffer that has just been drawn
> to.
>
> Hope this helps,
>
> Sean
>
> >
> > 2016-11-28 12:11 GMT+01:00 Sean Harmer <sean.harmer at kdab.com>:
> > > On Monday 28 November 2016 11:48:14 Harald Vistnes wrote:
> > > > Hi,
> > > >
> > > > yes, this would be a most welcome feature.
> > > >
> > > > Concerning Jira, it has already been requested multiple times
> > > > https://bugreports.qt.io/browse/QTBUG-52074
> > > > https://bugreports.qt.io/browse/QTBUG-52136
> > >
> > > I meant for reading back from a buffer. :)
> > >
> > > > I tried to render into a FBO and read back the results, but had some
> > > > problems. I attached some test code in the Jira
> > > >
> https://bugreports.qt.io/secure/attachment/57353/offscreenrenderer.zip
> > >
> > > but
> > >
> > > > never got any feedback. If someone will look into this it would be
> > > > great.
> > >
> > > I'll see if someone can take a look. I may have some time next week if
> > > nobody
> > > else can.
> > >
> > > Cheers,
> > >
> > > Sean
> > >
> > > > Thanks,
> > > > Harald
> > > >
> > > > 2016-11-28 11:41 GMT+01:00 Sean Harmer <sean.harmer at kdab.com>:
> > > > > On Monday 28 November 2016 11:40:10 Juan Jose Casafranca wrote:
> > > > > > Oh thanks!
> > > > > >
> > > > > > Yes, in fact my first thought was to use it for a compute
> shader. It
> > > > >
> > > > > would
> > > > >
> > > > > > make Qt3D a great tool not only for rendering but also for GPGPU.
> > > > > > I will try to have a look on it during the Christmas vacations
> :-)
> > > > >
> > > > > Awesome! Drop by #qt-3d on irc if you need anything.
> > > > >
> > > > > Cheers,
> > > > >
> > > > > Sean
> > > > >
> > > > > > 2016-11-28 11:31 GMT+01:00 Sean Harmer <sean.harmer at kdab.com>:
> > > > > > > Hi,
> > > > > > >
> > > > > > > On Monday 28 November 2016 11:22:30 Juan Jose Casafranca wrote:
> > > > > > > > Hi Sean,
> > > > > > > >
> > > > > > > > is there any example on how to do that? I tried to use a
> > > > >
> > > > > QRenderCapture
> > > > >
> > > > > > > but
> > > > > > >
> > > > > > > > I failed two weeks ago.
> > > > > > >
> > > > > > > http://code.qt.io/cgit/qt/qt3d.git/tree/tests/manual/
> > >
> > > rendercapture-qml
> > >
> > > > > > > http://code.qt.io/cgit/qt/qt3d.git/tree/tests/manual/
> > >
> > > rendercapture-cpp
> > >
> > > > > > > > Is there any way to access the buffers content data using a
> > >
> > > similar
> > >
> > > > > > > > approach to the QRenderCapture method?
> > > > > > > > For example, in an animation system, use a graphics pipeline
> to
> > > > >
> > > > > compute
> > > > >
> > > > > > > the
> > > > > > >
> > > > > > > > deformed mesh and then get the new vertex positions for
> export.
> > > > > > >
> > > > > > > Right, that is missing at the moment. It would be very useful
> to
> > > > > > > be
> > > > >
> > > > > able
> > > > >
> > > > > > > to do
> > > > > > > this to read back the results of a compute shader too for
> e.g.. If
> > >
> > > you
> > >
> > > > > > > wish to
> > > > > > > have a go at adding such a feature analogous the the
> RenderCapture
> > > > > > > node
> > > > > > > then
> > > > > > > that would be awesome. If not, we can try to do it for 5.9 but
> the
> > > > >
> > > > > feature
> > > > >
> > > > > > > freeze is approaching. In either case could you file a JIRA
> for it
> > > > >
> > > > > please?
> > > > >
> > > > > > > Thanks!
> > > > > > >
> > > > > > > Sean
> > > > > > >
> > > > > > > > Cheers
> > > > > > > > Juan José
> > > > > > > >
> > > > > > > > 2016-11-28 11:13 GMT+01:00 Sean Harmer <sean.harmer at kdab.com
> >:
> > > > > > > > > On Monday 28 November 2016 02:23:59 Philip Schuchardt
> wrote:
> > > > > > > > > > I'm trying to port my OpenGL code (
> > >
> > > https://github.com/Cavewhere/
> > >
> > > > > > > > > cavewhere/)
> > > > > > > > >
> > > > > > > > > > to use Qt3D. I think Qt3D will allow me to quickly
> improve
> > >
> > > and
> > >
> > > > > > > modify my
> > > > > > >
> > > > > > > > > > rendering pipeline. The one requirement I need is to be
> able
> > >
> > > to
> > >
> > > > > > > render
> > > > > > >
> > > > > > > > > to a
> > > > > > > > >
> > > > > > > > > > QImage and save it to disk. Currently, have a method that
> > > > > > > > > > renders
> > > > > > > > > > high-resolution images from OpenGL. I do this by tiling a
> > > > >
> > > > > projection
> > > > >
> > > > > > > > > matrix
> > > > > > > > >
> > > > > > > > > > and rendering the scene one tile at a time and combining
> > > > > > > > > > them
> > > > >
> > > > > into
> > > > >
> > > > > > > > > > on
> > > > > > > > >
> > > > > > > > > huge
> > > > > > > > >
> > > > > > > > > > PNG. The problem is I'm not sure how to render Qt3D
> pipeline
> > >
> > > to
> > >
> > > > > > > > > > a
> > > > > > > > > > texture
> > > > > > > > > > and then download if from the GPU into memory in Qt3D. Is
> > >
> > > there
> > >
> > > > > an
> > > > >
> > > > > > > easy
> > > > > > >
> > > > > > > > > way
> > > > > > > > >
> > > > > > > > > > to do that? Do I need to create my own Aspect?
> > > > > > > > >
> > > > > > > > > Hi, you can use a custom frame graph that includes a
> > > > > > > > > QRenderCapture
> > > > > > >
> > > > > > > node
> > > > > > >
> > > > > > > > > (coming in Qt 5.8). If you combine this with a camera and
> some
> > > > >
> > > > > logic
> > > > >
> > > > > > > for
> > > > > > >
> > > > > > > > > tiling the frustum (NodeInstantiator) you should be able to
> > > > >
> > > > > replicate
> > > > >
> > > > > > > your
> > > > > > >
> > > > > > > > > existing logic. I'd like to get something like this
> wrapped up
> > > > >
> > > > > along
> > > > >
> > > > > > > with
> > > > > > >
> > > > > > > > > Qt
> > > > > > > > > 5.9.
> > > > > > > > >
> > > > > > > > > > Also, many parts of the documentation seem to be missing,
> > >
> > > very
> > >
> > > > > > > > > > light,
> > > > > > > > > > and
> > > > > > > > > > not up to the same standard as the rest of Qt's
> > >
> > > documentation.
> > >
> > > > > > > > > Yes this is something I really want to have a push on in
> the
> > >
> > > near
> > >
> > > > > > > future.
> > > > > > >
> > > > > > > > > Cheers,
> > > > > > > > >
> > > > > > > > > Sean
> > > > > > > > >
> > > > > > > > > > Perhaps,
> > > > > > > > > > I'm just missing something from the undocumented
> > >
> > > documentation.
> > >
> > > > > > > > > > Thanks,
> > > > > > > > > > Phi|ip
> > > > > > > > >
> > > > > > > > > --
> > > > > > > > > Dr Sean Harmer | sean.harmer at kdab.com | Managing Director
> UK
> > > > > > > > > KDAB (UK) Ltd, a KDAB Group company
> > > > > > > > > Tel. +44 (0)1625 809908; Sweden (HQ) +46-563-540090
> > > > > > > > > Mobile: +44 (0)7545 140604
> > > > > > > > > KDAB - Qt Experts
> > > > > > > > > _______________________________________________
> > > > > > > > > Interest mailing list
> > > > > > > > > Interest at qt-project.org
> > > > > > > > > http://lists.qt-project.org/mailman/listinfo/interest
> > > > > > >
> > > > > > > --
> > > > > > > Dr Sean Harmer | sean.harmer at kdab.com | Managing Director UK
> > > > > > > KDAB (UK) Ltd, a KDAB Group company
> > > > > > > Tel. +44 (0)1625 809908; Sweden (HQ) +46-563-540090
> > > > > > > Mobile: +44 (0)7545 140604
> > > > > > > KDAB - Qt Experts
> > > > >
> > > > > --
> > > > > Dr Sean Harmer | sean.harmer at kdab.com | Managing Director UK
> > > > > KDAB (UK) Ltd, a KDAB Group company
> > > > > Tel. +44 (0)1625 809908; Sweden (HQ) +46-563-540090
> > > > > Mobile: +44 (0)7545 140604
> > > > > KDAB - Qt Experts
> > > > > _______________________________________________
> > > > > Interest mailing list
> > > > > Interest at qt-project.org
> > > > > http://lists.qt-project.org/mailman/listinfo/interest
> > >
> > > --
> > > Dr Sean Harmer | sean.harmer at kdab.com | Managing Director UK
> > > KDAB (UK) Ltd, a KDAB Group company
> > > Tel. +44 (0)1625 809908; Sweden (HQ) +46-563-540090
> > > Mobile: +44 (0)7545 140604
> > > KDAB - Qt Experts
> > > _______________________________________________
> > > Interest mailing list
> > > Interest at qt-project.org
> > > http://lists.qt-project.org/mailman/listinfo/interest
>
> --
> Dr Sean Harmer | sean.harmer at kdab.com | Managing Director UK
> KDAB (UK) Ltd, a KDAB Group company
> Tel. +44 (0)1625 809908 <+44%201625%20809908>; Sweden (HQ) +46-563-540090
> <+46%20563%2054%2000%2090>
> Mobile: +44 (0)7545 140604 <+44%207545%20140604>
> KDAB - Qt Experts
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
> --
> Phi|ip
>
--
Phi|ip
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20161203/f8a1ce6e/attachment.html>
More information about the Interest
mailing list