Re: [Interest] Qt3D Framegraphs

2018-08-19 Thread Paul Lemire via Interest
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 
>
>
>
> ___
> Interest mailing list
> Interest@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest

-- 
Paul Lemire | paul.lem...@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



smime.p7s
Description: S/MIME Cryptographic Signature
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Qt3D Framegraphs

2018-08-21 Thread Paul Lemire via Interest

On 08/21/2018 01:54 PM, Andy wrote:
> Thank you so much Paul!
>
> That gives me something to start working on/pick apart. I see now how
> onscreen vs. offscreen works and can concentrate on getting the
> onscreen working the way I want first since they are very similar.
>
> 1) "I assume you want to fill the depth buffer with a simple shader
> right?"
>
> I think so? Ultimately I want to experiment with a cel-shaded scene,
> but for now I'd be happy with adding some black contours on my
> entities using depth - slightly thicker lines closer to the camera,
> thinner farther away. Is this the right setup for that?

Hmm that's not necessarily what I pictured. Usually a render pass where
the depth buffer is filled is used as an optimization technique so that
1) You draw your scene with a very simple shader to fill the depth
buffer 2) You draw you scene again using a more complex shader but you
then take advantage of the fact that the GPU will only execute the
fragment shader for fragment whose depth is equal to what is stored in
the depth buffer.

If you want to draw contours (which is usually referred as silhouetting)
the technique is different. Meshes are composed of triangles which are
specified in a given winding order (order in which the triangles
vertices are specified, either clockwise or counterclockwise). That
winding order can be used at draw time to distinguish between triangles
which are facing the camera and triangles which are backfacing the
camera. (Usually another optimization technique is to not draw
backfacing triangles a.k.a backface culling).

A possible silhouetting technique implementation can be to:
1) draw only the back faces of the mesh (slightly enlarged) and with
depth writing into the depth buffer disabled.
2) draw the front faces of the mesh (with depth writing enabled)

See http://sunandblackcat.com/tipFullView.php?l=eng&topicid=15 for a
more detailed explaination, there are other implementation with geometry
shaders as well (http://prideout.net/blog/?p=54)

In practice, you would play with render states to control back face /
front face culling, depth write ... e.g:
RenderStateSet {
        renderStates: [
                DepthTest { depthFunction: DepthTest.Equal } // Specify
which depth function to use to decide which fragments to key
                NoDepthWrite {} // Disable writing into the depth buffer
    CullFace { mode: CullFace.Front } // Cull Front faces
(usually you would do back face culling though)
            ]
}

Note that cell shading might yet be another technique (with a different
implementation than silhouetting). Usually it involves having steps of
colors that vary based on light position in your fragment shader. It
might even be simpler to implement than silhouetting actually.

The above link actually implements a combination of both techniques.
 
>
> 2) "Have you tried the rendercapture ones?"
>
> Yes I have. That's how I got my render capture working (once those
> examples worked).
>
> One thing that wasn't clear to me before was where to attach the
> RenderCapture node. In the rendercapture example, it's created and
> then the forward renderer is re-parented, which is what I did with
> mine. Your outline makes more sense.

I suppose it was made purely by convenience to avoid having to rewrite a
full FrameGraph, but I do agree that makes understanding a lot harder.

>
> ClearBuffers (and NoDraw!) now make sense too. In QForwardRenderer
> they are on the camera selector which seems strange.

That's a small optimization. If your FrameGraph results in a single
branch (which QForwardRenderer probably does), you can combine the
ClearBuffers and the CameraSelector as that translates to basically
clear then draw.

If your framegraph has more than a single branch:
RenderSurfaceSelector {
    Viewport {
  CameraSelector {
                ClearBuffers { ...
                    RenderPassFilter { ... } // Branch 1
                    RenderPassFilter { ...} // Branch 2
                }
     }
    }
}

What would happen in that case is:

1) clear buffers then draw branch 1
2) clear buffers then draw branch 2

So in the end you would only see the drawings from Branch 2 because the
back buffer was cleared.

In that case you should instead have it like:

RenderSurfaceSelector {
    Viewport {
  CameraSelector {
                ClearBuffers { ...
                    RenderPassFilter { ... } // Branch 1
                }
               RenderPassFilter { ...} // Branch 2
     }
    }
}

or (which is a bit easier to understand but adds one branch to the
FrameGraph)

RenderSurfaceSelector {
    Viewport {
  CameraSelector {
                ClearBuffers { ...
                    NoDraw {}
                } // Branch 1
                RenderPassFilter { ... } // Branch 2
                RenderPassFilter { ...} // Branch 3
     }
    }
}


>
> 3) If I want to use any of the "default materials" in extras - Phong,
> PhongAlpha,

Re: [Interest] Qt3D Framegraphs

2018-08-31 Thread Paul Lemire via Interest
Hi Andy,

Some ideas below :)

On 08/31/2018 02:03 PM, Andy wrote:
> The contours/silhouetting proved a bit of a leap right now so I backed
> off to look at the offscreen side of it.
>
> I removed the depth pass and am just trying to get a simple frame
> graph working for on-and-off screen capture.
>
> I have the following frame graph (in YAML, but it should be clear):
>
> RenderSurfaceSelector:
>   Viewport:
>     ClearBuffers:
>   buffers: ColorDepthBuffer
>   clearColor: "#80faebd7"
>   NoDraw: {}
>     CameraSelector:
>   objectName: cameraSelector
>   FrustumCulling: {}
Is that FrustumCulling node the parent of the RenderPassFilter or is it
a sibling? If it's not the parent of the RenderPassFilter, I looks like
it would be part of a Branch Viewport -> CameraSelector ->
FrustumCulling which would be of no use here

>   RenderPassFilter:
>     matchAny:
>     - FilterKey:
>     name: renderingStyle
>     value: forward
>   RenderCapture:
>     objectName: onScreenCapture
Is the render capture a child of RenderPassFilter or a sibling here? You
might be getting lucky (or unlucky depends how you see it) because if a
branch has no RenderPassFilter, by default we select every RenderPasses
from every Material. So visually it might be working but it's probably
not what you had in mind.

What I'm seeing would result in:

Viewport -> ClearBuffers -> NoDraw {} -> clear screen
Viewport -> CameraSelector -> FrustumCulling {} -> draws to screen with
FrustumCulling (executing all passes of each material)
Viewport -> CameraSelector -> RenderPassFilter {} -> draws to screen
(executing only forward passes)
Viewport -> CameraSelector -> RenderCapture {} -> capture screen
(executing all passes of each material)

I suspect what you want is rather:
Viewport -> ClearBuffers -> NoDraw {}
Viewport -> CameraSelector -> FrustumCulling {} -> RenderPassFilter {}
Viewport -> CameraSelector -> FrustumCulling {} -> RenderPassFilter {}
-> RenderCapture {}

I even think that this could work:
Viewport -> ClearBuffers -> NoDraw {}
Viewport -> CameraSelector -> FrustumCulling {} -> RenderPassFilter {}
-> RenderCapture {} as RenderCapture shouldn't prevent from Rendering to
screen as well

>   RenderTargetSelector:
>     target:
>   RenderTarget:
>     attachments:
>     - RenderTargetOutput:
>     attachmentPoint: Color0
>     texture:
>   Texture2D:
>     width: 512
>     height: 512
>     format: RGBAFormat
You might want to set generateMipMaps to false on the texture
>     ClearBuffers:
>   buffers: ColorDepthBuffer
>   clearColor: "#80faebd7"
>   NoDraw: {}
Looking at it, it does look like it would correctly clear the texture to
the indicated color.
Have you tried displaying the render target texture by using a PlaneMesh
and a DiffuseMapMaterial?
If you feel adventurous you could try using apitrace to look at the GL
traces and check what's in your texture color attachment
>     RenderPassFilter:
>   matchAny:
>   - FilterKey:
>   name: renderingStyle
>   value: forward
>     RenderCapture:
>   objectName: offScreenCapture
>
> Results of the render captures:
Like the above I think RenderCapture should be a child of
RenderPassFilter here
>
>    onScreenCapture: https://postimg.cc/image/antf2d43h/
>    offScreenCapture: https://postimg.cc/image/e7fcs5z3h/
>
> The onscreen capture is correct - yay a forward renderer!.
>
> 1) Why isn't the offscreen one clearing the background colour using
> ClearBuffers? (Isn't obvious in postimage, but the background is
> transparent.) I tried moving ClearBuffers all over the place, but
> can't get it to work.
>
It looks like your FG is correct regarding the clearing of the
RenderTarget, it would be nice to try to display the texture so that we
can rule out some issue with the RenderCapture operating on a RenderTarget.
> 2) How do I fix the aspect ratio of the offscreen image (assuming I
> want the final image to be 512x512)? Do I need to give it its own
> camera and adjust its aspect ratio somehow?
Yes the easiest would be another Camera which sets its own aspect ratio
(you should be able to forward pretty much all the other properties from
your main camera except the aspect ratio)
>
> Thanks for any guidance!
>
> ---
> Andy Maloney  //  https://asmaloney.com
> twitter ~ @asmaloney 
>
>
>
> On Fri, Aug 24, 2018 at 11:24 AM Andy  > wrote:
>
> Paul:
>
> Thank you very much for the detailed responses!
>
> This has given me a lot more to work on/understand.
>
> The ClearBuffers part was very useful for understanding what's
> actually happening. This would be good info to drop into the
> QClearBuffers docs.
>
> I guess I now have to dive into render passes, render sta

Re: [Interest] Qt3D Framegraphs

2018-09-03 Thread Paul Lemire via Interest
Glad to hear that, hopefully things are starting to make more sense now.


On 09/03/2018 02:54 PM, Andy wrote:
> 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 #FF00 - I just get solid black.
Well I believe that this depends on the format of your back buffer
(usually it is RGB). You can try to query it with
QSurfaceFormat::defaultFormat() and looking for the alphaBuffer size (or
apitrace also gives you the format when you select a draw call that
renders to screen).
>  
> 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
I suspect that this is caused by the fact that you have no depth
attachment on your RenderTarget so that depth testing isn't performed
properly. You would need to create another RenderTargetOutput that you
bind to the attachment point Depth with a suitable Texture2D texture
with format (D32, D24 ...).

>   - it isn't antialiased
That's likely caused by a) not having a high resolution enough for your
attachments b) using a Texture2D instead of a Texture2DMultisample
(though I'm not sure RenderCapture would work with the latter).
Have you tried going for a 2048/2408 texture instead of 512/512 assuming
you have no memory constraints? Then you can always scale back the
QImage you capture to 512/512 if need be.

>
> 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?
Programs aren't tied to FrameBuffers, you just call glUseProgram when
you want to switch program and/or when you didn't track what was the
previously used program was.
>
> (apitrace is super-cool. Thanks for the pointer.)
There are also vogl and renderdoc but I tend to always go back to
apitrace :)
>
> Thank you for your time & help!
>
> ---
> Andy Maloney  //  https://asmaloney.com
> twitter ~ @asmaloney 

-- 
Paul Lemire | paul.lem...@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



smime.p7s
Description: S/MIME Cryptographic Signature
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Qt3D QAbstractItemModel to watch QEntity's

2018-11-13 Thread Paul Lemire via Interest
Hi,

Have you looked into using the signals:

void QComponent::addedToEntity(QEntity *entity);

void QComponent::removedFromEntity(QEntity *entity);

That would be up to you to write a table you would update based on these
signals to keep track of which entities reference which components.

There's no public way of knowing when a component is added or removed
from a QEntity though that would be something trivial to add for 5.13 if
that can make your life easier.

There's no public API to get a QNode* form a QNodeId. Using the private
API QScene::lookupNode would indeed be an option but keep in mind it
could be removed, renamed ... in future versions (though unlikely). That
might be the quickest option to get you started.

Aspects don't get access to the frontend QNode, they only communicate
with QSceneChanges with ids. Usually aspect create a backend
representation of the QNode with only the data they care about and with
the changes and ids, these backend representations are kept in sync with
the frontend.

You could indeed have an aspect but would have to create backend
representations for QEntity and your custom QComponent I suppose, which
sounds like quite a bit of work for what you want to do.

Hopefully this may be of some help,

Paul

-- 
Paul Lemire | paul.lem...@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




smime.p7s
Description: S/MIME Cryptographic Signature
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] [Qt3D][Android] Weird different performance on almost same class GPUs

2018-12-19 Thread Paul Lemire via Interest
Hi Oleg,

Could you specify the screen resolutions of your phones as well please?
(I suspect they are lower than the tablet)

From what you are describing (moving further/nearer/multisampling) it
seems you are having fragment shader performance limitations.

You didn't specify what the benchmarks were doing, ideally you should be
looking at a fragment fill rate benchmark.

If that's the case, not much that can be done here apart from:

1) Simplifying your fragment shaders

2) Reducing potential overdraws (use depth testing, culling)

3) Generally speaking, trying to limit the amount of fragments

Since it seems you are using Scene3D, would you happen to have a
fullscreen QtQuick Rectangle underneath as a background? From past
experience,  this itself can actually put a bit of strain on the
fragment performance directly. (Using an Item + the window's clear color
might provide a work around).

Hopefully this can be of some help,

Paul

On 18/12/2018 18:43, Oleg Evseev wrote:
> Hi all,
>
> I have two phones:
> Qualcomm Snapdragon 400 MSM8928, GPU Adreno 305, OpenGL ES 3.0, RAM 1Gb
> Qualcomm APQ8064 Snapdragon S4 Pro, GPU Adreno 320, OpenGL ES 3.0, RAM
> 2Gb
>
> And one tablet:
> MediaTek MT8735, GPU Mali-T720 (1 core), OpenGL ES 3.1, 1280x800,
> Android 8.1, RAM 2Gb
>
> According to internet Adreno 305 and Mali-T720 have close performance.
> I run several 3d benchmarks and Mali-T720 (tablet) show better results
> than Adreno 305.
>
> Benchmarks of CPU MT8735 is twice better than  Snapdragon 400.
>
> But my qt application with Scene3D on tablet works much slower than on
> these phones.
> 3D scene is no so complex - just a skybox, 3d model, several lines and
> simple "ground".
>
> tablet FPS vs phone (any, they are quite simple) FPS:
>
> When camera far from model (far from it)
> 60 vs 50+ ( Adreno 305) (40+  FPS on Adreno 320)
> Making camera very close to model drop down fps to:
> 18-25 vs  ~45
>
> Enabling anti-aliasing (Scene3D multisample: enable) dramatically
> slows down tablet. Multisampling has almost no effect on phones.
> 8-10 vs  ~40 (camera is close to model )
>
> Without 3dmodel and other stuff only skybox almost same result on tablet:
> 60+ FPS without and ~25 FPS with multisampling.
>
> Working with Qt 5.9.5. I've tested Qt 5.12 - same result.
>
> Thanks in advance for any help or tips what to check.
>
> ---
> With regards, Oleg.
>
> ___
> Interest mailing list
> Interest@qt-project.org
> https://lists.qt-project.org/listinfo/interest

-- 
Paul Lemire | paul.lem...@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



smime.p7s
Description: S/MIME Cryptographic Signature
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] Qt3D: One-shot compute shader

2019-06-02 Thread Paul Lemire via Interest
If you can use Qt 5.13, ComputeCommand has a runType
property(Continuous/Manual) and a trigger function which you can use for
one shot compute calls.


https://doc-snapshots.qt.io/qt5-5.13/qt3drender-qcomputecommand.html


Another option would be to set the enabled property of your
DispatchCompute FG node to false once you know you don't need to execute
your compute shader.


Paul


On 6/1/19 1:21 AM, Daniel Proksch wrote:
> Hi all,
>
> I'm trying to implement a Qt3D FrameGraph (QML) that allows for
> one-shot dispatch of a compute shader.
> My current approach is to add a ComputeCommand component to my
> ComputeEntity whenever I want the dispatch to happen.
> When the compute task is done (i.e. in the next frame) I want to
> remove the ComputeCommand component again, so that the shader is no
> longer invoked.
>
> Is that approach reasonable?
> And is there a signal that is triggered whenever a frame is completed
> (so that I can remove the ComputeCommand)?
>
> Many thanks!
>
> ___
> Interest mailing list
> Interest@qt-project.org
> https://lists.qt-project.org/listinfo/interest


smime.p7s
Description: S/MIME Cryptographic Signature
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] [Qt3D] Render depth images

2019-06-11 Thread Paul Lemire via Interest
Hi Raphael,

What you want is to do your rendering in 2 steps:

- Render your scene into a RenderTarget (with 2 attachments/textures,
one for color, one for depth)

- Render a full screen quad on which you display the depth texture.

We have some manual test in the Qt 3D sources that should show how to do
that:

https://code.qt.io/cgit/qt/qt3d.git/tree/tests/manual/deferred-renderer-qml

I hope that helps,

Paul

On 6/11/19 10:02 AM, Grimm, Raphael (IAR) wrote:
>
> Hi,
>
> I am new to Qt3D and want to render a depth image of a scene.
>
> My problem is: I do not know how I can access the depth buffer.
>
> Could someone give me an example or point me to the correct functions
> and classes?
>
> Thanks,
>
> Raphael
>
>
> ___
> Interest mailing list
> Interest@qt-project.org
> https://lists.qt-project.org/listinfo/interest


smime.p7s
Description: S/MIME Cryptographic Signature
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] Adding new 3D geometry support to Qt3D?

2019-07-08 Thread Paul Lemire via Interest
Hi Nicholas,

There are basically 3 ways of handling additional geometry formats in Qt3D.

* The first approach is through the use of sceneloaders plugins
https://code.qt.io/cgit/qt/qt3d.git/tree/src/plugins/sceneparsers?h=dev

SceneLoader plugins basically have to convert a scene format into a Qt3D
subtree composed of QEntity/QGeometryRenders/QMaterials   If you
want to use your own custom materials, you'd have to traverse the tree
once loaded and replace the materials by the ones you want to use or
write your own sceneparser plugin.

This is what's used by the glTF loader and the assimp loader (which
handles all format the Assimp library supports). Please note that the
glTF 2.0 loader is far from being fully glTF2 compliant. There is a
fully compliant glTF2 importer for  Qt3D as part of the Kuesa project.

* The second approach is to create your own
Qt3DRender::QGeometryRender/QGeometry loader, independent of any Qt3D
plugin system. You basically have to create your own wrapper that
instantiates the correct QAttributes/QBuffers to make up a valid
QGeometry (essentially doing something similar to
https://code.qt.io/cgit/qt/qt3d.git/tree/tests/manual/custom-mesh-cpp/main.cpp?h=dev).
Please note that with this approach, you only focus on the geometry, you
can then use any Qt3D material to render it.

* The third approach is kind of a hybrid between the two approaches,
creating a geometryloader plugin
(https://code.qt.io/cgit/qt/qt3d.git/tree/src/plugins/geometryloaders?h=dev)

When using the QMesh object (subclass of QGeometryRenderer), it uses the
most relevant plugin to load a given mesh file. Note that we are talking
about mesh level file formats (.obj) and not a scene file format (.gltf,
collada ...).
https://code.qt.io/cgit/qt/qt3d.git/tree/src/plugins/geometryloaders?h=dev

Again this approaches only focuses on the geometry part.

I hope that helps,

Paul


On 7/6/19 7:40 AM, Nicholas Yue wrote:
> Hi,
>
>   I read that Qt 5.13 will have glTF 2.0 support.
>
>   I am interested to add a couple of additional geometry format to Qt.
>
>   Where can I find out more about the design behind the general
> support for 3D geometry formats e.g. OBJ, glTF, DAE etc.
>
>   I am hoping to develop something I need (Alembic) that follows Qt3D
> best practices so that I can concentrate on the geometry and leverage
> the other aspect like material/shading that is already part of Qt3D
>
> Cheers
> -- 
> Nicholas Yue
> Graphics - Arnold, Alembic, RenderMan, OpenGL, HDF5
> Custom Dev - C++ porting, OSX, Linux, Windows
> http://au.linkedin.com/in/nicholasyue
> https://vimeo.com/channels/naiadtools
>
> ___
> Interest mailing list
> Interest@qt-project.org
> https://lists.qt-project.org/listinfo/interest

-- 
Paul Lemire | paul.lem...@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



smime.p7s
Description: S/MIME Cryptographic Signature
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] Qt3D Multiple color targets not working

2019-08-04 Thread Paul Lemire via Interest
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@qt-project.org
> https://lists.qt-project.org/listinfo/interest

-- 
Paul Lemire | paul.lem...@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



smime.p7s
Description: S/MIME Cryptographic Signature
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] Qt3D Multiple color targets not working

2019-08-07 Thread Paul Lemire via Interest
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 
> *Date: *Monday, August 5, 2019 at 2:36 AM
> *To: *Gil H , Qt Interest 
> *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@qt-project.org 
>
> https://lists.qt-project.org/listinfo/interest
>
> -- 
> Paul Lemire | paul.lem...@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@qt-project.org
> https://lists.qt-project.org/listinfo/interest

-- 
Paul Lemire | paul.lem...@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



smime.p7s
Description: S/MIME Cryptographic Signature
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] [Qt3D] QText2DEntity not appears if QLayerFilter is used

2019-11-17 Thread Paul Lemire via Interest
Hi Oleg,

From what I can see in the code, QText2DEntity doesn't draw anything,
but it instead instantiates internal Qt3D Entity instances to do the
drawing.

Therefore if you set the QLayer on QText2DEntity, it won't be set on the
internal entities and won't draw.

One option might be to set the recursive property to true on your QLayer
so that setting it on QText2DEntity also makes it pickup all of its
children Entities.

I hope that helps,

Paul

On 11/17/19 2:18 AM, Oleg Evseev wrote:
> Hi,
>
> Did somebody successfully work with QText2DEntity in 3d scenes with
> QLayerFilters?
>
> Here is my project https://bugreports.qt.io/browse/QTBUG-80092.
> QText2DEntity doesn't appear.
> https://github.com/Nonmant/Qt3DExtras-QText2DEntity-Example without
> Layers works fine.
>
> This is the bug or maybe I set something wrong?
>
> Thanks in advance for any help.
>
> ---
> With regards, Oleg.
>
> ___
> Interest mailing list
> Interest@qt-project.org
> https://lists.qt-project.org/listinfo/interest

-- 
Paul Lemire | paul.lem...@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



smime.p7s
Description: S/MIME Cryptographic Signature
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] [Qt3D] Get OpenGL texture data / Send preprocessor instructions to shaders

2020-02-25 Thread Paul Lemire via Interest

Hi Léo,

On 2/25/20 3:15 PM, Léo Adam wrote:

Hi,

I am new to Qt3D and there's a few things I was wondering how to achieve:

- I need to read and write an opengl texture from C++.
For example, I am rendering a scene into a texture during a first 
render pass, and then performing some postprocess effect before 
rendering that texture in a fullscreen quad during a second render pass.
I would like to access that texture from C++, and can't manage to do 
that. I've found the classes 
/QTextureImageData///QTextureData///QTextureDataGenerator/, but I 
don't know if that's really what I'm looking for and if it is, how to 
use it.


Have look at the manual tests in Qt3D 
https://code.qt.io/cgit/qt/qt3d.git/tree/tests/manual?h=5.15


- texture-updates-cpp -> C++ to GPU uploads

- rendercapture* -> GPU Back buffer / FBO to C++/QML download

- sharedtexture if you want to create a raw OpenGL texture and have Qt3D 
use it


- deferred-renderer* for rendering into FBO and reusing FBO attachement 
in a second pass


- I also would like to send preprocessor instructions to a shader from 
C++/QML and I don't know if this is possible.
For example, if I want to use /#ifdef/ in a shader with a value 
defined in C++, I would need to send that value to the shader just 
like /QParameter/ do with uniforms.
I've searched in the documentation and on internet, but I didn't find 
anything.


changing the #ifdef would trigger a whole shader recompilation , fine 
for prototyping, probably not for production.


You would have to modify the shader code directly, something like:

property int value: 1

ShaderProgram {

    fragmentShader: "

    #ifdef " + value + "

    ...

   #else

  ..."

}



Any help would be highly appreciated :-)

Sincerely,
Léo.

___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


--
Paul Lemire | paul.lem...@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



smime.p7s
Description: S/MIME Cryptographic Signature
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] Qt3D - Deploying renderer plugins introduced in Qt 5.15

2020-06-04 Thread Paul Lemire via Interest

Hi,

From what I can see the macdeployqt and windeployqt scripts weren't 
updated to deploy the renderers plugin.


Hopefully these patches would fix that:

https://codereview.qt-project.org/c/qt/qttools/+/302945/1

https://codereview.qt-project.org/c/qt/qttools/+/302946/1

Paul

On 5/28/20 6:41 PM, Esch Lorenz TU Ilmenau wrote:


Hello,

I am using windeployqt to deploy an application facilitating Qt3D via 
specifying QT+=3dcore3drender3dinput3dextras in its .pro file. Since 
Qt 5.15 the opengl renderer is isolated as a separated plugin 
(openglrenderer.dll). This new plugin is somehow not caught by 
windeployqt and thus not deployed to the binary’s folder.


Any idea why? Maybe I am missing something here? Do I always need to 
deploy the renderer manually for versions > 5.15?


Thanks,

Lorenz


___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


smime.p7s
Description: S/MIME Cryptographic Signature
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] Qt3DRender::QBuffer::dataGenerator() deprecated with no explanation?

2020-10-12 Thread Paul Lemire via Interest

Hi Nyall,

From Qt6 onward, it is expected the data is set directly on the QBuffer 
with QBuffer::setData (For long data processing, we will leave it up to 
the user to create his own thread if needed rather than relying on Qt3D 
executing a functor in its threadpool).


In Qt5.15, the dataFunctor can still be used but not sure the 
deprecation warning can be silenced other than by having the define 
BUILD_QT3D_MODULE set.


Hope that helps,

Paul

On 10/11/20 4:53 AM, Nyall Dawson wrote:

Hi list,

Building my project on Qt 5.15 ends with a handful of deprecation
warnings coming from Qt3DRender::QBuffer::dataGenerator() and
setDataGenerator():

warning: ‘void Qt3DRender::QBuffer::setDataGenerator(const
QBufferDataGeneratorPtr&)’ is deprecated [-Wdeprecated-declarations]
...
/usr/include/qt5/Qt3DRender/qbuffer.h:110:30: note: declared here
110 | Q3D_DECL_DEPRECATED void setDataGenerator(const
QBufferDataGeneratorPtr &functor);

But there's absolutely no hints anywhere on what to replace this with
-- even the QBuffer docs don't flag these members as obsolete! (see
https://doc.qt.io/qt-5/qt3drender-qbuffer.html#dataGenerator)

How can I resolve these deprecation warnings?

Nyall
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest





smime.p7s
Description: S/MIME Cryptographic Signature
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] Trouble compiling qt3d for qt6 on windows 10

2021-02-15 Thread Paul Lemire via Interest
I can't really help about the compile issues. But I should be able to 
help regarding the plugin error.


You likely need to copy a few more things from the qt3d build dir to 
your Qt install dir:


qt3d_build_dir/qml/Qt3D into Qt_Install_Dir/qml/

qt3d_build_dir/qml/QtQuick/* into Qt_Install_Dir/qml/QtQuick/

qt3d_build_dir/plugins/* into Qt_Install_Dir/plugins/

(the plugins dir contains a renderers folder which contains the Qt3D 
render plugins)


I hope that helps,

Paul

On 2/15/21 11:03 AM, Daniel Patel wrote:
I have compiled qt6.1 from source which works and now I am trying to 
compile qt3d also from source by downloading from 
https://download.qt.io/official_releases/additional_libraries/qt3d/6.0/6.0.0/ 
 
and following the qmake instructions from: 
https://www.kdab.com/getting-your-3d-ready-for-qt-6/ 



I first tried to download and compile qt3d-everywhere-src-6.0.1 but 
got an error about missing zlib.h. Instead of trying to fix this I 
quickly instead tried with qt3d-everywhere-src-6.0.0 and this compiled 
fine.
However it only compiled debug dlls and not release dlls. I tried to 
do nmake all and nmake release but the latter gave the error "NMAKE : 
fatal error U1073: don't know how to make 
'C:\qtsrc\qt61\qt5\qtbase\lib\Qt6Gui.lib'"
I then decided to try out the debug build. First I noticed that the 
qt3d dlls didnt seem to have been copied over to the correct folder 
when I did nmake install. So I copied them over manually and then 
started basicshapes-cpp.exe, but this showed the runtime error: Unable 
to find renderer plugin for opengl.

Any hints for what to do?

Best
Daniel

___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


--
Paul Lemire | paul.lem...@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



smime.p7s
Description: S/MIME Cryptographic Signature
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] Trouble compiling qt3d for qt6 on windows 10

2021-02-16 Thread Paul Lemire via Interest


On 2/16/21 1:33 PM, Daniel Patel wrote:

Thanks a lot for the reply Paul, it was useful as always.
Copying the files made the qt3d examples work!
I realized that the compile error showed up because qt6 itself was 
only compiled in debug mode.
With the appropriate flag to the configure script, qt6 now compiles 
both in debug and in release.


However, now when compiling qt3d I ran into the error : "Could not 
find feature qt3d-simd-avx2" (I already configured and compiled qt6 
with -avx2 flag)
I am just not able to tell/configure qt3d to use avx2 instead of sse2. 
Currently "qmake .." returns:

  Use SSE2 instructions .. yes

  Use AVX2 instructions .. no

After running configure for the qt6 build I got this text as output:
"To configure and build other Qt modules, you can use the following 
convenience script:

C:/Qt/Qt-6.1/bin/qt-configure-module.bat"
So i did a "c:\Qt\Qt-6.1\bin\qt-configure-module.bat 
qt3d-everywhere-src-6.0.0 --qt3d-simd=avx2"   but that failed with  
"Unknown command line option '--qt3d-simd=avx2'"  (I also tried 
-avx2-qt3d-simd and -qt3d-simd-avx2)

Anyone knows how to set configure flags for qt3d before compiling it?


What about -qt3d-simd avx2 (just a space)? That's what I use when 
compiling on linux with qmake. For Qt 6, I've switched to cmake though, 
option to use is -DFEATURE_qt3d_simd_avx2=ON on the cmake command line.


That being said, the avx2 option for Qt 3D essentially only yields 
better performance when we multiply matrices internally. The sse2 option 
is not much slower, a lot faster than relying on QMatrix4x4 (though this 
might have changed in Qt6, haven't checked).





On a side note I also was not able to get qt6 configure script to 
detect zlib libraries even though I set appropriate environment 
variables and sent in paths using both -D option as well as -I and -L 
option.


man. 15. feb. 2021 kl. 11:47 skrev Paul Lemire >:


I can't really help about the compile issues. But I should be able
to help regarding the plugin error.

You likely need to copy a few more things from the qt3d build dir
to your Qt install dir:

qt3d_build_dir/qml/Qt3D into Qt_Install_Dir/qml/

qt3d_build_dir/qml/QtQuick/* into Qt_Install_Dir/qml/QtQuick/

qt3d_build_dir/plugins/* into Qt_Install_Dir/plugins/

(the plugins dir contains a renderers folder which contains the
Qt3D render plugins)

I hope that helps,

Paul

On 2/15/21 11:03 AM, Daniel Patel wrote:

I have compiled qt6.1 from source which works and now I am trying
to compile qt3d also from source by downloading from

https://download.qt.io/official_releases/additional_libraries/qt3d/6.0/6.0.0/


and following the qmake instructions from:
https://www.kdab.com/getting-your-3d-ready-for-qt-6/


I first tried to download and compile qt3d-everywhere-src-6.0.1
but got an error about missing zlib.h. Instead of trying to fix
this I quickly instead tried with qt3d-everywhere-src-6.0.0 and
this compiled fine.
However it only compiled debug dlls and not release dlls. I tried
to do nmake all and nmake release but the latter gave the error
"NMAKE : fatal error U1073: don't know how to make
'C:\qtsrc\qt61\qt5\qtbase\lib\Qt6Gui.lib'"
I then decided to try out the debug build. First I noticed that
the qt3d dlls didnt seem to have been copied over to the correct
folder when I did nmake install. So I copied them over manually
and then started basicshapes-cpp.exe, but this showed the runtime
error: Unable to find renderer plugin for opengl.
Any hints for what to do?

Best
Daniel

___
Interest mailing list
Interest@qt-project.org  
https://lists.qt-project.org/listinfo/interest  



-- 
Paul Lemire |paul.lem...@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


--
Paul Lemire | paul.lem...@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



smime.p7s
Description: S/MIME Cryptographic Signature
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] Trouble compiling qt3d for qt6 on windows 10

2021-02-17 Thread Paul Lemire via Interest


On 2/17/21 11:15 AM, Daniel Patel wrote:
Actually all errors except the missing assimpl plugin problem went 
away when also setting environment variable QSG_RHI_BACKEND to opengl

So the only open question now is how to get the assimp to work.
Do you have a sceneparsers/libassimpgsceenimport in your 
qt3d_build_dir/plugins/sceneparsers? Was that sceneparsers folder copied 
to qt_install_dir/plugins/?
And a new question is: why does it matter what QSG_RHI_BACKEND is set 
to when I already specified that qt3d should use opengl directly and 
not use opengl through RHI (which has limited functionality)


QSG_RHI_BACKEND does 2 things:

1) It tells Qt 3D when using the RHI rendering backend which underlying 
API it should target (only useful when QT3D_RENDERER=rhi which is the 
default).


2) It also tells QtQuick (which now uses RHI) which backend it should work.

So what could have happened is that on an example using both QtQuick and 
Qt3D, you had QT3D_RENDERER=opengl so Qt 3D was using OpenGL but QtQuick 
was using RHI and defaulted to a different rendering backend than OpenGL.





ons. 17. feb. 2021 kl. 10:59 skrev Daniel Patel 
mailto:danielpatel...@gmail.com>>:


Thank you Mike for telling how to send in parameters correctly.
For the qt-configure-module.bat the syntax
"-DFEATURE_qt3d_simd_avx2=ON" worked but I didn't need to set it.
The other syntax "-- -qt3d-simd=avx2" worked for the qt6 configure
script and I was able to tell it where zlib was by using
"configure -prefix C:\Qt\Qt-6.1 -debug-and-release --
-DZLIB_LIBRARY=C:/Users/danie/vcpkg/installed/x64-windows/lib/zlib.lib
--
-DZLIB_INCLUDE_DIR=C:/Users/danie/vcpkg/installed/x64-windows/include"
I will try to use this for including zlib so that perhaps the
"zlib.h not found" error goes away when compiling qt3d6.0.1
(qt3d-everywhere-src-6.0.1)

Currently I was able to compile qt3d6.0.0
(qt3d-everywhere-src-6.0.0), but I had to first compile qt6, then
add the qt3d folder and then compile qt3d. If the qt3d folder is
present when qt6 starts compiling, it tries to compile qt3d folder
as well, but fails.
Another thing is that when compiling qt6 with --paralell keyword,
sometimes I got an internal compiler error. But then I would just
issue the compile command again and it continued.

After compilation, I copied the dlls over to the install folder
according to Pauls advice.
I tried out the qt3d examples (after setting environment variable
QT3D_RENDERER to opengl). Most worked, but a few didn't:
-multiviewport example gave error "Found no suitable importer
plugin for QUrl("qrc:/Gear_scene.dae")"
I also actually had this error when compiling qt5.15.2. It seems
like assimp is not made automatically anymore.
Is it because "Checking for Assimp", and "System Assimp" returns
no as shown below?
--
Checking for Assimp... no
Checking for Autodesk FBX... no
Qt 3D:
  Assimp . yes
  System Assimp .. no
-

-compute-particles and some other examples gave this error:
ASSERT: "QOpenGLContext::currentContext()" in file

C:\qtsrc\qt61\qt5\qt3d-everywhere-src-6.0.0\src\quick3d\imports\scene3d\scene3drenderer.cpp,
line 271


tir. 16. feb. 2021 kl. 15:17 skrev Mike Krus mailto:mike.k...@kdab.com>>:

Hi

Assuming qt-configure-module.bat invokes qmake, the right way
of passing the configure options is “-- -qt3d-simd=avx2”
If it’s invokes cmake, then try -DFEATURE_qt3d_simd_avx2=ON

Mike

—
Mike Krus | mike.k...@kdab.com  |
Senior Software Engineer & Teamlead
KDAB (UK) Ltd., a KDAB Group company
Tel: UK Office +44 1625 809908   Mobile +44 7833 491941
KDAB - The Qt Experts, C++, OpenGL Experts


> On 16 Feb 2021, at 13:31, Daniel Patel
mailto:danielpatel...@gmail.com>>
wrote:
>
> Using a space didn't work either. I will try to use cmake
though.
> The reason I wanted to use avx2 was to try to get rid of the
compilation error: Project ERROR: Could not find feature
qt3d-simd-avx2
>
>
> tir. 16. feb. 2021 kl. 14:22 skrev Paul Lemire
mailto:paul.lem...@kdab.com>>:
>
>
> On 2/16/21 1:33 PM, Daniel Patel wrote:
>> Thanks a lot for the reply Paul, it was useful as always.
>> Copying the files made the qt3d examples work!
>> I realized that the compile error showed up because qt6
itself was only compiled in debug mode.
>> With the appropriate flag to the configure script, qt6 now
compiles both in debug and in release.
>>
>> However, now when compiling qt3d I ran into the error :
"Could not find feature qt3d-simd-avx2" (I already configured
and

Re: [Interest] Trouble compiling qt3d for qt6 on windows 10

2021-02-17 Thread Paul Lemire via Interest


On 2/17/21 4:30 PM, Daniel Patel wrote:
Regarding assimp, it is not in qt3d_build_dir/plugins/sceneparsers, 
only gltf is there.
I see in the sceneparsers\assimp source code that it seems to use 
zlib, so perhaps this is the problem. I will recompile things with 
zlib library included.


The ability to now choose opengl/vulkan/metal/directx backend is 
impressive work.
Regarding using OpenGL/RHI backend, does this mean that QtQuick always 
uses RHI and that consequently Qt3D code inside a Scene3D(which is 
QtQuick) will also be limited to RHI type OpenGL?


In Qt 6, afaik QtQuick always uses RHI. You can still use the advanced 
opengl backend of Qt 3D (QT3D_RENDERER=opengl) but you need to make sure 
that the RHI backend selected by QtQuick is OpenGL.


If that is the case, it will be hard to port Qt5 applications using 
advanced Qt3D/OpenGL over to Qt6.


ons. 17. feb. 2021 kl. 12:27 skrev Paul Lemire >:



On 2/17/21 11:15 AM, Daniel Patel wrote:

Actually all errors except the missing assimpl plugin problem
went away when also setting environment variable QSG_RHI_BACKEND
to opengl
So the only open question now is how to get the assimp to work.

Do you have a sceneparsers/libassimpgsceenimport in your
qt3d_build_dir/plugins/sceneparsers? Was that sceneparsers folder
copied to qt_install_dir/plugins/?

And a new question is: why does it matter what QSG_RHI_BACKEND is
set to when I already specified that qt3d should use opengl
directly and not use opengl through RHI (which has limited
functionality)


QSG_RHI_BACKEND does 2 things:

1) It tells Qt 3D when using the RHI rendering backend which
underlying API it should target (only useful when
QT3D_RENDERER=rhi which is the default).

2) It also tells QtQuick (which now uses RHI) which backend it
should work.

So what could have happened is that on an example using both
QtQuick and Qt3D, you had QT3D_RENDERER=opengl so Qt 3D was using
OpenGL but QtQuick was using RHI and defaulted to a different
rendering backend than OpenGL.




ons. 17. feb. 2021 kl. 10:59 skrev Daniel Patel
mailto:danielpatel...@gmail.com>>:

Thank you Mike for telling how to send in parameters
correctly. For the qt-configure-module.bat the syntax
"-DFEATURE_qt3d_simd_avx2=ON" worked but I didn't need to set
it. The other syntax "-- -qt3d-simd=avx2" worked for the qt6
configure script and I was able to tell it where zlib was by
using "configure -prefix C:\Qt\Qt-6.1 -debug-and-release --
-DZLIB_LIBRARY=C:/Users/danie/vcpkg/installed/x64-windows/lib/zlib.lib
--
-DZLIB_INCLUDE_DIR=C:/Users/danie/vcpkg/installed/x64-windows/include"
I will try to use this for including zlib so that perhaps the
"zlib.h not found" error goes away when compiling qt3d6.0.1
(qt3d-everywhere-src-6.0.1)

Currently I was able to compile qt3d6.0.0
(qt3d-everywhere-src-6.0.0), but I had to first compile qt6,
then add the qt3d folder and then compile qt3d. If the qt3d
folder is present when qt6 starts compiling, it tries to
compile qt3d folder as well, but fails.
Another thing is that when compiling qt6 with --paralell
keyword, sometimes I got an internal compiler error. But then
I would just issue the compile command again and it continued.

After compilation, I copied the dlls over to the install
folder according to Pauls advice.
I tried out the qt3d examples (after setting environment
variable QT3D_RENDERER to opengl). Most worked, but a few didn't:
-multiviewport example gave error "Found no suitable importer
plugin for QUrl("qrc:/Gear_scene.dae")"
I also actually had this error when compiling qt5.15.2. It
seems like assimp is not made automatically anymore.
Is it because "Checking for Assimp", and "System Assimp"
returns no as shown below?
--
Checking for Assimp... no
Checking for Autodesk FBX... no
Qt 3D:
  Assimp . yes
  System Assimp .. no
-

-compute-particles and some other examples gave this error:
ASSERT: "QOpenGLContext::currentContext()" in file

C:\qtsrc\qt61\qt5\qt3d-everywhere-src-6.0.0\src\quick3d\imports\scene3d\scene3drenderer.cpp,
line 271


tir. 16. feb. 2021 kl. 15:17 skrev Mike Krus
mailto:mike.k...@kdab.com>>:

Hi

Assuming qt-configure-module.bat invokes qmake, the right
way of passing the configure options is “-- -qt3d-simd=avx2”
If it’s invokes cmake, then try -DFEATURE_qt3d_simd_avx2=ON

Mike

—
Mike Krus | mike.k...@kdab.com
 | Senior Software E

Re: [Interest] QtQuick over Qt3D (Qt 5.15)

2021-03-31 Thread Paul Lemire via Interest

Hello,

It sounds to me like Scene2D is what you want as it renders a QtQuick 
scene into an offscreen texture which can then be applied to a Qt 3D 
mesh. Unfortunately it can only be used from QML.


https://code.qt.io/cgit/qt/qt3d.git/tree/examples/qt3d/scene2d

That being said, nothing is stopping you from having 90% of the Qt3D 
code in C++ and just having a small part in QML that essentially only 
instantiates your 3D Scene and the Scene2D and provides the 3D scene 
with the Scene2D texture. I think that would be the easiest.


If you want to do it purely in C++, another approach (but more complex 
to set up and that would have to be tested) is to use a QSharedGLTexture 
to tell Qt3D about an existing OpenGL texture by textureId. This means 
using the Qt shared OpenGL context, and manually rolling your own 
QQuickRenderControl to render QtQuick into a QOpenGLTexture, and then 
providing the QOpenGLTexture's id to the QSharedGLTexture. You'll also 
need to ensure proper synching using fences (QWaitFence/QSetFence) to 
ensure that Qt3D is not trying to render while the the shared texture is 
being updated. This would be more or less similar to one of the manual 
test we have in Qt3D 
https://code.qt.io/cgit/qt/qt3d.git/tree/tests/manual/sharedtexture?h=5.15.2


I hope that helps,

Paul


On 3/29/21 12:28 PM, Konstantin Shegunov wrote:

Hello,
I want to overlay a QtQuick UI over a Qt3D scene I'm having, however 
(here comes the "but") I want to do it from C++. I don't want to get 
into instantiating Scene3D at all, I want to drive the Quick scene 
from Qt3D, not vice versa (i.e. I don't want to render the 3D content 
to an FBO, and I don't intend to depend on the QML engine to setup the 
Qt3D parts). Sound(ed) like a simple-enough task at first, but I'm 
having the worst time figuring it out.


To start, I've set the Qt3D things up and I can show my mesh. For the 
second part, I read a lot of the sources around Scene3D, Scene2D and 
Qt3D examples but it doesn't appear this "obvious" thing to do is 
covered anywhere, notwithstanding half the Qt3D examples being broken 
(either segfaulting or not building at all).


I was initially intending to get some ideas from Scene3D, but it 
appears it works directly with the private classes for one, and for 
two it forces synchronous rendering that's driven from the quick scene 
... and as a typical QtQuick item it doesn't expose a public C++ class 
...

If I missed something there, please feel welcome to correct me.

So after the next batch of sifting through Qt3D's own internals, the 
renderer plugin and such, I am relatively convinced the only 
reasonable way to do this is to render the UI offscreen to a texture 
and to just slap that texture on the screen on each Qt3D frame. Is 
this correct? If that's so, let's say I can render the quick scene to 
a texture, how do I go about putting it on the screen after the 
framegraph's been executed? I couldn't see a framegraph node that'd do 
that for me. Am I to write my own? Is it the case that I need to 
create a "fake" quad (i.e. a billboard) that I must reorient together 
with the camera? I saw in one of Florian Blume's repositories that he 
uses a second camera and another branch in the framegraph to put a 
background image in. Is this the way to do it, or is there some better 
way?


Additional question(s):
Do I spin my thread (which I sync manually) for rendering the quick scene?

Thanks for any and all pointers.

Kind regards,
Konstantin.

___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


--
Paul Lemire | paul.lem...@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



smime.p7s
Description: S/MIME Cryptographic Signature
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] QtQuick over Qt3D (Qt 5.15)

2021-04-12 Thread Paul Lemire via Interest

Hello Konstantin,

On 4/3/21 3:09 AM, Konstantin Shegunov wrote:
On Thu, Apr 1, 2021 at 8:40 AM Paul Lemire > wrote:


Hello Paul,

Hello,

It sounds to me like Scene2D is what you want as it renders a
QtQuick scene into an offscreen texture which can then be applied
to a Qt 3D mesh. Unfortunately it can only be used from QML.

That being said, nothing is stopping you from having 90% of the
Qt3D code in C++ and just having a small part in QML that
essentially only instantiates your 3D Scene and the Scene2D and
povides the 3D scene with the Scene2D texture. I think that would
be the easiest.

Yes, that's what I've been using to "guide me through". And I do 
acknowledge I can use it from QML, but there's also this thing: 
https://bugreports.qt.io/browse/QTBUG-90411 

Ok we will need to take a look at that. Shouldn't be too hard to fix but 
not sure how we can fixes to 5.15 publicly. Qt 3D from dev branch (Qt 6) 
does build with 5.15 though but I'm not sure we had ported Scene2D to Qt 
6 due to other changes in QtQuick.


If you want to do it purely in C++, another approach (but more
complex to set up and that would have to be tested) is to use a
QSharedGLTexture to tell Qt3D about an existing OpenGL texture by
textureId. This means using the Qt shared OpenGL context, and
manually rolling your own QQuickRenderControl to render QtQuick
into a QOpenGLTexture, and then providing the QOpenGLTexture's id
to the QSharedGLTexture. You'll also need to ensure proper
synching using fences (QWaitFence/QSetFence) to ensure that Qt3D
is not trying to render while the the shared texture is being
updated. This would be more or less similar to one of the manual
test we have in Qt3D
https://code.qt.io/cgit/qt/qt3d.git/tree/tests/manual/sharedtexture?h=5.15.2



I hope that helps,

Indeed, thanks! Still, it doesn't seem there's a way I can hook into 
the frame graph and just have anything drawn directly on the screen, 
is there? The best I could do, as far as I can tell, is to have an 
ortographic camera looking at a quad, which I can texture with 
whatever comes from the QtQuick scene, it appears (i.e. what Florian 
Blume's code does here: 
https://github.com/florianblume/Qt3D-BackgroundImage 
). Is this correct?


Yes you will need to have a fullscreen quad mesh to draw the texture + 
matching FrameGraph part to draw only the quad  after the content of 
your 3D scene.


Many ways of doing the same thing: using the QPlaneMesh with a rotation 
+ camera or providing a custom plane mesh already in NDC space (-1  to 
1) in which case you don't even need to worry about having a camera.




On Thu, Apr 1, 2021 at 11:15 AM Oleg Evseev > wrote:


By the way in Qt 5.14 there comes an option to use Scene3D as
underlay without FBO:
https://doc.qt.io/qt-5/qml-qtquick-scene3d-scene3d.html#compositingMode-prop



I did tried this, but encountered with a problem when using
together with OnDemand:
https://bugreports.qt.io/browse/QTBUG-82861



Indeed. It does seem bugs reports've accumulated for Qt3D over time. 
View3D also segfaults (the example) for some reason.


Kind regards,
Konstantin.



--
Paul Lemire | paul.lem...@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



smime.p7s
Description: S/MIME Cryptographic Signature
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest