Re: [Interest] {Qt3D} Problem with the look of QDiffuseSpecularMaterial moving from Qt5 to Qt6

2024-05-07 Thread Mike Krus via Interest
Hi

do you know which backend you are using? RHI (default)? If so, could you try 
the GL backend?
In either case, please create a bug report with, if possible, a small example 
to reproduce the issue.


Mike


> On 4 May 2024, at 23:25, Andy  wrote:
> 
> I've been upgrading an old codebase from Qt5 to Qt6. For Qt3D, I've followed 
> the info from here:
> 
>   https://www.kdab.com/qt-3d-changes-in-qt-6/
> 
> The changes I've had to make so far were all around geometry, but I'm getting 
> different visuals between Qt5 and Qt6.
> 
> Qt 5.15.2:
> Qt 6.7.0:
> 
> 
> (Ignore slight camera position difference.)
> 
> I haven't changed the light or any of the materials.
> 
> I'm using QDiffuseSpecularMaterial for all these meshes, and setting ambient, 
> diffuse, shininess, and specular for all.
> 
> I haven't found anything describing any changes to QDiffuseSpecularMaterial. 
> Am I missing something I need to change? Did QDiffuseSpecularMaterial just 
> change to be darker? If so, how do I get lighter colours back? No matter what 
> I change it's super-dark.
> 
> My offscreen renderer is also broken now, but that seems to be a separate 
> issue.
> 
> (Aside: It would be useful to have C++ examples of the new stuff - 
> QBoundingVolume and QGeometryView for example. The official docs - as with 
> all of Qt3D - are very sparse. More docs & more examples would be of great 
> help.)
> 
> Thank you!
> 
> P.S. My active framegraph looks like this:
> 
> myCustomFrameGraph::Custom (:0, (null))
> Qt3DRender::QRenderSurfaceSelector:: (:0, (null))
> Qt3DRender::QViewport:: (:0, (null))
> Qt3DRender::QClearBuffers::backgroundColour (:0, (null))
> Qt3DRender::QNoDraw:: (:0, (null))
> Qt3DRender::QFrustumCulling:: (:0, (null))
> Qt3DRender::QCameraSelector::onScreenCameraSelector (:0, 
> (null))
> Qt3DRender::QRenderCapture::onScreenCapture (:0, (null))
> Qt3DRender::QLayerFilter::opaqueLayer (:0, (null))
> Qt3DRender::QLayerFilter::transparentLayer (:0, (null))
> Qt3DRender::QCameraSelector::offScreenCameraSelector (:0, 
> (null))
> Qt3DRender::QRenderTargetSelector:: (:0, (null))
> Qt3DRender::QRenderTarget::offScreenTarget (:0, 
> (null))
> Qt3DRender::QRenderTargetOutput:: (:0, (null))
> 
> Qt3DRender::QTexture2DMultisample::offScreenTexture (:0, (null))
> Qt3DRender::QClearBuffers::backgroundColour (:0, 
> (null))
> Qt3DRender::QNoDraw:: (:0, (null))
> Qt3DRender::QRenderCapture::offScreenCapture (:0, 
> (null))
> Qt3DRender::QLayerFilter::opaqueLayer (:0, (null))
> Qt3DRender::QLayerFilter::transparentLayer (:0, 
> (null))
> 
> ---
> Andy Maloney
> ___
> Interest mailing list
> Interest@qt-project.org
> https://lists.qt-project.org/listinfo/interest

—
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

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


Re: [Interest] Qt3D Fit in view

2023-03-10 Thread Mike Krus via Interest


> On 9 Mar 2023, at 22:00, Sean Murphy via Interest  
> wrote:
> 
> I'm trying out the Qt 3D classes for the first time and am in need of a 
> couple pointers.
> At a high level, I have the following:
> - 1 view, 1 scene, 1 camera, and 1 QOrbitCameraController
>  - in the scene, I create 7 entities, each a child of the root entity
>- each of the entities contains a mesh that is sourced from a
>  corresponding .obj file
> 
> Then my main window contains 7 radio buttons to toggle which entity is 
> visible at any
> given time. The radio buttons are mutually exclusive, so the goal is that 
> only one entity
> is visible at any time. I'm having two main issues with the setup so far:
> 
> Issue 1: QEntity::setEnabled(false) doesn't seem to make the entity invisible
>  Each radio button is connected to a corresponding slot which just does the 
> following:
> 
>void MainWindow::slotEntity1Toggled(bool checked)
>{
>  qDebug() << __FUNCTION__ << checked;
>  Entity1 ->setEnabled(checked);
>}
> 
>  When the button becomes enabled (checked == true) the entity does in fact 
> become
>  visible. But when the button is disabled (checked == false), the entity is 
> still
>  visible in the view. If at that point I resize the application (and 
> therefore the
>  view) then the old entity disappears. It appears I need the 3D version of a
>  repaint(), but so far I haven't found where that is (or even which class I 
> should be
>  looking at). I did try explicitly calling repaint() on the QWidget that 
> holds the
>  view, but that didn't force the 3D scene to re-render, so far I've only been 
> able
>  to get it to redraw by resizing the widget.
> 
>  From the qDebug() statement in there, I can see that this slot is getting 
> called
>  as expected. Every time it's called with "true" the entity changes from
>  invisible->visible without requiring any window resizing. But every time 
> this function
>  is called with "false", I have to resize the window to get the entity to 
> disappear
unless you have setup your scene to be refresh ondemand 
(QRenderSettings::renderPolicy
set to QRenderSettings::OnDemand), Qt3D should constantly re-render.

Please provide more details on how the view is setup.


> Issue 2: Is there any sort of "fit in view" functionality for 3D views?
> 
>  Since I'm only allowing the user to display one entity at a time, I'd like 
> to be
>  able to automatically set the camera settings to zoom as needed to fit the 
> entire
>  entity within the view, so the user doesn't have to manually zoom in/out as 
> they
>  switch between entities.
> 
>  I've used the 2D classes QGraphicsView & QGraphicsScene fairly extensively 
> and I'm
>  used to using QGraphicsView::fitInView(QGraphicsItem*) and have the 
> QGraphicsView set
>  the transform needed to fit that item within the view. I was hoping that Qt 
> 3D has
>  something similar, but so far I haven't stumbled across it. I don't know 
> enough about
>  the Qt 3D classes yet to know if there's some easy way to compute the 
> correct transform
>  required to set this up?
> 
>  The .obj files I'm playing around with have VASTLY different scale factors 
> so a
>  camera setting for one entity often doesn't work well for another.
There’s relevant methods on the QCamera class.



Mike


> Other pertinent information:
> - Using Qt 5.15.2, but could switch to Qt 6 if required.
> - I would prefer to stick with QWidget & C++, not QML
> - I'm extremely new to Qt 3D, OpenGL, etc. so go ahead and make the 
> assumption that
>   I know nothing about anything in that realm. It's an accurate assumption, 
> and I won't
>   be offended!
> 
> Thanks,
> Sean
> 
> 
> 
> 
> 
> 
> This e-mail, including any attached files, may contain confidential 
> information, privileged information and/or trade secrets for the sole use of 
> the intended recipient. Any review, use, distribution, or disclosure by 
> others is strictly prohibited. If you are not the intended recipient (or 
> authorized to receive information for the intended recipient), please contact 
> the sender by reply e-mail and delete all copies of this message.
> ___
> Interest mailing list
> Interest@qt-project.org
> https://lists.qt-project.org/listinfo/interest

—
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

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


Re: [Interest] Qt3D : QSceneLoader - determining scene level geometry bounding box

2022-08-08 Thread Mike Krus via Interest
please file a bug report


Mike

> On 8 Aug 2022, at 17:21, Nicholas Yue  wrote:
>
> Hi Mike,
>
> I have now tried calling updateImplicitBounds() but it returns false
>
> Is that indicating some underlying issue elsewhere?
>
> ```
> Status changed: Qt3DRender::QSceneLoader::Loading
> Status changed: Qt3DRender::QSceneLoader::Ready
>  Entity: Qt3DCore::QEntity(0x7ffaac004660, name = untitled.obj) Components: 
> QList(Qt3DCore::QTransform(0x7ffaac04c590))
> BoundingVolume:  "untitled.obj"
>Entity: Qt3DCore::QEntity(0x7ffaac019220, name = Suzanne) Components: 
> QList(Qt3DExtras::QPhongMaterial(0x7ffaac01bf30, name = DefaultMaterial), 
> Qt3DRender::QGeometryRenderer(0x7ffaac00c4d0), 
> Qt3DCore::QTransform(0x7ffaac045800))
> BoundingVolume:  "Suzanne"
> gr is Valid
> updateImplicitBounds returns FALSE
> ```
>
> ```
> void SceneWalker::walkEntity(Qt3DCore::QEntity *e, int depth)
> {
> Qt3DCore::QNodeVector nodes = e->childNodes();
> for (int i = 0; i < nodes.count(); ++i) {
> Qt3DCore::QNode *node = nodes[i];
> Qt3DCore::QEntity *entity = qobject_cast(node);
> if (entity) {
> QString indent;
> indent.fill(' ', depth * 2);
> qDebug().noquote() << indent << "Entity:" << entity << 
> "Components:" << entity->components();
> {
> // Question about BoundingVolume
> qDebug() << "BoundingVolume: " << entity->objectName();
> const QList myQGeometryRenderer 
> = entity->componentsOfType();
> if (!myQGeometryRenderer.isEmpty())
> {
> Qt3DRender::QGeometryRenderer *gr = myQGeometryRenderer[0];
> if (gr){
> qDebug() << "gr is Valid";
> if (gr->updateImplicitBounds()){
> QVector3D minPoint = gr->implicitMinPoint();
> QVector3D maxPoint = gr->implicitMaxPoint();
> qDebug() << "minPoint: " << minPoint;
> qDebug() << "maxPoint: " << maxPoint;
> }
> else
> qDebug() << "updateImplicitBounds returns FALSE";
> }
> }
> }
> walkEntity(entity, depth + 1);
> }
> }
> }
> ```
>
> On Sat, 6 Aug 2022 at 00:09, Mike Krus  wrote:
> the computations are done a background thread, you may have to wait 1 frame 
> before they are valid.
> Or call QBoundingVolume::updateImplicitBounds() before reading them.
>
> If it fails please submit a bug report with a small example
>
> Mike
>
> > On 5 Aug 2022, at 20:38, Nicholas Yue  wrote:
> >
> > Any insight ?
> >
> > On Wed, 3 Aug 2022 at 15:44, Nicholas Yue  wrote:
> > I have the following code
> >
> > ```
> > void SceneWalker::walkEntity(Qt3DCore::QEntity *e, int depth)
> > {
> > Qt3DCore::QNodeVector nodes = e->childNodes();
> > for (int i = 0; i < nodes.count(); ++i) {
> > Qt3DCore::QNode *node = nodes[i];
> > Qt3DCore::QEntity *entity = qobject_cast(node);
> > if (entity) {
> > QString indent;
> > indent.fill(' ', depth * 2);
> > qDebug().noquote() << indent << "Entity:" << entity << 
> > "Components:" << entity->components();
> >
> > {
> > // Question about BoundingVolume
> > qDebug() << "BoundingVolume: " << entity->objectName();
> > const QList 
> > myQGeometryRenderer = 
> > entity->componentsOfType();
> > if (!myQGeometryRenderer.isEmpty())
> > {
> > Qt3DRender::QGeometryRenderer *gr = myQGeometryRenderer[0];
> > QVector3D minPoint = gr->implicitMinPoint();
> > QVector3D maxPoint = gr->implicitMaxPoint();
> > qDebug() << "minPoint: " << minPoint;
> > qDebug() << "maxPoint: " << maxPoint;
> > }
> > }
> > walkEntity(entity, depth + 1);
> > }
> > }
> > }
> > ```
> >
> > But I got the (0,0,0) for both the min/max point
> >
> > ```
> > Status changed: Qt3DRender::QSceneLoader::Loading
> > Status changed: Qt3DRender::QSceneLoader::Ready
> >  Entity: Qt3DCore::QEntity(0x7f65dc004660, name = untitled.obj) Components: 
> > QList(Qt3DCore::QTransform(0x7f65dc04c590))
> >Entity: Qt3DCore::QEntity(0x7f65dc019220, name = Suzanne) Components: 
> > QList(Qt3DExtras::QPhongMaterial(0x7f65dc01bf30, name = DefaultMaterial), 
> > Qt3DRender::QGeometryRenderer(0x7f65dc00c4d0), 
> > Qt3DCore::QTransform(0x7f65dc045800))
> > BoundingVolume:  "Suzanne"
> > minPoint:  QVector3D(0, 0, 0)
> > maxPoint:  QVector3D(0, 0, 0)
> > BoundingVolume:  "untitled.obj"
> > ```
> >
> > I am using Qt 6.2.2 on Ubuntu
> >
> > Cheers
> >
> > On Wed, 3 Aug 2022 at 01:25, Mike Krus  wrote:
> > Hi
> >
> > once the scene is loaded (ie, the status is Ready, keeping in mind loading 
> > is asynchronous), you can use
> > QSceneLoader::entity() to get a loaded entity by name, and then 
> > QEntity::componentsOfType() to get the component.
> > Loaded entities are children of the entity that the QSceneLoader component 

Re: [Interest] Qt3D : QSceneLoader - determining scene level geometry bounding box

2022-08-08 Thread Nicholas Yue
Hi Mike,

I have now tried calling updateImplicitBounds() but it returns false

Is that indicating some underlying issue elsewhere?

```
Status changed: Qt3DRender::QSceneLoader::Loading
Status changed: Qt3DRender::QSceneLoader::Ready
 Entity: Qt3DCore::QEntity(0x7ffaac004660, name = untitled.obj) Components:
QList(Qt3DCore::QTransform(0x7ffaac04c590))
BoundingVolume:  "untitled.obj"
   Entity: Qt3DCore::QEntity(0x7ffaac019220, name = Suzanne) Components:
QList(Qt3DExtras::QPhongMaterial(0x7ffaac01bf30, name = DefaultMaterial),
Qt3DRender::QGeometryRenderer(0x7ffaac00c4d0),
Qt3DCore::QTransform(0x7ffaac045800))
BoundingVolume:  "Suzanne"
gr is Valid
updateImplicitBounds returns FALSE
```

```
void SceneWalker::walkEntity(Qt3DCore::QEntity *e, int depth)
{
Qt3DCore::QNodeVector nodes = e->childNodes();
for (int i = 0; i < nodes.count(); ++i) {
Qt3DCore::QNode *node = nodes[i];
Qt3DCore::QEntity *entity = qobject_cast(node);
if (entity) {
QString indent;
indent.fill(' ', depth * 2);
qDebug().noquote() << indent << "Entity:" << entity <<
"Components:" << entity->components();
{
// Question about BoundingVolume
qDebug() << "BoundingVolume: " << entity->objectName();
const QList
myQGeometryRenderer =
entity->componentsOfType();
if (!myQGeometryRenderer.isEmpty())
{
Qt3DRender::QGeometryRenderer *gr = myQGeometryRenderer[0];
if (gr){
qDebug() << "gr is Valid";
if (gr->updateImplicitBounds()){
QVector3D minPoint = gr->implicitMinPoint();
QVector3D maxPoint = gr->implicitMaxPoint();
qDebug() << "minPoint: " << minPoint;
qDebug() << "maxPoint: " << maxPoint;
}
else
qDebug() << "updateImplicitBounds returns FALSE";
}
}
}
walkEntity(entity, depth + 1);
}
}
}
```

On Sat, 6 Aug 2022 at 00:09, Mike Krus  wrote:

> the computations are done a background thread, you may have to wait 1
> frame before they are valid.
> Or call QBoundingVolume::updateImplicitBounds() before reading them.
>
> If it fails please submit a bug report with a small example
>
> Mike
>
> > On 5 Aug 2022, at 20:38, Nicholas Yue  wrote:
> >
> > Any insight ?
> >
> > On Wed, 3 Aug 2022 at 15:44, Nicholas Yue 
> wrote:
> > I have the following code
> >
> > ```
> > void SceneWalker::walkEntity(Qt3DCore::QEntity *e, int depth)
> > {
> > Qt3DCore::QNodeVector nodes = e->childNodes();
> > for (int i = 0; i < nodes.count(); ++i) {
> > Qt3DCore::QNode *node = nodes[i];
> > Qt3DCore::QEntity *entity = qobject_cast *>(node);
> > if (entity) {
> > QString indent;
> > indent.fill(' ', depth * 2);
> > qDebug().noquote() << indent << "Entity:" << entity <<
> "Components:" << entity->components();
> >
> > {
> > // Question about BoundingVolume
> > qDebug() << "BoundingVolume: " << entity->objectName();
> > const QList
> myQGeometryRenderer =
> entity->componentsOfType();
> > if (!myQGeometryRenderer.isEmpty())
> > {
> > Qt3DRender::QGeometryRenderer *gr = myQGeometryRenderer[0];
> > QVector3D minPoint = gr->implicitMinPoint();
> > QVector3D maxPoint = gr->implicitMaxPoint();
> > qDebug() << "minPoint: " << minPoint;
> > qDebug() << "maxPoint: " << maxPoint;
> > }
> > }
> > walkEntity(entity, depth + 1);
> > }
> > }
> > }
> > ```
> >
> > But I got the (0,0,0) for both the min/max point
> >
> > ```
> > Status changed: Qt3DRender::QSceneLoader::Loading
> > Status changed: Qt3DRender::QSceneLoader::Ready
> >  Entity: Qt3DCore::QEntity(0x7f65dc004660, name = untitled.obj)
> Components: QList(Qt3DCore::QTransform(0x7f65dc04c590))
> >Entity: Qt3DCore::QEntity(0x7f65dc019220, name = Suzanne) Components:
> QList(Qt3DExtras::QPhongMaterial(0x7f65dc01bf30, name = DefaultMaterial),
> Qt3DRender::QGeometryRenderer(0x7f65dc00c4d0),
> Qt3DCore::QTransform(0x7f65dc045800))
> > BoundingVolume:  "Suzanne"
> > minPoint:  QVector3D(0, 0, 0)
> > maxPoint:  QVector3D(0, 0, 0)
> > BoundingVolume:  "untitled.obj"
> > ```
> >
> > I am using Qt 6.2.2 on Ubuntu
> >
> > Cheers
> >
> > On Wed, 3 Aug 2022 at 01:25, Mike Krus  wrote:
> > Hi
> >
> > once the scene is loaded (ie, the status is Ready, keeping in mind
> loading is asynchronous), you can use
> > QSceneLoader::entity() to get a loaded entity by name, and then
> QEntity::componentsOfType() to get the component.
> > Loaded entities are children of the entity that the QSceneLoader
> component was assigned to, and components and
> > entities are all QObjects so you can use the normal tree traversal
> techniques that work with any QObject to find
> > objects by type or name.
> >
> >
> > Mike
> >
> > > On 3 Aug 2022, 

Re: [Interest] Qt3D : QSceneLoader - determining scene level geometry bounding box

2022-08-05 Thread Nicholas Yue
Any insight ?

On Wed, 3 Aug 2022 at 15:44, Nicholas Yue  wrote:

> I have the following code
>
> ```
> void SceneWalker::walkEntity(Qt3DCore::QEntity *e, int depth)
> {
> Qt3DCore::QNodeVector nodes = e->childNodes();
> for (int i = 0; i < nodes.count(); ++i) {
> Qt3DCore::QNode *node = nodes[i];
> Qt3DCore::QEntity *entity = qobject_cast *>(node);
> if (entity) {
> QString indent;
> indent.fill(' ', depth * 2);
> qDebug().noquote() << indent << "Entity:" << entity <<
> "Components:" << entity->components();
>
> {
> // Question about BoundingVolume
> qDebug() << "BoundingVolume: " << entity->objectName();
> const QList
> myQGeometryRenderer =
> entity->componentsOfType();
> if (!myQGeometryRenderer.isEmpty())
> {
> Qt3DRender::QGeometryRenderer *gr = myQGeometryRenderer[0];
> QVector3D minPoint = gr->implicitMinPoint();
> QVector3D maxPoint = gr->implicitMaxPoint();
> qDebug() << "minPoint: " << minPoint;
> qDebug() << "maxPoint: " << maxPoint;
> }
> }
> walkEntity(entity, depth + 1);
> }
> }
> }
> ```
>
> But I got the (0,0,0) for both the min/max point
>
> ```
> Status changed: Qt3DRender::QSceneLoader::Loading
> Status changed: Qt3DRender::QSceneLoader::Ready
>  Entity: Qt3DCore::QEntity(0x7f65dc004660, name = untitled.obj)
> Components: QList(Qt3DCore::QTransform(0x7f65dc04c590))
>Entity: Qt3DCore::QEntity(0x7f65dc019220, name = Suzanne) Components:
> QList(Qt3DExtras::QPhongMaterial(0x7f65dc01bf30, name = DefaultMaterial),
> Qt3DRender::QGeometryRenderer(0x7f65dc00c4d0),
> Qt3DCore::QTransform(0x7f65dc045800))
> BoundingVolume:  "Suzanne"
> minPoint:  QVector3D(0, 0, 0)
> maxPoint:  QVector3D(0, 0, 0)
> BoundingVolume:  "untitled.obj"
> ```
>
> I am using Qt 6.2.2 on Ubuntu
>
> Cheers
>
> On Wed, 3 Aug 2022 at 01:25, Mike Krus  wrote:
>
>> Hi
>>
>> once the scene is loaded (ie, the status is Ready, keeping in mind
>> loading is asynchronous), you can use
>> QSceneLoader::entity() to get a loaded entity by name, and then
>> QEntity::componentsOfType() to get the component.
>> Loaded entities are children of the entity that the QSceneLoader
>> component was assigned to, and components and
>> entities are all QObjects so you can use the normal tree traversal
>> techniques that work with any QObject to find
>> objects by type or name.
>>
>>
>> Mike
>>
>> > On 3 Aug 2022, at 00:14, Nicholas Yue  wrote:
>> >
>> > Thank you Mike.
>> >
>> > Follow up question:
>> >
>> > Given a
>> >
>> > ```
>> > Qt3DRender::QSceneLoader *sceneLoader;
>> > ```
>> >
>> > How do we get at this QGeometryRenderer object to be able to call the
>> impliciteMinPoint (), impliciteMaxPoint () properties ?
>> >
>> > Cheers
>> >
>> > On Tue, 2 Aug 2022 at 05:56, Mike Krus  wrote:
>> > Hi
>> >
>> > if you are using Qt6, then yes.
>> >
>> > For a specific object, QGeometryRenderer derives from QBoundingVolume
>> which has impliciteMinPoint and impliciteMaxPoint properties.
>> >
>> > If you’re interested in the bounding volume of a portion of the scene
>> graph, all a QBoundingVolume component at the root and the
>> > same properties will be updated.
>> >
>> > In Qt5, the QGeometry node associated with each render has similar
>> min/max properties (note that they only valid if the mesh uses all the
>> geometry).
>> >
>> > Hope this helps,
>> >
>> > Mike
>> >
>> >
>> > > On 1 Aug 2022, at 16:05, Nicholas Yue  wrote:
>> > >
>> > > Hi,
>> > >
>> > >   I am diving into the geometry scene via QSceneLoader.
>> > >
>> > >   Using the following code as a starting point, I wish to place the
>> camera such that it automatically accommodates scenes of different sizes.
>> > >
>> > >   One way I am thinking of doing is to base on the scene geometry
>> bounding box.
>> > >
>> > >   Is there a method or API which I can call to query the entire scene
>> geometry bounding box ? Or do I have to walk the entire scene to build that
>> up by querying the bounding box for every geometry in the scene ?
>> > >
>> > >   Any sample code I can view to get me going ?
>> > >
>> > > ```
>> > >
>> /
>> > > **
>> > > ** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
>> > > ** Contact: https://www.qt.io/licensing/
>> > > **
>> > > ** This file is part of the Qt3D module of the Qt Toolkit.
>> > > **
>> > > ** $QT_BEGIN_LICENSE:BSD$
>> > > ** Commercial License Usage
>> > > ** Licensees holding valid commercial Qt licenses may use this file in
>> > > ** accordance with the commercial license agreement provided with the
>> > > ** Software or, alternatively, in accordance with the terms contained
>> in
>> > > ** a written agreement between you and The Qt Company. For licensing
>> terms
>> > > ** and conditions see 

Re: [Interest] Qt3D : QSceneLoader - determining scene level geometry bounding box

2022-08-03 Thread Nicholas Yue
I have the following code

```
void SceneWalker::walkEntity(Qt3DCore::QEntity *e, int depth)
{
Qt3DCore::QNodeVector nodes = e->childNodes();
for (int i = 0; i < nodes.count(); ++i) {
Qt3DCore::QNode *node = nodes[i];
Qt3DCore::QEntity *entity = qobject_cast(node);
if (entity) {
QString indent;
indent.fill(' ', depth * 2);
qDebug().noquote() << indent << "Entity:" << entity <<
"Components:" << entity->components();

{
// Question about BoundingVolume
qDebug() << "BoundingVolume: " << entity->objectName();
const QList
myQGeometryRenderer =
entity->componentsOfType();
if (!myQGeometryRenderer.isEmpty())
{
Qt3DRender::QGeometryRenderer *gr = myQGeometryRenderer[0];
QVector3D minPoint = gr->implicitMinPoint();
QVector3D maxPoint = gr->implicitMaxPoint();
qDebug() << "minPoint: " << minPoint;
qDebug() << "maxPoint: " << maxPoint;
}
}
walkEntity(entity, depth + 1);
}
}
}
```

But I got the (0,0,0) for both the min/max point

```
Status changed: Qt3DRender::QSceneLoader::Loading
Status changed: Qt3DRender::QSceneLoader::Ready
 Entity: Qt3DCore::QEntity(0x7f65dc004660, name = untitled.obj) Components:
QList(Qt3DCore::QTransform(0x7f65dc04c590))
   Entity: Qt3DCore::QEntity(0x7f65dc019220, name = Suzanne) Components:
QList(Qt3DExtras::QPhongMaterial(0x7f65dc01bf30, name = DefaultMaterial),
Qt3DRender::QGeometryRenderer(0x7f65dc00c4d0),
Qt3DCore::QTransform(0x7f65dc045800))
BoundingVolume:  "Suzanne"
minPoint:  QVector3D(0, 0, 0)
maxPoint:  QVector3D(0, 0, 0)
BoundingVolume:  "untitled.obj"
```

I am using Qt 6.2.2 on Ubuntu

Cheers

On Wed, 3 Aug 2022 at 01:25, Mike Krus  wrote:

> Hi
>
> once the scene is loaded (ie, the status is Ready, keeping in mind loading
> is asynchronous), you can use
> QSceneLoader::entity() to get a loaded entity by name, and then
> QEntity::componentsOfType() to get the component.
> Loaded entities are children of the entity that the QSceneLoader component
> was assigned to, and components and
> entities are all QObjects so you can use the normal tree traversal
> techniques that work with any QObject to find
> objects by type or name.
>
>
> Mike
>
> > On 3 Aug 2022, at 00:14, Nicholas Yue  wrote:
> >
> > Thank you Mike.
> >
> > Follow up question:
> >
> > Given a
> >
> > ```
> > Qt3DRender::QSceneLoader *sceneLoader;
> > ```
> >
> > How do we get at this QGeometryRenderer object to be able to call the
> impliciteMinPoint (), impliciteMaxPoint () properties ?
> >
> > Cheers
> >
> > On Tue, 2 Aug 2022 at 05:56, Mike Krus  wrote:
> > Hi
> >
> > if you are using Qt6, then yes.
> >
> > For a specific object, QGeometryRenderer derives from QBoundingVolume
> which has impliciteMinPoint and impliciteMaxPoint properties.
> >
> > If you’re interested in the bounding volume of a portion of the scene
> graph, all a QBoundingVolume component at the root and the
> > same properties will be updated.
> >
> > In Qt5, the QGeometry node associated with each render has similar
> min/max properties (note that they only valid if the mesh uses all the
> geometry).
> >
> > Hope this helps,
> >
> > Mike
> >
> >
> > > On 1 Aug 2022, at 16:05, Nicholas Yue  wrote:
> > >
> > > Hi,
> > >
> > >   I am diving into the geometry scene via QSceneLoader.
> > >
> > >   Using the following code as a starting point, I wish to place the
> camera such that it automatically accommodates scenes of different sizes.
> > >
> > >   One way I am thinking of doing is to base on the scene geometry
> bounding box.
> > >
> > >   Is there a method or API which I can call to query the entire scene
> geometry bounding box ? Or do I have to walk the entire scene to build that
> up by querying the bounding box for every geometry in the scene ?
> > >
> > >   Any sample code I can view to get me going ?
> > >
> > > ```
> > >
> /
> > > **
> > > ** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
> > > ** Contact: https://www.qt.io/licensing/
> > > **
> > > ** This file is part of the Qt3D module of the Qt Toolkit.
> > > **
> > > ** $QT_BEGIN_LICENSE:BSD$
> > > ** Commercial License Usage
> > > ** Licensees holding valid commercial Qt licenses may use this file in
> > > ** accordance with the commercial license agreement provided with the
> > > ** Software or, alternatively, in accordance with the terms contained
> in
> > > ** a written agreement between you and The Qt Company. For licensing
> terms
> > > ** and conditions see https://www.qt.io/terms-conditions. For further
> > > ** information use the contact form at https://www.qt.io/contact-us.
> > > **
> > > ** BSD License Usage
> > > ** Alternatively, you may use this file under the terms of the BSD
> license
> > > ** as follows:
> > > **
> > > ** "Redistribution 

Re: [Interest] Qt3D : QSceneLoader - determining scene level geometry bounding box

2022-08-03 Thread Mike Krus via Interest
Hi

once the scene is loaded (ie, the status is Ready, keeping in mind loading is 
asynchronous), you can use
QSceneLoader::entity() to get a loaded entity by name, and then 
QEntity::componentsOfType() to get the component.
Loaded entities are children of the entity that the QSceneLoader component was 
assigned to, and components and
entities are all QObjects so you can use the normal tree traversal techniques 
that work with any QObject to find
objects by type or name.


Mike

> On 3 Aug 2022, at 00:14, Nicholas Yue  wrote:
>
> Thank you Mike.
>
> Follow up question:
>
> Given a
>
> ```
> Qt3DRender::QSceneLoader *sceneLoader;
> ```
>
> How do we get at this QGeometryRenderer object to be able to call the 
> impliciteMinPoint (), impliciteMaxPoint () properties ?
>
> Cheers
>
> On Tue, 2 Aug 2022 at 05:56, Mike Krus  wrote:
> Hi
>
> if you are using Qt6, then yes.
>
> For a specific object, QGeometryRenderer derives from QBoundingVolume which 
> has impliciteMinPoint and impliciteMaxPoint properties.
>
> If you’re interested in the bounding volume of a portion of the scene graph, 
> all a QBoundingVolume component at the root and the
> same properties will be updated.
>
> In Qt5, the QGeometry node associated with each render has similar min/max 
> properties (note that they only valid if the mesh uses all the geometry).
>
> Hope this helps,
>
> Mike
>
>
> > On 1 Aug 2022, at 16:05, Nicholas Yue  wrote:
> >
> > Hi,
> >
> >   I am diving into the geometry scene via QSceneLoader.
> >
> >   Using the following code as a starting point, I wish to place the camera 
> > such that it automatically accommodates scenes of different sizes.
> >
> >   One way I am thinking of doing is to base on the scene geometry bounding 
> > box.
> >
> >   Is there a method or API which I can call to query the entire scene 
> > geometry bounding box ? Or do I have to walk the entire scene to build that 
> > up by querying the bounding box for every geometry in the scene ?
> >
> >   Any sample code I can view to get me going ?
> >
> > ```
> > /
> > **
> > ** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
> > ** Contact: https://www.qt.io/licensing/
> > **
> > ** This file is part of the Qt3D module of the Qt Toolkit.
> > **
> > ** $QT_BEGIN_LICENSE:BSD$
> > ** Commercial License Usage
> > ** Licensees holding valid commercial Qt licenses may use this file in
> > ** accordance with the commercial license agreement provided with the
> > ** Software or, alternatively, in accordance with the terms contained in
> > ** a written agreement between you and The Qt Company. For licensing terms
> > ** and conditions see https://www.qt.io/terms-conditions. For further
> > ** information use the contact form at https://www.qt.io/contact-us.
> > **
> > ** BSD License Usage
> > ** Alternatively, you may use this file under the terms of the BSD license
> > ** as follows:
> > **
> > ** "Redistribution and use in source and binary forms, with or without
> > ** modification, are permitted provided that the following conditions are
> > ** met:
> > **   * Redistributions of source code must retain the above copyright
> > ** notice, this list of conditions and the following disclaimer.
> > **   * Redistributions in binary form must reproduce the above copyright
> > ** notice, this list of conditions and the following disclaimer in
> > ** the documentation and/or other materials provided with the
> > ** distribution.
> > **   * Neither the name of The Qt Company Ltd nor the names of its
> > ** contributors may be used to endorse or promote products derived
> > ** from this software without specific prior written permission.
> > **
> > **
> > ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> > ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> > ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
> > ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
> > ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> > ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> > ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
> > ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> > ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> > ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> > ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
> > **
> > ** $QT_END_LICENSE$
> > **
> > /
> >
> > #include 
> > #include 
> >
> > #include 
> > #include 
> > #include 
> > #include 
> > #include 
> > #include 
> > #include 
> > #include 
> > // #include 
> > #include "MyCameraController.h"
> > #include "TrackballCameraController.h"
> >
> > class SceneWalker : public 

Re: [Interest] Qt3D : QSceneLoader - determining scene level geometry bounding box

2022-08-02 Thread Nicholas Yue
Thank you Mike.

Follow up question:

Given a

```
Qt3DRender::QSceneLoader *sceneLoader;
```

How do we get at this QGeometryRenderer object to be able to call the
impliciteMinPoint (), impliciteMaxPoint () properties ?

Cheers

On Tue, 2 Aug 2022 at 05:56, Mike Krus  wrote:

> Hi
>
> if you are using Qt6, then yes.
>
> For a specific object, QGeometryRenderer derives from QBoundingVolume
> which has impliciteMinPoint and impliciteMaxPoint properties.
>
> If you’re interested in the bounding volume of a portion of the scene
> graph, all a QBoundingVolume component at the root and the
> same properties will be updated.
>
> In Qt5, the QGeometry node associated with each render has similar min/max
> properties (note that they only valid if the mesh uses all the geometry).
>
> Hope this helps,
>
> Mike
>
>
> > On 1 Aug 2022, at 16:05, Nicholas Yue  wrote:
> >
> > Hi,
> >
> >   I am diving into the geometry scene via QSceneLoader.
> >
> >   Using the following code as a starting point, I wish to place the
> camera such that it automatically accommodates scenes of different sizes.
> >
> >   One way I am thinking of doing is to base on the scene geometry
> bounding box.
> >
> >   Is there a method or API which I can call to query the entire scene
> geometry bounding box ? Or do I have to walk the entire scene to build that
> up by querying the bounding box for every geometry in the scene ?
> >
> >   Any sample code I can view to get me going ?
> >
> > ```
> >
> /
> > **
> > ** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
> > ** Contact: https://www.qt.io/licensing/
> > **
> > ** This file is part of the Qt3D module of the Qt Toolkit.
> > **
> > ** $QT_BEGIN_LICENSE:BSD$
> > ** Commercial License Usage
> > ** Licensees holding valid commercial Qt licenses may use this file in
> > ** accordance with the commercial license agreement provided with the
> > ** Software or, alternatively, in accordance with the terms contained in
> > ** a written agreement between you and The Qt Company. For licensing
> terms
> > ** and conditions see https://www.qt.io/terms-conditions. For further
> > ** information use the contact form at https://www.qt.io/contact-us.
> > **
> > ** BSD License Usage
> > ** Alternatively, you may use this file under the terms of the BSD
> license
> > ** as follows:
> > **
> > ** "Redistribution and use in source and binary forms, with or without
> > ** modification, are permitted provided that the following conditions are
> > ** met:
> > **   * Redistributions of source code must retain the above copyright
> > ** notice, this list of conditions and the following disclaimer.
> > **   * Redistributions in binary form must reproduce the above copyright
> > ** notice, this list of conditions and the following disclaimer in
> > ** the documentation and/or other materials provided with the
> > ** distribution.
> > **   * Neither the name of The Qt Company Ltd nor the names of its
> > ** contributors may be used to endorse or promote products derived
> > ** from this software without specific prior written permission.
> > **
> > **
> > ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> > ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> > ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
> > ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
> > ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> > ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> > ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
> > ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> > ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> > ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> > ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
> > **
> > ** $QT_END_LICENSE$
> > **
> >
> /
> >
> > #include 
> > #include 
> >
> > #include 
> > #include 
> > #include 
> > #include 
> > #include 
> > #include 
> > #include 
> > #include 
> > // #include 
> > #include "MyCameraController.h"
> > #include "TrackballCameraController.h"
> >
> > class SceneWalker : public QObject
> > {
> > public:
> > SceneWalker(Qt3DRender::QSceneLoader *loader) : m_loader(loader) { }
> >
> > void onStatusChanged();
> >
> > private:
> > void walkEntity(Qt3DCore::QEntity *e, int depth = 0);
> >
> > Qt3DRender::QSceneLoader *m_loader;
> > };
> >
> > void SceneWalker::onStatusChanged()
> > {
> > qDebug() << "Status changed:" << m_loader->status();
> > if (m_loader->status() != Qt3DRender::QSceneLoader::Ready)
> > return;
> >
> > // The QSceneLoader instance is a component of an entity. The loaded
> scene
> >

Re: [Interest] Qt3D : QSceneLoader - determining scene level geometry bounding box

2022-08-02 Thread Mike Krus via Interest
Hi

if you are using Qt6, then yes.

For a specific object, QGeometryRenderer derives from QBoundingVolume which has 
impliciteMinPoint and impliciteMaxPoint properties.

If you’re interested in the bounding volume of a portion of the scene graph, 
all a QBoundingVolume component at the root and the
same properties will be updated.

In Qt5, the QGeometry node associated with each render has similar min/max 
properties (note that they only valid if the mesh uses all the geometry).

Hope this helps,

Mike


> On 1 Aug 2022, at 16:05, Nicholas Yue  wrote:
>
> Hi,
>
>   I am diving into the geometry scene via QSceneLoader.
>
>   Using the following code as a starting point, I wish to place the camera 
> such that it automatically accommodates scenes of different sizes.
>
>   One way I am thinking of doing is to base on the scene geometry bounding 
> box.
>
>   Is there a method or API which I can call to query the entire scene 
> geometry bounding box ? Or do I have to walk the entire scene to build that 
> up by querying the bounding box for every geometry in the scene ?
>
>   Any sample code I can view to get me going ?
>
> ```
> /
> **
> ** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
> ** Contact: https://www.qt.io/licensing/
> **
> ** This file is part of the Qt3D module of the Qt Toolkit.
> **
> ** $QT_BEGIN_LICENSE:BSD$
> ** Commercial License Usage
> ** Licensees holding valid commercial Qt licenses may use this file in
> ** accordance with the commercial license agreement provided with the
> ** Software or, alternatively, in accordance with the terms contained in
> ** a written agreement between you and The Qt Company. For licensing terms
> ** and conditions see https://www.qt.io/terms-conditions. For further
> ** information use the contact form at https://www.qt.io/contact-us.
> **
> ** BSD License Usage
> ** Alternatively, you may use this file under the terms of the BSD license
> ** as follows:
> **
> ** "Redistribution and use in source and binary forms, with or without
> ** modification, are permitted provided that the following conditions are
> ** met:
> **   * Redistributions of source code must retain the above copyright
> ** notice, this list of conditions and the following disclaimer.
> **   * Redistributions in binary form must reproduce the above copyright
> ** notice, this list of conditions and the following disclaimer in
> ** the documentation and/or other materials provided with the
> ** distribution.
> **   * Neither the name of The Qt Company Ltd nor the names of its
> ** contributors may be used to endorse or promote products derived
> ** from this software without specific prior written permission.
> **
> **
> ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
> ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
> ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
> ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
> **
> ** $QT_END_LICENSE$
> **
> /
>
> #include 
> #include 
>
> #include 
> #include 
> #include 
> #include 
> #include 
> #include 
> #include 
> #include 
> // #include 
> #include "MyCameraController.h"
> #include "TrackballCameraController.h"
>
> class SceneWalker : public QObject
> {
> public:
> SceneWalker(Qt3DRender::QSceneLoader *loader) : m_loader(loader) { }
>
> void onStatusChanged();
>
> private:
> void walkEntity(Qt3DCore::QEntity *e, int depth = 0);
>
> Qt3DRender::QSceneLoader *m_loader;
> };
>
> void SceneWalker::onStatusChanged()
> {
> qDebug() << "Status changed:" << m_loader->status();
> if (m_loader->status() != Qt3DRender::QSceneLoader::Ready)
> return;
>
> // The QSceneLoader instance is a component of an entity. The loaded scene
> // tree is added under this entity.
> QVector entities = m_loader->entities();
>
> // Technically there could be multiple entities referencing the scene 
> loader
> // but sharing is discouraged, and in our case there will be one anyhow.
> if (entities.isEmpty())
> return;
> Qt3DCore::QEntity *root = entities[0];
> // Print the tree.
> walkEntity(root);
>
> // To access a given node (like a named mesh in the scene), use 
> QObject::findChild().
> // The scene 

Re: [Interest] Qt3D/C++: How to disable rendering while makeing changes to the the Scenegraph

2022-06-20 Thread Yves Maurischat





Am 20.06.22 um 10:08 schrieb Mike Krus:

Hi



On 20 Jun 2022, at 08:37, Yves Maurischat  wrote:

Hi all,

I've got a C++/QWidgets application with 2 Qt3DWindow embedded. The 3D windows 
can be hidden (i.e. the user switches to another view), while work is done in 
other parts of the application. Whenever the user switches back to the view 
with the embedded Qt3DWindow there are a lot of changes to be made to the 
scenegraph.

Rendering is set to OnDemand, but whenever the view is switched back to the 3D 
windows there is a big lag, up to several seconds. Profiling the application 
has shown that a lot of work is done for rendering at that point because the 
scenegraph is changing (most time is spent in the material classes).

My working theory is, that each change to the scenegraph (i.e. removing 
entities, adding a new ones) causes a separate render update, which leads to 
the lag due to the amount of separate changes.

that is not correct, updates are batched on a per-frame basis. If you’re not 
scheduling frames, no updates will be made.

If you are using Qt version 5.15.0 or later this should be pretty fast. Prior 
version had a slower update mechanism.


I'm on Qt 5.14.2 for the application, but this is a reason to switch to 
Qt 5.15.x




One thing to keep in mind though is that changing materials will lead shaders 
needing to be recompiled, potentially textures to be updates, etc. Changing 
geometry means bounding volumes need updating, buffers need to be uploaded, etc.
So the time might just be due to the GL state needing to be updated. You should 
take care to minimise such changes.


I see. Currently large parts of the scenegraph are removed for an update 
but I guess I could optimize changes so only the absolute necessary 
parts are modified. Thanks!





Another thing to note, if you have 2 Qt3DWindows, then you have 2 underlying 
Qt3DEngine instances. These do not share resources so everything might be done 
twice.

Of course it’s impossible to provide accurate feedback without profiling the 
actual code.


Mike



So my question is: Is there a way to disable all render updates until the scenegraph has 
been updated/modified completely? What would be the "correct" way to make such 
changes? Is there  something similar to the beginResetModel() and endResetModel() methods 
in QAbstractItemModel?


Thanks!

Yves



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

—
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




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


Re: [Interest] Qt3D/C++: How to disable rendering while makeing changes to the the Scenegraph

2022-06-20 Thread Mike Krus via Interest
Hi


> On 20 Jun 2022, at 08:37, Yves Maurischat  
> wrote:
>
> Hi all,
>
> I've got a C++/QWidgets application with 2 Qt3DWindow embedded. The 3D 
> windows can be hidden (i.e. the user switches to another view), while work is 
> done in other parts of the application. Whenever the user switches back to 
> the view with the embedded Qt3DWindow there are a lot of changes to be made 
> to the scenegraph.
>
> Rendering is set to OnDemand, but whenever the view is switched back to the 
> 3D windows there is a big lag, up to several seconds. Profiling the 
> application has shown that a lot of work is done for rendering at that point 
> because the scenegraph is changing (most time is spent in the material 
> classes).
>
> My working theory is, that each change to the scenegraph (i.e. removing 
> entities, adding a new ones) causes a separate render update, which leads to 
> the lag due to the amount of separate changes.
that is not correct, updates are batched on a per-frame basis. If you’re not 
scheduling frames, no updates will be made.

If you are using Qt version 5.15.0 or later this should be pretty fast. Prior 
version had a slower update mechanism.

One thing to keep in mind though is that changing materials will lead shaders 
needing to be recompiled, potentially textures to be updates, etc. Changing 
geometry means bounding volumes need updating, buffers need to be uploaded, etc.
So the time might just be due to the GL state needing to be updated. You should 
take care to minimise such changes.

Another thing to note, if you have 2 Qt3DWindows, then you have 2 underlying 
Qt3DEngine instances. These do not share resources so everything might be done 
twice.

Of course it’s impossible to provide accurate feedback without profiling the 
actual code.


Mike


> So my question is: Is there a way to disable all render updates until the 
> scenegraph has been updated/modified completely? What would be the "correct" 
> way to make such changes? Is there  something similar to the 
> beginResetModel() and endResetModel() methods in QAbstractItemModel?
>
>
> Thanks!
>
> Yves
>
>
>
> ___
> Interest mailing list
> Interest@qt-project.org
> https://lists.qt-project.org/listinfo/interest

—
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




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


Re: [Interest] [Qt3d] Rendering 3D object with 2D coordinates

2021-03-25 Thread Alex john
On Mon, Mar 22, 2021 at 10:55 AM Alex john  wrote:

> Transform {
> id: trefoilMeshTransform
> translation:Qt.vector3d(Qt.vector2D(100, 100)).unproject(
> modelView ,mainCam.projectionMatrix, forwardRenderer.viewportRect)
> property real theta: 0.0
> property real phi:0.0
> property real roll: 0.0
> rotation: fromEulerAngles(theta, phi, roll)
> scale: root.scale
> }


I used the following function to get the 3d coordinates using the 2d,
by refering to the source code
https://code.woboq.org/qt5/qtbase/src/gui/math3d/qvector3d.cpp.html#_ZNK9QVector3D9unprojectERK10QMatrix4x4S2_RK5QRect
I need to render the 3d cube exactly where the Rectangle{x:100, y:100}
renders however there is lot of offset and I think the calculations is
somewhere going wrong. Can clue ?

function projectPointsto3d(){
var ptX = 100
var ptY = 100
var windowPt = Qt.vector4d(ptX,ptY,1,1)
var mat = mainCam.projectionMatrix.times(mainCam.viewMatrix)
var inverse = mat.inverted()

var normalize =  Qt.vector4d(1,1,1,1)
windowPt.x = (windowPt.x -
forwardRenderer.viewportRect.x)/forwardRenderer.viewportRect.width
windowPt.y = (windowPt.y -
forwardRenderer.viewportRect.y)/forwardRenderer.viewportRect.height

windowPt = windowPt.times(2).minus(normalize)

var a = inverse.times(windowPt)
var division = a.w (if i use (1/a.w) teh 3d values will be
very high and I do not see object)
a = a.times(division)
return a.toVector3d()
}
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] [Qt3d] Rendering 3D object with 2D coordinates

2021-03-24 Thread Alex john
On Mon, Mar 22, 2021 at 10:55 AM Alex john  wrote:
>
> On Thu, Mar 18, 2021 at 5:22 AM Walter Rawdanik  wrote:
> >
> > You can’t convert 2d coordinates to a 3d position because you are missing 
> > the z coordinate.
>
> I can have a dummy z value as 1 for the calculation. The problem is
> similar  as described here
> https://community.khronos.org/t/getting-2d-to-3d/20050/6 in opengl
> they could fetch the requirted matrix for gluUnProject and get the 3d
> coordinates from 2d. However, in Qt3d, I'm stuck to fetch the required
> matrix i.e modelView etc and pass it correctly to the
> vector3d::uproject and get the corresponding 3d points back. All I
> could do is the following, however I doubt the correctness of it.
>
> // The code is exactly same as wireframe example file TrefoilKnot.qml
>
> Transform {
> id: trefoilMeshTransform
> translation:Qt.vector3d(Qt.vector2D(100, 100)).unproject(
> modelView ,mainCam.projectionMatrix, forwardRenderer.viewportRect)
> property real theta: 0.0
> property real phi:0.0
> property real roll: 0.0
> rotation: fromEulerAngles(theta, phi, roll)
> scale: root.scale
> }
>
> In translation, Qt.vector2D(100, 100) is where I give the x,y (window
> coordinates) and expect the unproject api will return the 3d points
> for translation. mainCam.projectionMatrix and
> forwardRenderer.viewportRect are set from BasicCamera and
> Forwardrenderer from main.qml respectively. And I do not know where to
> get modelView. If you let me know the modelView matrix and confirm the
> above changes are right,  I'll be thankful.
>
> Do let me know.

Can anyone let me know about this?
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] [Qt3d] Rendering 3D object with 2D coordinates

2021-03-21 Thread Alex john
On Thu, Mar 18, 2021 at 5:22 AM Walter Rawdanik  wrote:
>
> You can’t convert 2d coordinates to a 3d position because you are missing the 
> z coordinate.

I can have a dummy z value as 1 for the calculation. The problem is
similar  as described here
https://community.khronos.org/t/getting-2d-to-3d/20050/6 in opengl
they could fetch the requirted matrix for gluUnProject and get the 3d
coordinates from 2d. However, in Qt3d, I'm stuck to fetch the required
matrix i.e modelView etc and pass it correctly to the
vector3d::uproject and get the corresponding 3d points back. All I
could do is the following, however I doubt the correctness of it.

// The code is exactly same as wireframe example file TrefoilKnot.qml

Transform {
id: trefoilMeshTransform
translation:Qt.vector3d(Qt.vector2D(100, 100)).unproject(
modelView ,mainCam.projectionMatrix, forwardRenderer.viewportRect)
property real theta: 0.0
property real phi:0.0
property real roll: 0.0
rotation: fromEulerAngles(theta, phi, roll)
scale: root.scale
}

In translation, Qt.vector2D(100, 100) is where I give the x,y (window
coordinates) and expect the unproject api will return the 3d points
for translation. mainCam.projectionMatrix and
forwardRenderer.viewportRect are set from BasicCamera and
Forwardrenderer from main.qml respectively. And I do not know where to
get modelView. If you let me know the modelView matrix and confirm the
above changes are right,  I'll be thankful.

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


Re: [Interest] [Qt3d] Rendering 3D object with 2D coordinates

2021-03-17 Thread Walter Rawdanik
You can’t convert 2d coordinates to a 3d position because you are missing the z 
coordinate. It is similar problem like with picking objects in a 3D scene - you 
can unproject a 2d screen coordinate to a vector/ray in your 3d scene and then 
do a ray casting to see what you hit but that’s about it.
If you just want to render a 3D object at a specific location on a screen you 
can do so via rendering to an offscreen target and then displaying it like a 
regular 2d image but that will look and act like an overlay image rather than 
being composed into your scene.

Sent from my iPad

> On Mar 16, 2021, at 10:52 AM, Alex john  wrote:
> 
> 
> 
> 
> I did the following changes to the wireframe example (Trefoilknot.qml file 
> translation property of transform) but still unable to get the modelView 
> Matrix,  and also not sure whether the following changes to translation are 
> right If anyone can confirm and let me know
> 
> property var mainCam   // got the mainCamera ID from main.qml (wireframe 
> example)
> property var forwardRenderer //forwardRendered id from main.qml (wireframe 
> example)
> 
>  Transform {
> id: trefoilMeshTransform
> translation:Qt.vector3d(Qt.vector2D(4, 4)).unproject( *modelView* 
> ,mainCam.projectionMatrix, forwardRenderer.viewportRect)
> property real theta: 0.0
> property real phi: 0.0
> property real roll: 0.0
> rotation: fromEulerAngles(theta, phi, roll)
> scale: root.scale
> }
> /*
>  translation : Qt.vector2D(100, 100) is where I intend to give window 2d 
> coordinates(here its x:100, y:100)and I assume that unproject api will 
> convert the 2d points to 3d and renders the 3d object exactly at 100, 100 
> pixel 2d location
> */
> 
> I got the projectionMatrix from camera, viewPortRect from ForwardRenderer in 
> Rendering settings. I'm completely stuck for this step. If anyone can please 
> confirm the changes and let me know the modelView matrix.
> 
> 
>> On Mon, Mar 15, 2021 at 5:14 PM Alex john  wrote:
>> > Going the other way round (back-projection) can be done by e.g. 
>> > QVector3D::unproject()
>> 
>> Thanks, as I'm referring the the wireframe example I was able to get
>> the camera projection matrix from Camera Qml.  However, I'm unsure how
>> to get the ModelView matrix and the viewport.
>> 
>> As I have loaded my custom obj in wireframe example and using the same
>> geometry and camera settings as its for wireframe, therefore can you
>> please let me know how this can be done at QML side? I did try to find
>> this in the documentation but didn't find the usage.
>> 
>> 
>> 
>> 
>> > On Mon, Mar 15, 2021 at 11:03 AM Alex john  wrote:
>> >>
>> >> Hello ,
>> >>
>> >> Im successessfully able to load the obj file in Scene3D, and by using
>> >> fromEulerAngles I'm able to get the required yaw, pitch and
>> >> roll.However, I'm not able to use the right translation to get the
>> >> object rendered. I get the x,y coordinates in pixels from the other
>> >> module and I need to render the 3d model exactly at that pixel
>> >> location. It turns out that the Transform type has translation and it
>> >> takes the input in 3d coordinates (not sure which unit) if I try to
>> >> assign the x,y coordinates to the 3d coordinates it renders somewhere
>> >> else. Seems like the x,y in the translation is not the pixel 2d
>> >> values, as even with a x=0.3 it deflects more than expected.
>> >>
>> >> Is there a way to assign the x,y 2d pixel values (as we do for
>> >> Rectangle {x: 100, y:100}) to the translation so that it is rendered
>> >> to the right place where it's desired.
>> >> ___
>> >> Interest mailing list
>> >> Interest@qt-project.org
>> >> https://lists.qt-project.org/listinfo/interest
> ___
> Interest mailing list
> Interest@qt-project.org
> https://lists.qt-project.org/listinfo/interest
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] [Qt3d] Rendering 3D object with 2D coordinates

2021-03-16 Thread Alex john
I did the following changes to the wireframe example (Trefoilknot.qml file
translation property of transform) but still unable to get the modelView
Matrix,  and also not sure whether the following changes to translation are
right If anyone can confirm and let me know

property var mainCam   // got the mainCamera ID from main.qml (wireframe
example)
property var forwardRenderer //forwardRendered id from main.qml (wireframe
example)

 Transform {
id: trefoilMeshTransform
*translation:Qt.vector3d(Qt.vector2D(4, 4)).unproject( *modelView*
,mainCam.projectionMatrix, forwardRenderer.viewportRect)*
property real theta: 0.0
property real phi: 0.0
property real roll: 0.0
rotation: fromEulerAngles(theta, phi, roll)
scale: root.scale
}
/*
 *translation* : Qt.vector2D(100, 100) is where I intend to give window 2d
coordinates(here its x:100, y:100)and I assume that unproject api will
convert the 2d points to 3d and renders the 3d object exactly at 100, 100
pixel 2d location
*/

I got the projectionMatrix from camera, viewPortRect from ForwardRenderer
in Rendering settings. I'm completely stuck for this step. If anyone can
please confirm the changes and let me know the modelView matrix.


On Mon, Mar 15, 2021 at 5:14 PM Alex john  wrote:

> > Going the other way round (back-projection) can be done by e.g.
> QVector3D::unproject()
>
> Thanks, as I'm referring the the wireframe example I was able to get
> the camera projection matrix from Camera Qml.  However, I'm unsure how
> to get the ModelView matrix and the viewport.
>
> As I have loaded my custom obj in wireframe example and using the same
> geometry and camera settings as its for wireframe, therefore can you
> please let me know how this can be done at QML side? I did try to find
> this in the documentation but didn't find the usage.
>
>
>
>
> > On Mon, Mar 15, 2021 at 11:03 AM Alex john 
> wrote:
> >>
> >> Hello ,
> >>
> >> Im successessfully able to load the obj file in Scene3D, and by using
> >> fromEulerAngles I'm able to get the required yaw, pitch and
> >> roll.However, I'm not able to use the right translation to get the
> >> object rendered. I get the x,y coordinates in pixels from the other
> >> module and I need to render the 3d model exactly at that pixel
> >> location. It turns out that the Transform type has translation and it
> >> takes the input in 3d coordinates (not sure which unit) if I try to
> >> assign the x,y coordinates to the 3d coordinates it renders somewhere
> >> else. Seems like the x,y in the translation is not the pixel 2d
> >> values, as even with a x=0.3 it deflects more than expected.
> >>
> >> Is there a way to assign the x,y 2d pixel values (as we do for
> >> Rectangle {x: 100, y:100}) to the translation so that it is rendered
> >> to the right place where it's desired.
> >> ___
> >> Interest mailing list
> >> Interest@qt-project.org
> >> https://lists.qt-project.org/listinfo/interest
>
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] [Qt3d] Rendering 3D object with 2D coordinates

2021-03-15 Thread Alex john
> Going the other way round (back-projection) can be done by e.g. 
> QVector3D::unproject()

Thanks, as I'm referring the the wireframe example I was able to get
the camera projection matrix from Camera Qml.  However, I'm unsure how
to get the ModelView matrix and the viewport.

As I have loaded my custom obj in wireframe example and using the same
geometry and camera settings as its for wireframe, therefore can you
please let me know how this can be done at QML side? I did try to find
this in the documentation but didn't find the usage.




> On Mon, Mar 15, 2021 at 11:03 AM Alex john  wrote:
>>
>> Hello ,
>>
>> Im successessfully able to load the obj file in Scene3D, and by using
>> fromEulerAngles I'm able to get the required yaw, pitch and
>> roll.However, I'm not able to use the right translation to get the
>> object rendered. I get the x,y coordinates in pixels from the other
>> module and I need to render the 3d model exactly at that pixel
>> location. It turns out that the Transform type has translation and it
>> takes the input in 3d coordinates (not sure which unit) if I try to
>> assign the x,y coordinates to the 3d coordinates it renders somewhere
>> else. Seems like the x,y in the translation is not the pixel 2d
>> values, as even with a x=0.3 it deflects more than expected.
>>
>> Is there a way to assign the x,y 2d pixel values (as we do for
>> Rectangle {x: 100, y:100}) to the translation so that it is rendered
>> to the right place where it's desired.
>> ___
>> Interest mailing list
>> Interest@qt-project.org
>> https://lists.qt-project.org/listinfo/interest
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] [Qt3d] Rendering 3D object with 2D coordinates

2021-03-15 Thread Federico Ferri
The 3D coordinates are *world coordinates*, and their units is whatever you
like, e.g. you can have a cube of size 0.1, 1, or 100, and with appropriate
camera settings, it will appear the same onto the window/device.

2D *window coordinates* are another thing.

For going to world coords to window coords points are (left) multiplied by
the view matrix, then by the projection matrix, then coordinates are
scaled/translated to render in the window/viewport (this is not specific to
Qt3D, it's just basic OpenGL).

Going the other way round (back-projection) can be done by e.g.
QVector3D::unproject()

On Mon, Mar 15, 2021 at 11:03 AM Alex john  wrote:

> Hello ,
>
> Im successessfully able to load the obj file in Scene3D, and by using
> fromEulerAngles I'm able to get the required yaw, pitch and
> roll.However, I'm not able to use the right translation to get the
> object rendered. I get the x,y coordinates in pixels from the other
> module and I need to render the 3d model exactly at that pixel
> location. It turns out that the Transform type has translation and it
> takes the input in 3d coordinates (not sure which unit) if I try to
> assign the x,y coordinates to the 3d coordinates it renders somewhere
> else. Seems like the x,y in the translation is not the pixel 2d
> values, as even with a x=0.3 it deflects more than expected.
>
> Is there a way to assign the x,y 2d pixel values (as we do for
> Rectangle {x: 100, y:100}) to the translation so that it is rendered
> to the right place where it's desired.
> ___
> Interest mailing list
> Interest@qt-project.org
> https://lists.qt-project.org/listinfo/interest
>
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] Qt3D widget

2020-09-04 Thread Florian Blume
I actually succeeded in implementing a Qt3D widget.

It can be found here: https://github.com/florianblume/qt3d-widget.

Unfortunately, I had to use Qt3D's internal classes so it kind of feels
a bit unstable because it might break with certain Qt versions.
I would have liked to leave all processing loops to Qt3D internally but
now have to drive them myself, which also feels a bit not so nice.

Anyways, I hope some other people can make use of it, too!

Best,
Florian

On 02.09.20 12:01, Florian Blume wrote:
> Hey,
>
> thanks for your quick answer!
>
> I actually had the version you described first running. I obtained the
> rendered image using QRenderCapture and then displayed it on the quad.
>
> I also already had the second idea that you described but thought it
> should be possible to obtain the texture from Qt3D and use it in OpenGL
> that's why I hadn't
> investigated this any further.
>
> Unfortunately, it's pretty difficult to run the aspect engine manually.
> I tried to place a processFrame() call in paintGL() - and even placed a
> doRender() call to
> the AbstractRenderer of the QRenderAspectPrivate after it like this:
>
> d->m_aspectEngine->processFrame();
>
> glClearColor(1.0, 1.0, 1.0, 1.0);
> glDisable(GL_BLEND);
> glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
>
> Qt3DRender::QRenderAspectPrivate *dRenderAspect =
> static_cast
>    
> (Qt3DRender::QRenderAspectPrivate::get(d->m_renderAspect));
> Qt3DRender::Render::AbstractRenderer *renderer = dRenderAspect->m_renderer;
> renderer->doRender(true);
>
> Without the doRender() call it gets stuck the second time processFrame()
> is called - in
> Qt3DRender::Render::VSyncFrameAdvanceService::waitForNextFrame() where it
> tries to acquire a semaphore (which apparently doesn't have any more
> work ready).
>
> With the doRender() call it gets stuck in a similar place - but in the
> first call to paintGL in Qt3DRender::Render::Renderer::isReadyToSubmit()
> where it again tries to
> acquire a semaphore.
>
> I also don't understand whether it's enough that QOpenGLWidget binds a
> framebuffer before calling paintGL, it looks like in Scene3DRenderer
> this is enough to make
> Qt3D draw to that framebuffer.
>
> As you can see there are a lot of open questions which are difficult to
> answer. Do you have any suggestions where/how to look for answers?
> Obviously in the code itself,
> which is also difficult.
>
> Any help is appreciated,
> Florian
>
>
> On 01.09.20 18:28, Mike Krus wrote:
>> Hi
>>
>> Qt 3D source code has an example of how to use render capture in the manual 
>> tests.
>>
>> However this is probably not the right way to do it as 1/ it would require 
>> another FBO on top of the one QOpenGLWidget uses already; 2/ it transfers 
>> the image to the CPU which is not needed here.
>>
>> Think the way to do it is to do something similar to what is done for 
>> Scene3D:
>> - setup Qt 3D engine to be in manual mode (rather than using the simulation 
>> loop)
>>   by calling QAspectEngine::setRunMode(QAspectEngine::Manual)
>> - use QOpenGLWidget and in the paintGL method call 
>> QAspectEngine::processFrame()
>>   to have Qt 3D draw
>>
>> There’s of course lots of other stuff to setup. Might need a dummy offscreen 
>> surface to handle sizing, handling of the context, and a fair amount more.
>>
>> Mike
>>
>>> On 1 Sep 2020, at 16:51, Florian Blume  wrote:
>>>
>>> Hi,
>>>
>>> I'm trying to implement a Qt3D widget since createWindowContainer is not
>>> suitable for me (always draws the Qt3DWindow on top of everything).
>>> I've already asked a Stackverflow question
>>> (https://stackoverflow.com/questions/63686309/use-qt3d-offscreen-rendered-texture-in-opengl)
>>> because I ran into
>>> several issues trying to display an offscreen texture that I render to
>>> with Qt3D in a QOpenGLWidget (it simply doesn't display anything).
>>>
>>> Has anyone some other solution regarding a Qt3D widget?
>>>
>>> Best regards,
>>> Florian
>>> ___
>>> Interest mailing list
>>> Interest@qt-project.org
>>> https://lists.qt-project.org/listinfo/interest
>> —
>> Mike Krus | mike.k...@kdab.com | Senior Software Engineer
>> KDAB (UK) Ltd., a KDAB Group company
>> Tel: UK Office +44 1625 809908   Mobile +44 7833 491941
>> KDAB - The Qt Experts, C++, OpenGL Experts
>>
>>
> ___
> Interest mailing list
> Interest@qt-project.org
> https://lists.qt-project.org/listinfo/interest

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


Re: [Interest] Qt3D widget

2020-09-02 Thread Florian Blume
Hey,

thanks for your quick answer!

I actually had the version you described first running. I obtained the
rendered image using QRenderCapture and then displayed it on the quad.

I also already had the second idea that you described but thought it
should be possible to obtain the texture from Qt3D and use it in OpenGL
that's why I hadn't
investigated this any further.

Unfortunately, it's pretty difficult to run the aspect engine manually.
I tried to place a processFrame() call in paintGL() - and even placed a
doRender() call to
the AbstractRenderer of the QRenderAspectPrivate after it like this:

d->m_aspectEngine->processFrame();

glClearColor(1.0, 1.0, 1.0, 1.0);
glDisable(GL_BLEND);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

Qt3DRender::QRenderAspectPrivate *dRenderAspect =
static_cast
   
(Qt3DRender::QRenderAspectPrivate::get(d->m_renderAspect));
Qt3DRender::Render::AbstractRenderer *renderer = dRenderAspect->m_renderer;
renderer->doRender(true);

Without the doRender() call it gets stuck the second time processFrame()
is called - in
Qt3DRender::Render::VSyncFrameAdvanceService::waitForNextFrame() where it
tries to acquire a semaphore (which apparently doesn't have any more
work ready).

With the doRender() call it gets stuck in a similar place - but in the
first call to paintGL in Qt3DRender::Render::Renderer::isReadyToSubmit()
where it again tries to
acquire a semaphore.

I also don't understand whether it's enough that QOpenGLWidget binds a
framebuffer before calling paintGL, it looks like in Scene3DRenderer
this is enough to make
Qt3D draw to that framebuffer.

As you can see there are a lot of open questions which are difficult to
answer. Do you have any suggestions where/how to look for answers?
Obviously in the code itself,
which is also difficult.

Any help is appreciated,
Florian


On 01.09.20 18:28, Mike Krus wrote:
> Hi
>
> Qt 3D source code has an example of how to use render capture in the manual 
> tests.
>
> However this is probably not the right way to do it as 1/ it would require 
> another FBO on top of the one QOpenGLWidget uses already; 2/ it transfers the 
> image to the CPU which is not needed here.
>
> Think the way to do it is to do something similar to what is done for Scene3D:
> - setup Qt 3D engine to be in manual mode (rather than using the simulation 
> loop)
>   by calling QAspectEngine::setRunMode(QAspectEngine::Manual)
> - use QOpenGLWidget and in the paintGL method call 
> QAspectEngine::processFrame()
>   to have Qt 3D draw
>
> There’s of course lots of other stuff to setup. Might need a dummy offscreen 
> surface to handle sizing, handling of the context, and a fair amount more.
>
> Mike
>
>> On 1 Sep 2020, at 16:51, Florian Blume  wrote:
>>
>> Hi,
>>
>> I'm trying to implement a Qt3D widget since createWindowContainer is not
>> suitable for me (always draws the Qt3DWindow on top of everything).
>> I've already asked a Stackverflow question
>> (https://stackoverflow.com/questions/63686309/use-qt3d-offscreen-rendered-texture-in-opengl)
>> because I ran into
>> several issues trying to display an offscreen texture that I render to
>> with Qt3D in a QOpenGLWidget (it simply doesn't display anything).
>>
>> Has anyone some other solution regarding a Qt3D widget?
>>
>> Best regards,
>> Florian
>> ___
>> Interest mailing list
>> Interest@qt-project.org
>> https://lists.qt-project.org/listinfo/interest
> —
> Mike Krus | mike.k...@kdab.com | Senior Software Engineer
> KDAB (UK) Ltd., a KDAB Group company
> Tel: UK Office +44 1625 809908   Mobile +44 7833 491941
> KDAB - The Qt Experts, C++, OpenGL Experts
>
>

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


Re: [Interest] Qt3D widget

2020-09-01 Thread Mike Krus via Interest
Hi

Qt 3D source code has an example of how to use render capture in the manual 
tests.

However this is probably not the right way to do it as 1/ it would require 
another FBO on top of the one QOpenGLWidget uses already; 2/ it transfers the 
image to the CPU which is not needed here.

Think the way to do it is to do something similar to what is done for Scene3D:
- setup Qt 3D engine to be in manual mode (rather than using the simulation 
loop)
  by calling QAspectEngine::setRunMode(QAspectEngine::Manual)
- use QOpenGLWidget and in the paintGL method call QAspectEngine::processFrame()
  to have Qt 3D draw

There’s of course lots of other stuff to setup. Might need a dummy offscreen 
surface to handle sizing, handling of the context, and a fair amount more.

Mike

> On 1 Sep 2020, at 16:51, Florian Blume  wrote:
> 
> Hi,
> 
> I'm trying to implement a Qt3D widget since createWindowContainer is not
> suitable for me (always draws the Qt3DWindow on top of everything).
> I've already asked a Stackverflow question
> (https://stackoverflow.com/questions/63686309/use-qt3d-offscreen-rendered-texture-in-opengl)
> because I ran into
> several issues trying to display an offscreen texture that I render to
> with Qt3D in a QOpenGLWidget (it simply doesn't display anything).
> 
> Has anyone some other solution regarding a Qt3D widget?
> 
> Best regards,
> Florian
> ___
> Interest mailing list
> Interest@qt-project.org
> https://lists.qt-project.org/listinfo/interest

—
Mike Krus | mike.k...@kdab.com | Senior Software Engineer
KDAB (UK) Ltd., a KDAB Group company
Tel: UK Office +44 1625 809908   Mobile +44 7833 491941
KDAB - The Qt Experts, C++, 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 Esch Lorenz TU Ilmenau
Hi,

thanks for the patches. I created a bug report a couple of days ago: 
https://bugreports.qt.io/browse/QTBUG-84576

In terms of linuxeployqt the following worked for me:

linuxdeployqt-continuous-x86_64.AppImage yourQt3DAppName 
-extra-plugins=renderers

Best,

Lorenz

Von: Paul Lemire 
Gesendet: Donnerstag, 4. Juni 2020 04:57
An: Esch Lorenz TU Ilmenau ; interest@qt-project.org
Betreff: Re: [Interest] Qt3D - Deploying renderer plugins introduced in Qt 5.15


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 += 3dcore 3drender 3dinput 3dextras 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<mailto:Interest@qt-project.org>

https://lists.qt-project.org/listinfo/interest
___
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] Qt3D performance, and development resources

2020-04-17 Thread Christoph Feck
Thanks to all for the interesting C++ Qt3D links! I long wanted to play 
with Qt3D in C++. RHI supporting all major 3D APIs makes it really 
attractive.


Christoph Feck

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


Re: [Interest] Qt3D performance, and development resources

2020-04-16 Thread 王少东
For anyone interested in more code examples, I've written some rendering
tools using Qt3D in C++.

https://github.com/unclejimbo/Klein

Hope this helps.

Nyall Dawson  于2020年4月15日周三 下午12:45写道:

> On Wed, 15 Apr 2020 at 01:51, Charles Martin  wrote:
>
> >  - Where can I find more examples, tutorials and introductory
> information? There are only two C++ examples on the Qt website, and both of
> these are very simple. The Qt docs are very limited and incomplete.
>
> There's some good ones here:
>
> https://github.com/wonder-sk/qt3d-experiments
>
> >   - Is there a community of C++ Qt3D developers? Most online material
> was produced by KADB, is 4 years or older, and focuses on QML. Where are
> the C++ users?
>
> The QGIS desktop application is a c++ application which makes heavy
> use of Qt 3d. You may find some useful code in
> https://github.com/qgis/QGIS/tree/master/src/3d.
>
> Nyall
> ___
> Interest mailing list
> Interest@qt-project.org
> https://lists.qt-project.org/listinfo/interest
>
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] Qt3D performance, and development resources

2020-04-14 Thread Nyall Dawson
On Wed, 15 Apr 2020 at 01:51, Charles Martin  wrote:

>  - Where can I find more examples, tutorials and introductory information? 
> There are only two C++ examples on the Qt website, and both of these are very 
> simple. The Qt docs are very limited and incomplete.

There's some good ones here:

https://github.com/wonder-sk/qt3d-experiments

>   - Is there a community of C++ Qt3D developers? Most online material was 
> produced by KADB, is 4 years or older, and focuses on QML. Where are the C++ 
> users?

The QGIS desktop application is a c++ application which makes heavy
use of Qt 3d. You may find some useful code in
https://github.com/qgis/QGIS/tree/master/src/3d.

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


Re: [Interest] Qt3D performance, and development resources

2020-04-14 Thread Oleg Evseev
Hi,

Qt3D performance on Android was my concern a year ago too:
https://bugreports.qt.io/browse/QTBUG-72808 (see also
https://bugreports.qt.io/browse/QTBUG-73057)
especially when Scene3D with multi sampling is used.
Using OnDemand policy improve performance (but almost in stale scenes),
take a look.

I thought that new Underlay compositingMode introduced in 5.14 (
https://doc.qt.io/qt-5/qml-qtquick-scene3d-scene3d.html#compositingMode-prop)
will increase performance twice or even more, but unfortunately I didn't
see any increase at least in our case and hardware. But you can take a look
to it. But just in case, note about bug Scene3D.Underlay + OnDemand
(QTBUG-82861)

About examples.
First of all, take look at Qt 3D examples especially manual tests as Mike
Krus rightly suggested.

I can't be supportive but if you want, you can take a look to several
simple apps I made for test case in bug reports, may be there will be
useful somehow for you. I used Qt3D in C++ inside World3d as the root
object of QML Scene3D (several test examples can be similar in fact).
QTBUG-80092, QTBUG-60612, QTBUG-60429, QTBUG-60183, QTBUG-50720

p.s.
I will also take the opportunity to express here my pains about Qt3D a
little :)
Our project is based on Qt3D and it is really nice and handy, but we stack
with Qt 5.9.5. With some workarounds it get turn out as most stable version
for us, every time we try to move to newer version 5.10, 5.11, 5.12, 5.14
we are always encountered with bugs and crashes. And the most upset that
several of them were repeated in next versions after fixes :(
Unfortunately now I don't have enough time to test and post bugrepost, hope
latter I can help to improve Qt 3d a little. Despite any issues, thank all
Qt developers and community for their work!

---
With regards, Oleg


вт, 14 апр. 2020 г. в 18:50, Charles Martin :

> I’ve been migrating a C++ Coin/Quarter project to Qt3D. I’m doing this on
> a newer iMac/Catalina. The graphics performance seems unacceptable. A
> simple display of 3600 line segments takes about 5 seconds to render and
> 30k segments takes >30 seconds.
>
> When the rendering is started, Qt puts out this warning message:
> qt.qpa.openglcontext: Could not create NSOpenGLContext with shared
> context, falling back to unshared context.
>
> I’m new to Qt3D, and there is a good chance that I’m doing something wrong.
>
> My questions:
>
>   - Shouldn't I see better performance, and what can I try to improve
> that? Does the warning message identify the problem?
>
>  - Where can I find more examples, tutorials and introductory information?
> There are only two C++ examples on the Qt website, and both of these are
> very simple. The Qt docs are very limited and incomplete.
>
>   - Is there a community of C++ Qt3D developers? Most online material was
> produced by KADB, is 4 years or older, and focuses on QML. Where are the
> C++ users?
>
> I’m trying to get some traction with this product, and any guidance is
> really appreciated.
>
> Thanks,
> Charlie
>
>
>
> ___
> Interest mailing list
> Interest@qt-project.org
> https://lists.qt-project.org/listinfo/interest
>
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] Qt3D performance, and development resources

2020-04-14 Thread Mike Krus via Interest
Hi Charlie


> On 14 Apr 2020, at 16:51, Charles Martin  wrote:
> 
> I’ve been migrating a C++ Coin/Quarter project to Qt3D.
Fun. A long time since I used Coin3d. Keep meaning to port it’s scxml based 
camera controller and the manipulators to qt3d.

> I’m doing this on a newer iMac/Catalina. The graphics performance seems 
> unacceptable. A simple display of 3600 line segments takes about 5 seconds to 
> render and 30k segments takes >30 seconds. 
Can you explain how the scene graph is structured? Is each line segment a 
separate entity plus its components? Or just a single entity?

If each line is an object then I would totally expect the kind of performance 
you are getting as each object will result is a draw call. That number of draw 
calls alone will kill performance. 
 
> When the rendering is started, Qt puts out this warning message:
> qt.qpa.openglcontext: Could not create NSOpenGLContext with shared context, 
> falling back to unshared context.
That is odd. Could you explain how you are setting up your window?

> I’m new to Qt3D, and there is a good chance that I’m doing something wrong.
> 
> My questions:
> 
>  - Shouldn't I see better performance, and what can I try to improve that? 
> Does the warning message identify the problem? 
I would say it’s either the number of objects or indeed the fact that context 
are not shared (resulting in lots of context switches). 

Qt3d 5.15 ships which new performance tracking features that may help you 
investigate. See https://www.kdab.com/debugging-profiling-qt-3d-apps/

> - Where can I find more examples, tutorials and introductory information? 
> There are only two C++ examples on the Qt website, and both of these are very 
> simple. The Qt docs are very limited and incomplete.
Qt 3D itself ships with a number of examples. If you look at the Qt 3D source 
code, there’s a number of manual tests which may be of interest. 

KDAB’s GitHub has a qt3d sample project which has other examples, though they 
may be a bit outdated. 

>  - Is there a community of C++ Qt3D developers? Most online material was 
> produced by KADB, is 4 years or older, and focuses on QML. Where are the C++ 
> users?
We are here :)

Please note that although many exemples are in qml, they are still relevant for 
your use case as the APIs are nearly identical. 

> I’m trying to get some traction with this product, and any guidance is really 
> appreciated.
Feel free to get in touch if you need more help. 

Mike

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


Re: [Interest] Qt3D point light intesity

2020-04-11 Thread Megidd Git
Cool, thanks! 

On Sat, Apr 11, 2020 at 9:00 PM Esch Lorenz TU Ilmenau <
lorenz.e...@tu-ilmenau.de> wrote:

> Hi,
>
>
>
> QPointLight inherits from QAbstractLight, which offers setIntensitiy().
> See https://doc.qt.io/qt-5/qt3drender-qabstractlight.html#intensity-prop.
> Hope this helps.
>
>
>
> Cheers,
>
>
>
> Lorenz
>
>
>
> *Von:* Interest  *Im Auftrag von *Megidd
> Git
> *Gesendet:* Samstag, 11. April 2020 11:30
> *An:* interest@qt-project.org
> *Betreff:* [Interest] Qt3D point light intesity
>
>
>
> Hi!
>
>
>
> I'm using point light  in
> a 3D scene with entities of Phong
>  material. I
> just want to be able to increase/decrease point light *intensity*. Point
> light has three properties:
>
>
>
> - constantAttenuation : float
>
> - linearAttenuation : float
>
> - quadraticAttenuation : float
>
>
>
> Documentation mentions that the exact meaning and use of those properties
> is up to the material implementation. Now I wonder how can I simply
> decrease/increase light intensity, considering that I'm using Phong
>  material.
>
>
>
> Thanks
>
> 
>
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] Qt3D point light intesity

2020-04-11 Thread Esch Lorenz TU Ilmenau
Hi,

QPointLight inherits from QAbstractLight, which offers setIntensitiy(). See 
https://doc.qt.io/qt-5/qt3drender-qabstractlight.html#intensity-prop. Hope this 
helps.

Cheers,

Lorenz

Von: Interest  Im Auftrag von Megidd Git
Gesendet: Samstag, 11. April 2020 11:30
An: interest@qt-project.org
Betreff: [Interest] Qt3D point light intesity

Hi!

I'm using point light in a 
3D scene with entities of 
Phong material. I 
just want to be able to increase/decrease point light intensity. Point light 
has three properties:

- constantAttenuation : float
- linearAttenuation : float
- quadraticAttenuation : float

Documentation mentions that the exact meaning and use of those properties is up 
to the material implementation. Now I wonder how can I simply decrease/increase 
light intensity, considering that I'm using 
Phong material.

Thanks

___
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] Transform feedback

2020-02-22 Thread Mike Krus via Interest
Hi

transform feedback is currently not supported by Qt3D’s API. It’s an 
interesting idea though, was wondering quite recently what the API may look 
like, there’s lots of things to setup to control which data should be captured 
and where it should go.

Depending on what you’re doing, you may be better off using compute shaders 
which are fully supported.


Mike

> On 20 Feb 2020, at 12:55, Léo Adam  wrote:
> 
> Hi,
> 
> I am currently working in a medical imaging team on 3D rendering with Qt3D.
> 
> That's why I would need to perform transform feedback, but after looking on 
> internet and in the documentation I didn't find anything.
> 
> So I was wondering if there were any way to do transform feedback in the Qt3D 
> API.
> 
> Thank you,
> 
> Léo Adam.
> ___
> Interest mailing list
> Interest@qt-project.org
> https://lists.qt-project.org/listinfo/interest

—
Mike Krus | mike.k...@kdab.com | Senior Software Engineer
KDAB (UK) Ltd., a KDAB Group company
Tel: UK Office +44 1625 809908   Mobile +44 7833 491941
KDAB - The Qt Experts, C++, 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] Assertion in QAbstractAspect when inserting entity from plugin DLL

2020-02-09 Thread coroberti .
On Sat, Feb 8, 2020 at 6:07 AM Thiago Macieira
 wrote:
>
> On Friday, 7 February 2020 05:52:37 PST Volker Enderlein wrote:
> > Program: C:\Qt\5.14.1\msvc2017_64\bin\Qt5Cored.dll
> > Module: 5.14.1
> > File: aspects\qabstractaspect.cpp
> > Line: 213
> >
> > ASSERT: "metaObj" in file aspects\qabstractaspect.cpp, line 213
>
> MSVC 2017 has serious bug in static initialisation. Microsoft has already
> fixed it. Please upgrade (to 2019).
>
> --
> Thiago Macieira - thiago.macieira (AT) intel.com
>   Software Architect - Intel System Software Products
>

Is it correct to say that Microsoft not released the patch for MSVC 2017?
What is the issue number of link?
Thanks.

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


Re: [Interest] [Qt3D] Assertion in QAbstractAspect when inserting entity from plugin DLL

2020-02-07 Thread Thiago Macieira
On Friday, 7 February 2020 05:52:37 PST Volker Enderlein wrote:
> Program: C:\Qt\5.14.1\msvc2017_64\bin\Qt5Cored.dll
> Module: 5.14.1
> File: aspects\qabstractaspect.cpp
> Line: 213
> 
> ASSERT: "metaObj" in file aspects\qabstractaspect.cpp, line 213

MSVC 2017 has serious bug in static initialisation. Microsoft has already 
fixed it. Please upgrade (to 2019).

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel System Software Products



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


Re: [Interest] [Qt3D] Assertion in QAbstractAspect when inserting entity from plugin DLL

2020-02-07 Thread Mike Krus via Interest
Hi

I can’t say I’ve across such an error before. Can you get a call stack? If you 
set a conditional break point at the assert (based on metaObj being null) then 
it might provide some insight?

Feel free to report it as a bug,

Mike

> On 7 Feb 2020, at 13:52, Volker Enderlein  
> wrote:
> 
> Hello,
> 
> I am facing an error since Qt 5.14 (5.14.0 and 5.14.1) that did not show up 
> in previous versions (tested Qt 5.13.2 and before)
> 
> It is a huge engineering application and I did not manage it up to now to 
> reduce it to a small sample that shows the behaviour.
> 
> When interactively inserting a 3D QEntity (a custom geometry derived from 
> QEntity containing a QGeometryRenderer and some QTransform nodes) from a 
> plugin DLL (created with C++) I am greeted by the following assertion:
> 
> ---
> Microsoft Visual C++ Runtime Library
> ---
> Debug Error!
> 
> Program: C:\Qt\5.14.1\msvc2017_64\bin\Qt5Cored.dll
> Module: 5.14.1
> File: aspects\qabstractaspect.cpp
> Line: 213
> 
> ASSERT: "metaObj" in file aspects\qabstractaspect.cpp, line 213
> 
> (Press Retry to debug the application)
> 
> And the application does not display the graphics component inserted. Other 
> components are shown. I already inspected the output of the logging 
> categories for Qt3D and our plugin DLL but did not succeed up to now in 
> finding the reason for this behaviour.
> 
> Did anyone were facing similar regressions when updating a Qt3D based 
> application Qt 5.14?
> 
> Any help is very much appreciated.
> 
> Cheers, Volker
> 
> ___
> Interest mailing list
> Interest@qt-project.org
> https://lists.qt-project.org/listinfo/interest

—
Mike Krus | mike.k...@kdab.com | Senior Software Engineer
KDAB (UK) Ltd., a KDAB Group company
Tel: UK Office +44 1625 809908   Mobile +44 7833 491941
KDAB - The Qt Experts, C++, 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-18 Thread Oleg Evseev
I think I found internal Qt3D Entity instances that Paul mentioned -
DistanceFieldTextRenderer.
Still have confusion why they are not listed in childNode?

Anyway using recursive property introduced in Qt 5.10 looks like the only
adequate way to use QLayer on QText2DEntity
https://bugreports.qt.io/browse/QTBUG-80092

Thanks for help, Paul.

пн, 18 нояб. 2019 г. в 10:30, Oleg Evseev :

> Got it!
>
> Check it in Qt 5.14, recursive property helps, but why? I'm confused,
> walkEntity explicitly specifies there are no children Entities (and Nodes
> either than QTransform).
> (also there was issues with font size and QText2DEntity size, I don't
> feel the scales of it yet)
>
>
> пн, 18 нояб. 2019 г. в 09:56, Oleg Evseev :
>
>> Hi Paul,
>>
>> Thank for the feedback!
>> Lack of recursive QLayer is the first think I thought of. That's why
>> there is walkEntity function in test example, and it says that there is
>> only one entity - QText2DEntity :
>>
>> Entity: Qt3DExtras::QText2DEntity(0x33a3d4e0) Components:
>> QVector(Qt3DCore::QTransform(0x33a3d580), Qt3DRender::QLayer(0x33a3d310))
>>
>>
>> No internal entities. Also I had checked QText2DEntity source precisely
>> on this aspect and hadn't seen anything.
>>
>>
>> I'm currently using Qt 5.9.5 and don't have recursive property, I will
>> check it in qt 5.14 latter.
>>
>> пн, 18 нояб. 2019 г. в 09:03, Paul Lemire :
>>
>>> 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 
>>> listInterest@qt-project.orghttps://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


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

2019-11-17 Thread Oleg Evseev
Got it!

Check it in Qt 5.14, recursive property helps, but why? I'm confused,
walkEntity explicitly specifies there are no children Entities (and Nodes
either than QTransform).
(also there was issues with font size and QText2DEntity size, I don't feel
the scales of it yet)


пн, 18 нояб. 2019 г. в 09:56, Oleg Evseev :

> Hi Paul,
>
> Thank for the feedback!
> Lack of recursive QLayer is the first think I thought of. That's why there
> is walkEntity function in test example, and it says that there is only one
> entity - QText2DEntity :
>
> Entity: Qt3DExtras::QText2DEntity(0x33a3d4e0) Components:
> QVector(Qt3DCore::QTransform(0x33a3d580), Qt3DRender::QLayer(0x33a3d310))
>
>
> No internal entities. Also I had checked QText2DEntity source precisely on
> this aspect and hadn't seen anything.
>
>
> I'm currently using Qt 5.9.5 and don't have recursive property, I will
> check it in qt 5.14 latter.
>
> пн, 18 нояб. 2019 г. в 09:03, Paul Lemire :
>
>> 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 
>> listInterest@qt-project.orghttps://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


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

2019-11-17 Thread Oleg Evseev
Hi Paul,

Thank for the feedback!
Lack of recursive QLayer is the first think I thought of. That's why there
is walkEntity function in test example, and it says that there is only one
entity - QText2DEntity :

Entity: Qt3DExtras::QText2DEntity(0x33a3d4e0) Components:
QVector(Qt3DCore::QTransform(0x33a3d580), Qt3DRender::QLayer(0x33a3d310))


No internal entities. Also I had checked QText2DEntity source precisely on
this aspect and hadn't seen anything.


I'm currently using Qt 5.9.5 and don't have recursive property, I will
check it in qt 5.14 latter.

пн, 18 нояб. 2019 г. в 09:03, Paul Lemire :

> 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 
> listInterest@qt-project.orghttps://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


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 Multiple color targets not working

2019-08-09 Thread Gil H
Scratch that, forgot to set the item size to fill the window.  Changing that 
fixes it in the standalone example.

 

 

From: Interest  on behalf of Gil H 

Date: Thursday, August 8, 2019 at 11:18 AM
To: Qt Interest 
Subject: Re: [Interest] Qt3D Multiple color targets not working

 

Hi guys, I got it working using Qt3DQuickWindow, but when I tried to integrate 
the same framegraph in my actual implementation (offscreen rendering to FBO 
similar to Scene3D’s code) the texture handles come back as 0.  

 

Attached is my standalone example, modified to use Scene3D to illustrate the 
problem.  It fails to render properly and prints errors about incomplete 
framebuffers.  If you uncomment the other code block in main.cpp, with a 
Qt3DQuickWindow it all works fine.  My use case involves taking each rendered 
texture and drawing it as part of an external custom GL engine.  So, I need 
Qt3D to render multiple textures of different views, and then I need access to 
those GL texture handles for manually drawing them onto a different frame 
buffer.

 

I know Scene3D creates its own FBO, but after digging through Qt source, I 
still don’t understand how that interacts with QRenderTarget nodes in the frame 
graph.  It is “illegal” to have this kind of graph with Scene3D? 

 

Thanks!

 

Gil

 

 

 

From: Interest  on behalf of Gil H 

Date: Wednesday, August 7, 2019 at 9:46 AM
To: Qt Interest 
Subject: Re: [Interest] Qt3D Multiple color targets not working

 

Thanks Sean.  I had that framegraph set up, but I was trying to use a single 
RenderTarget with multiple textures attached for all the rendering, instead of 
what ended up working more easily, which was to simply create a separate 
RenderTarget for each sub-graph and just attach the textures to color0.  

 

 

From: Interest  on behalf of Sean Harmer 

Date: Wednesday, August 7, 2019 at 4:40 AM
To: Qt Interest 
Subject: Re: [Interest] Qt3D Multiple color targets not working

 

Hi Gil,

With an FBO with multiple textures attached each texture will still have the 
same pixels rasterised. You can't draw different cameras and scenes into each 
texture at the same time. Well something like that can be done with some 
advanced use of the geometry shader but I don't think that's the case here.

If you want to draw 3 different scenes into 3 different textures you will need 
3 different sub-trees in your framegraph. Each one will set the camera to use, 
the filters to select the subset of the scene graph to draw and the FBO with 
the target texture to render into.

Cheers,

Sean

On 01/08/2019 18:42, 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
___ Interest mailing list 
Interest@qt-project.org https://lists.qt-project.org/listinfo/interest 

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

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

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


Re: [Interest] Qt3D Multiple color targets not working

2019-08-08 Thread Gil H
Hi guys, I got it working using Qt3DQuickWindow, but when I tried to integrate 
the same framegraph in my actual implementation (offscreen rendering to FBO 
similar to Scene3D’s code) the texture handles come back as 0.  

 

Attached is my standalone example, modified to use Scene3D to illustrate the 
problem.  It fails to render properly and prints errors about incomplete 
framebuffers.  If you uncomment the other code block in main.cpp, with a 
Qt3DQuickWindow it all works fine.  My use case involves taking each rendered 
texture and drawing it as part of an external custom GL engine.  So, I need 
Qt3D to render multiple textures of different views, and then I need access to 
those GL texture handles for manually drawing them onto a different frame 
buffer.

 

I know Scene3D creates its own FBO, but after digging through Qt source, I 
still don’t understand how that interacts with QRenderTarget nodes in the frame 
graph.  It is “illegal” to have this kind of graph with Scene3D? 

 

Thanks!

 

Gil

 

 

 

 

From: Interest  on behalf of Gil H 

Date: Wednesday, August 7, 2019 at 9:46 AM
To: Qt Interest 
Subject: Re: [Interest] Qt3D Multiple color targets not working

 

Thanks Sean.  I had that framegraph set up, but I was trying to use a single 
RenderTarget with multiple textures attached for all the rendering, instead of 
what ended up working more easily, which was to simply create a separate 
RenderTarget for each sub-graph and just attach the textures to color0.  

 

 

From: Interest  on behalf of Sean Harmer 

Date: Wednesday, August 7, 2019 at 4:40 AM
To: Qt Interest 
Subject: Re: [Interest] Qt3D Multiple color targets not working

 

Hi Gil,

With an FBO with multiple textures attached each texture will still have the 
same pixels rasterised. You can't draw different cameras and scenes into each 
texture at the same time. Well something like that can be done with some 
advanced use of the geometry shader but I don't think that's the case here.

If you want to draw 3 different scenes into 3 different textures you will need 
3 different sub-trees in your framegraph. Each one will set the camera to use, 
the filters to select the subset of the scene graph to draw and the FBO with 
the target texture to render into.

Cheers,

Sean

On 01/08/2019 18:42, 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
___ Interest mailing list 
Interest@qt-project.org https://lists.qt-project.org/listinfo/interest 

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

<>
___
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 Gil H
Thanks Sean.  I had that framegraph set up, but I was trying to use a single 
RenderTarget with multiple textures attached for all the rendering, instead of 
what ended up working more easily, which was to simply create a separate 
RenderTarget for each sub-graph and just attach the textures to color0.  

 

 

From: Interest  on behalf of Sean Harmer 

Date: Wednesday, August 7, 2019 at 4:40 AM
To: Qt Interest 
Subject: Re: [Interest] Qt3D Multiple color targets not working

 

Hi Gil,

With an FBO with multiple textures attached each texture will still have the 
same pixels rasterised. You can't draw different cameras and scenes into each 
texture at the same time. Well something like that can be done with some 
advanced use of the geometry shader but I don't think that's the case here.

If you want to draw 3 different scenes into 3 different textures you will need 
3 different sub-trees in your framegraph. Each one will set the camera to use, 
the filters to select the subset of the scene graph to draw and the FBO with 
the target texture to render into.

Cheers,

Sean

On 01/08/2019 18:42, 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
___ Interest mailing list 
Interest@qt-project.org https://lists.qt-project.org/listinfo/interest 

___
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 Gil H
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 
Date: Wednesday, August 7, 2019 at 3:03 AM
To: Gil H , Qt Interest 
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 
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

___
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 Sean Harmer

Hi Gil,

With an FBO with multiple textures attached each texture will still have 
the same pixels rasterised. You can't draw different cameras and scenes 
into each texture at the same time. Well something like that can be done 
with some advanced use of the geometry shader but I don't think that's 
the case here.


If you want to draw 3 different scenes into 3 different textures you 
will need 3 different sub-trees in your framegraph. Each one will set 
the camera to use, the filters to select the subset of the scene graph 
to draw and the FBO with the target texture to render into.


Cheers,

Sean

On 01/08/2019 18:42, 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
___
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 <mailto:Interest@qt-project.org>
>
> https://lists.qt-project.org/listinfo/interest
>
> -- 
> Paul Lemire | paul.lem...@kdab.com <mailto: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 Multiple color targets not working

2019-08-06 Thread Gil H
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


Re: [Interest] Qt3D Multiple color targets not working

2019-08-05 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] Render depth images

2019-06-19 Thread Grimm, Raphael (IAR)
Hi,
thanks for the hint.
Now I got several QTexture2D, but how can I access their data buffer
directly?
I did not see any function giving me access to some data buffer (but maybe I
am just blind).

In my application I do not want to display the images and need the precise
depth data (so the full floating point number).
In the best case I do not even want to have some window, the qt signal loop
or even requiring to be in a thread with a qt object tree  (the last two are
probably impossible).

Any tips on accessing the data buffer would be appreciated.

Raphael

-Original Message-
From: Paul Lemire  
Sent: Tuesday, 11 June, 2019 16:25
To: Grimm, Raphael (IAR) ; interest@qt-project.org
Subject: Re: [Interest] [Qt3D] Render depth images

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 <mailto: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] 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] What are active render targets for a ScreenRayCaster?

2019-03-28 Thread Volker Enderlein

Hi Mike,

thanks a lot for your valuable clarifications. When talking about the 
main area you mean the area where the three cameras overlap (two 
orthographic and one perspective)? I always get three hitsChanged 
signals emitted in this area, no matter where I click onto.

I see if I can put up a simple example that shows the mentioned behaviour.

Cheers, Volker

Am 28.03.2019 um 14:35 schrieb Mike Krus:

Hi Volker

if I remember correctly, ray casting will apply to all enabled surfaces. It’ll 
ignore off screen surfaces and surfaces where the cursor is outside the render 
area. I think it also ignores surfaces when an orthographic camera is used.

So in your case sounds like you should only get a single hit in the main area, 
and two when testing in the render areas.

5.13 is introducing a QNoPicking frame graph node to explicitly disable picking 
and ray casting on portions of the frame graph.
  
If you continue having issues with this, please create a JIRA ticket, ideally with a small example.


Regards,
Mike


On 28 Mar 2019, at 11:13, Volker Enderlein  
wrote:

Hi,

The KDAB article 
https://www.kdab.com/new-in-qt-3d-5-11-generalized-ray-casting/ states that the 
ScreeenRayCast test is performed for every active render target. I just 
stumbled over the question what an active render target is considered for a 
ScreenRayCaster.

My FrameGraph contains an orthographic background viewport/camera, a SceneGraph 
viewport/camera and an orthographic overlay viewport/camera that fill the 
entire normalized viewport.

Additionally two smaller viewport/camera exist at the bottom of the window for 
an axis gnomon and a fps counter.

When triggering a ScreenRayCaster test with the current mouse position the 
hitsChanged signal is emitted multiple times with different hits.

Traversing the scenegraph upwards from the hitted entity (mostly a 
DistanceFieldTextRenderer is hit) leads me to entities that let me doubt on the 
returned hit.


Anyone out there who can shed some light on it? Thanks in advance.


Cheers, Volker

--

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

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



--

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


Re: [Interest] Qt3D: Support for loading binary glTF 2.0 files (*.glb)

2019-03-26 Thread Marcin Musial
Thank you for your quick reponses.

On Tue, Mar 26, 2019, 09:53 Sean Harmer via Interest <
interest@qt-project.org> wrote:

> Hi,
>
> We're working on complete glTF 2 support in Kuesa which is built on top of
> Qt 3D here:
>
> https://github.com/KDAB/kuesa
>
> Binary support is one of the next things on the backlog. Other missing
> features at present are morph target animations and multiple texture
> coordinate sets. These are planned for our next sprint.
>
> Cheers,
>
> Sean
> On 25/03/2019 22:29, Marcin Musial wrote:
>
> Hi,
>
> Are there any plans for 5.13 to support loading also binary glTF 2.0 files
> (*.glb)? Qt3DRender::QSceneLoader is expecting JSON glTF text files only.
>
> ___
> Interest mailing 
> listInterest@qt-project.orghttps://lists.qt-project.org/listinfo/interest
>
> --
> Dr Sean Harmer | sean.har...@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@qt-project.org
> https://lists.qt-project.org/listinfo/interest
>
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] Qt3D: Support for loading binary glTF 2.0 files (*.glb)

2019-03-26 Thread Sean Harmer via Interest

Hi,

We're working on complete glTF 2 support in Kuesa which is built on top 
of Qt 3D here:


https://github.com/KDAB/kuesa

Binary support is one of the next things on the backlog. Other missing 
features at present are morph target animations and multiple texture 
coordinate sets. These are planned for our next sprint.


Cheers,

Sean

On 25/03/2019 22:29, Marcin Musial wrote:

Hi,

Are there any plans for 5.13 to support loading also binary glTF 2.0 
files (*.glb)? Qt3DRender::QSceneLoader is expecting JSON glTF text 
files only.


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


--
Dr Sean Harmer | sean.har...@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@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] Qt3D: Support for loading binary glTF 2.0 files (*.glb)

2019-03-26 Thread Oleg Evseev
Hi,

I don't know about *.gl, but maybe you will be able to find related
information in glTF 2.0 support discussion
https://bugreports.qt.io/browse/QTBUG-61258 if you haven't seen it yet.

вт, 26 мар. 2019 г. в 01:30, Marcin Musial :

> Hi,
>
> Are there any plans for 5.13 to support loading also binary glTF 2.0 files
> (*.glb)? Qt3DRender::QSceneLoader is expecting JSON glTF text files only.
> ___
> Interest mailing list
> Interest@qt-project.org
> https://lists.qt-project.org/listinfo/interest
>
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] Qt3D setting LineWidth per GeometryRenderer/Entity

2019-02-06 Thread Volker Enderlein
Thanks Mike and Sean for your valuable input. It helps me to shape my 
solution.


Cheers, Volker

Am 06.02.2019 um 09:56 schrieb Mike Krus:

Hi

you should be able to control that using a  QLineWidth render state. And yes, 
that would require custom material or frame graph.

The raycasting-qml manual test that ships with Qt3D shows an example of 
creating a simple flat shading material for lines, would be easy to add line 
width control to that…


Mike



On 6 Feb 2019, at 08:20, Volker Enderlein  
wrote:

Hi all,


is it possible to set the LineWidth of a GeometryRenderer of primitive tpye 
Lines or do I need a Custom Material/Effect/FrameGraph node to achieve this?

Thanks for enlightening.


Cheers, Volker

--

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

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



--

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


Re: [Interest] Qt3D setting LineWidth per GeometryRenderer/Entity

2019-02-06 Thread Mike Krus via Interest
Hi

you should be able to control that using a  QLineWidth render state. And yes, 
that would require custom material or frame graph.

The raycasting-qml manual test that ships with Qt3D shows an example of 
creating a simple flat shading material for lines, would be easy to add line 
width control to that…


Mike


> On 6 Feb 2019, at 08:20, Volker Enderlein  
> wrote:
> 
> Hi all,
> 
> 
> is it possible to set the LineWidth of a GeometryRenderer of primitive tpye 
> Lines or do I need a Custom Material/Effect/FrameGraph node to achieve this?
> 
> Thanks for enlightening.
> 
> 
> Cheers, Volker
> 
> -- 
> 
> ___
> Interest mailing list
> Interest@qt-project.org
> https://lists.qt-project.org/listinfo/interest

--
Mike Krus | mike.k...@kdab.com | Senior Software Engineer
KDAB (UK) Ltd., a KDAB Group company
Tel: UK Office +44 1625 809908   Mobile +44 7833 491941
KDAB - The Qt Experts, C++, 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 setting LineWidth per GeometryRenderer/Entity

2019-02-06 Thread Mike Krus via Interest
Hi

you should be able to control that using a  QLineWidth render state. And yes, 
that would require custom material or frame graph.

The raycasting-qml manual test that ships with Qt3D shows an example of 
creating a simple flat shading material for lines, would be easy to add line 
width control to that…


Mike


> On 6 Feb 2019, at 08:20, Volker Enderlein  
> wrote:
> 
> Hi all,
> 
> 
> is it possible to set the LineWidth of a GeometryRenderer of primitive tpye 
> Lines or do I need a Custom Material/Effect/FrameGraph node to achieve this?
> 
> Thanks for enlightening.
> 
> 
> Cheers, Volker
> 
> -- 
> 
> ___
> Interest mailing list
> Interest@qt-project.org
> https://lists.qt-project.org/listinfo/interest

--
Mike Krus | mike.k...@kdab.com | Senior Software Engineer
KDAB (UK) Ltd., a KDAB Group company
Tel: UK Office +44 1625 809908   Mobile +44 7833 491941
KDAB - The Qt Experts, C++, 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 setting LineWidth per GeometryRenderer/Entity

2019-02-06 Thread Sean Harmer

Hi,

At present I think using a material per entity is the easiest way to 
achieve this. Make an effect that you can share between all your 
wireframe material instances and then "override" the line width in the 
state set. I think that should work.


Cheers,

Sean

On 06/02/2019 08:20, Volker Enderlein wrote:

Hi all,


is it possible to set the LineWidth of a GeometryRenderer of primitive 
tpye Lines or do I need a Custom Material/Effect/FrameGraph node to 
achieve this?


Thanks for enlightening.


Cheers, Volker

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


Re: [Interest] Qt3D viewAll/viewEntity

2019-02-06 Thread Mike Krus via Interest
Hi

it’s mostly an oversight. The current calculations are only valid for 
perspective projection but it would possible to add separate code path for 
orthogonal projection. Not sure about the generalised project matrix…

Please file a JIRA ticket if it’s something you’re interested in.

Of course, contributions are more than welcome :)


Mike

> On 6 Feb 2019, at 08:17, Volker Enderlein  
> wrote:
> 
> Hi all,
> 
> why does the viewAll and viewEntity commands of QCamera only work in 
> PerspectiveProjection type?
> 
> Thanks for enlightening.
> 
> Cheers, Volker
> 
> -- 
> 
> ___
> Interest mailing list
> Interest@qt-project.org
> https://lists.qt-project.org/listinfo/interest

--
Mike Krus | mike.k...@kdab.com | Senior Software Engineer
KDAB (UK) Ltd., a KDAB Group company
Tel: UK Office +44 1625 809908   Mobile +44 7833 491941
KDAB - The Qt Experts, C++, 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: Rendering issues with custom effects

2019-01-09 Thread Mike Krus via Interest
Hi

any chance you could try a more recent version? Lots of fixes since then…


Mike

> On 9 Jan 2019, at 10:59, Volker Enderlein  
> wrote:
> 
> Hi,
> 
> 
> 
> I am facing some rendering issues with custom effects in Qt3d. To mark some 
> of the entities selected I replace the existing material effect of an entity 
> with a newly created instance of a wireframe effect. When using the 
> robustwireframe shaders sometimes (but not always, it does not seem to be 
> reproducible) on some entities the underlying color (phong shading model) is 
> not set properly. 
> 
> I tried different shaders (also tried to set the fragment color directly) but 
> the result does not change: sometimes I see those rendering issues. 
> 
> And in some cases the following message is written to the console: 
> 
> QPainter::begin: Paint device returned engine == 0, type: 3
> QPainter::setCompositionMode: Painter not active
> QPainter::end: Painter not active, aborted
> 
> So I'm guessing, setting the custom QEffect causes some issues.
> 
> My question is: Should I avoid creating many instances of a custom wireframe 
> effect and reuse one instance for all selected entities or should I create a 
> separate instance for every entity (material)?
> 
>  
> 
> The left part of the image shows the wrong behaviour, the right part is the 
> expected rendering. 
> 
> Platform specs: Windows 7 x64, Visual Studio 2015, Qt 5.10.0, Qt3D 
> 
> Graphics specs: NVidia GeForce GTX 750 Ti/PCIe/SSE2, OpenGL 4.6.0 NVIDIA 
> 391.35
> 
> 
> 
> The definition of the effect is as follows:
> 
> 
> 
> WireFrameEffect::WireFrameEffect(Qt3DCore::QNode* parent/* = nullptr*/)
> : Qt3DRender::QEffect(parent)
> {
> addParameter(new Qt3DRender::QParameter(QStringLiteral("ka"), 
> QVector4D(0.1f, 0.1f, 0.1f, 1.0f)));
> addParameter(new Qt3DRender::QParameter(QStringLiteral("kd"), 
> QVector4D(0.7f, 0.7f, 0.7f, 1.0f)));
> addParameter(new Qt3DRender::QParameter(QStringLiteral("ks"), 
> QVector4D(0.95f, 0.95f, 0.95f, 1.0f)));
> addParameter(new Qt3DRender::QParameter(QStringLiteral("ke"), 
> QVector4D(0.0f, 0.0f, 0.0f, 1.0f)));
> addParameter(new Qt3DRender::QParameter(QStringLiteral("shininess"), 
> 128.0f));
> 
> addParameter(new 
> Qt3DRender::QParameter(QStringLiteral("light.position"), QVector4D(0.0f, 
> 0.0f, 0.0f, 1.0f)));
> addParameter(new 
> Qt3DRender::QParameter(QStringLiteral("light.intensity"), QVector3D(1.0f, 
> 1.0f, 1.0f)));
> addParameter(new Qt3DRender::QParameter(QStringLiteral("line.width"), 
> 1.0f));
> addParameter(new Qt3DRender::QParameter(QStringLiteral("line.color"), 
> QVector4D(1.0f, 1.0f, 1.0f, 1.0f)));
> 
> auto technique = new Qt3DRender::QTechnique;
> {
> auto graphicsApiFilter = technique->graphicsApiFilter();
> 
> graphicsApiFilter->setApi(Qt3DRender::QGraphicsApiFilter::Api::OpenGL);
> 
> graphicsApiFilter->setProfile(Qt3DRender::QGraphicsApiFilter::OpenGLProfile::CoreProfile);
> graphicsApiFilter->setMajorVersion(3);
> graphicsApiFilter->setMinorVersion(1);
> 
> auto filterKey = new Qt3DRender::QFilterKey;
> filterKey->setName(QStringLiteral("renderingStyle"));
> filterKey->setValue(QStringLiteral("forward"));
> technique->addFilterKey(filterKey);
> 
> auto renderPass = new Qt3DRender::QRenderPass;
> {
> auto shaderProgram = new Qt3DRender::QShaderProgram;
> 
> shaderProgram->setVertexShaderCode(shaderProgram->loadSource(QUrl(QStringLiteral("qrc:/shaders/robustwireframe.vert";
> 
> shaderProgram->setGeometryShaderCode(shaderProgram->loadSource(QUrl(QStringLiteral("qrc:/shaders/robustwireframe.geom";
> 
> shaderProgram->setFragmentShaderCode(shaderProgram->loadSource(QUrl(QStringLiteral("qrc:/shaders/robustwireframe.frag";
> renderPass->setShaderProgram(shaderProgram);
> }
> technique->addRenderPass(renderPass);
> }
> addTechnique(technique);
> }
> 
> 
> Thanks in advance,
> 
> Cheers Volker
> 
> -- 
> 
> ___
> Interest mailing list
> Interest@qt-project.org
> https://lists.qt-project.org/listinfo/interest

--
Mike Krus | mike.k...@kdab.com | Senior Software Engineer
KDAB (UK) Ltd., a KDAB Group company
Tel: UK Office +44 1625 809908   Mobile +44 7833 491941
KDAB - The Qt Experts, C++, 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][Android] Weird different performance on almost same class GPUs

2019-01-01 Thread Oleg Evseev
 I've tested another tablet, made test app and summarized all results I
have in bug report:
https://bugreports.qt.io/browse/QTBUG-72808

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


Re: [Interest] Qt3D How to draw 2D-Text always facing the Camera

2018-12-19 Thread david crémoux
Then I would stay with the first solution I proposed, it will be more 
flexible in your case: regular text2dentity with custom frame graph 
branch and custom camera.


There is just one thing to be aware about the text2dentity, the entity 
doesn't do the rendering itself: it contains another entity which is 
taking card of the rendering (DistanceFieldTextRenderer).
So if you use a layer filter and attach it to the text2dentity, you 
should set it to be recursive to affect the rendering child entity.
Moreover this "rendering" entity set by default some render states, like 
the depth test, which may be boring to achieve the exact rendering you 
want (in my case it is ...).


david

On 19-Dec-18 11:14, Volker Enderlein wrote:
The number of Text2D elements is not known in advance and may differ. 
It's a simulation environment, where some textual information is added 
to a fairly high number of elements.
To avoid the data management for different kinds of entities my first 
idea was to create a specialized Text2d  entity that handles all the 
gory details in a custom material and provides an option to always face 
the camera.


Cheers Volker

Am 19.12.2018 um 08:37 schrieb david crémoux:

You're welcome.

I will most probably have to implement the same feature in a near 
future for the project I'm currently working on.


If making the custom camera is too much complex, there is a more basic 
way but involving more data management (depending on how much 2d text 
entities you have to display):
You still use a specific frame graph branch with a layer filter but 
with an identity camera.
Then you attach all your 2d text entities to your scene root entity 
and you update their transform/position on every camera transform/move.


david

On 19-Dec-18 10:05, Volker Enderlein wrote:

Hi David,

thanks for the answer. I wasn't thinking of that, as my knowledge 
about framegraphs is very limited. But this helps me further.


Cheers Volker

Am 18.12.2018 um 14:53 schrieb david crémoux:

Hello Volker,

I guess you can achieve it with regular QText2DEntity, with a 
specific frame graph branch in your rendering for your 2d text, a 
layer filter and a custom camera (based on your main camera).


david

On 18-Dec-18 14:37, Volker Enderlein wrote:

Hi all,

when building a rather complex Qt3D-Scene I needed some 2D-Text 
that has a 3D position, is always facing the camera, and fixed in 
size, independent of the camera settings.


While looking over the components provided by Qt3D I stumbled 
across Text2DEntity and thought about how it can be tweaked ot 
fulfill my requirements.


As all my requirements can be done inside a shader I thought about 
whether the QText2DMaterial that is used inside the class can be 
replaced by a custom material. But unfortunately the material is 
not accessible from outside.


Text2DEntity can be embedded in another class that applies the 
camera information to it, but is there an easier solution to this 
problem?


Cheers Volker






___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/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 How to draw 2D-Text always facing the Camera

2018-12-19 Thread Volker Enderlein
The number of Text2D elements is not known in advance and may differ. 
It's a simulation environment, where some textual information is added 
to a fairly high number of elements.
To avoid the data management for different kinds of entities my first 
idea was to create a specialized Text2d  entity that handles all the 
gory details in a custom material and provides an option to always face 
the camera.


Cheers Volker

Am 19.12.2018 um 08:37 schrieb david crémoux:

You're welcome.

I will most probably have to implement the same feature in a near 
future for the project I'm currently working on.


If making the custom camera is too much complex, there is a more basic 
way but involving more data management (depending on how much 2d text 
entities you have to display):
You still use a specific frame graph branch with a layer filter but 
with an identity camera.
Then you attach all your 2d text entities to your scene root entity 
and you update their transform/position on every camera transform/move.


david

On 19-Dec-18 10:05, Volker Enderlein wrote:

Hi David,

thanks for the answer. I wasn't thinking of that, as my knowledge 
about framegraphs is very limited. But this helps me further.


Cheers Volker

Am 18.12.2018 um 14:53 schrieb david crémoux:

Hello Volker,

I guess you can achieve it with regular QText2DEntity, with a 
specific frame graph branch in your rendering for your 2d text, a 
layer filter and a custom camera (based on your main camera).


david

On 18-Dec-18 14:37, Volker Enderlein wrote:

Hi all,

when building a rather complex Qt3D-Scene I needed some 2D-Text 
that has a 3D position, is always facing the camera, and fixed in 
size, independent of the camera settings.


While looking over the components provided by Qt3D I stumbled 
across Text2DEntity and thought about how it can be tweaked ot 
fulfill my requirements.


As all my requirements can be done inside a shader I thought about 
whether the QText2DMaterial that is used inside the class can be 
replaced by a custom material. But unfortunately the material is 
not accessible from outside.


Text2DEntity can be embedded in another class that applies the 
camera information to it, but is there an easier solution to this 
problem?


Cheers Volker





--

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


Re: [Interest] Qt3D How to draw 2D-Text always facing the Camera

2018-12-18 Thread david crémoux

You're welcome.

I will most probably have to implement the same feature in a near future 
for the project I'm currently working on.


If making the custom camera is too much complex, there is a more basic 
way but involving more data management (depending on how much 2d text 
entities you have to display):
You still use a specific frame graph branch with a layer filter but with 
an identity camera.
Then you attach all your 2d text entities to your scene root entity and 
you update their transform/position on every camera transform/move.


david

On 19-Dec-18 10:05, Volker Enderlein wrote:

Hi David,

thanks for the answer. I wasn't thinking of that, as my knowledge about 
framegraphs is very limited. But this helps me further.


Cheers Volker

Am 18.12.2018 um 14:53 schrieb david crémoux:

Hello Volker,

I guess you can achieve it with regular QText2DEntity, with a specific 
frame graph branch in your rendering for your 2d text, a layer filter 
and a custom camera (based on your main camera).


david

On 18-Dec-18 14:37, Volker Enderlein wrote:

Hi all,

when building a rather complex Qt3D-Scene I needed some 2D-Text that 
has a 3D position, is always facing the camera, and fixed in size, 
independent of the camera settings.


While looking over the components provided by Qt3D I stumbled across 
Text2DEntity and thought about how it can be tweaked ot fulfill my 
requirements.


As all my requirements can be done inside a shader I thought about 
whether the QText2DMaterial that is used inside the class can be 
replaced by a custom material. But unfortunately the material is not 
accessible from outside.


Text2DEntity can be embedded in another class that applies the camera 
information to it, but is there an easier solution to this problem?


Cheers Volker




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


Re: [Interest] Qt3D How to draw 2D-Text always facing the Camera

2018-12-18 Thread Volker Enderlein

Hi David,

thanks for the answer. I wasn't thinking of that, as my knowledge about 
framegraphs is very limited. But this helps me further.


Cheers Volker

Am 18.12.2018 um 14:53 schrieb david crémoux:

Hello Volker,

I guess you can achieve it with regular QText2DEntity, with a specific 
frame graph branch in your rendering for your 2d text, a layer filter 
and a custom camera (based on your main camera).


david

On 18-Dec-18 14:37, Volker Enderlein wrote:

Hi all,

when building a rather complex Qt3D-Scene I needed some 2D-Text that 
has a 3D position, is always facing the camera, and fixed in size, 
independent of the camera settings.


While looking over the components provided by Qt3D I stumbled across 
Text2DEntity and thought about how it can be tweaked ot fulfill my 
requirements.


As all my requirements can be done inside a shader I thought about 
whether the QText2DMaterial that is used inside the class can be 
replaced by a custom material. But unfortunately the material is not 
accessible from outside.


Text2DEntity can be embedded in another class that applies the camera 
information to it, but is there an easier solution to this problem?


Cheers Volker



--

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


Re: [Interest] Qt3D How to draw 2D-Text always facing the Camera

2018-12-18 Thread Jason H
I don't know anything about Qt3D, but in 3D parlance, they are called "sprites"

https://www.kdab.com/new-in-qt-5-10-texture-based-animations-in-qt-3d/
https://doc.qt.io/qt-5.11/qt3dextras-qspritesheet.html


> Sent: Tuesday, December 18, 2018 at 6:37 AM
> From: "Volker Enderlein" 
> To: interest@qt-project.org
> Subject: [Interest] Qt3D How to draw 2D-Text always facing the Camera
>
> Hi all,
> 
> when building a rather complex Qt3D-Scene I needed some 2D-Text that has 
> a 3D position, is always facing the camera, and fixed in size, 
> independent of the camera settings.
> 
> While looking over the components provided by Qt3D I stumbled across 
> Text2DEntity and thought about how it can be tweaked ot fulfill my 
> requirements.
> 
> As all my requirements can be done inside a shader I thought about 
> whether the QText2DMaterial that is used inside the class can be 
> replaced by a custom material. But unfortunately the material is not 
> accessible from outside.
> 
> Text2DEntity can be embedded in another class that applies the camera 
> information to it, but is there an easier solution to this problem?
> 
> Cheers Volker
> 
> -- 
> 
> ___
> Interest mailing list
> Interest@qt-project.org
> https://lists.qt-project.org/listinfo/interest
> 
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] Qt3D How to draw 2D-Text always facing the Camera

2018-12-18 Thread Philip Schuchardt
If you rendering in QtQuick you can use a Text{} item and project it's
position into screen space.

On Tue, Dec 18, 2018 at 10:46 AM Volker Enderlein <
volker.enderl...@ifm-chemnitz.de> wrote:

> Hi Oleg,
>
> thank you so much for your comment. I saw your entry in the bug tracker
> and therefore I tried to go the way with the custom material.
> Unfortunately I cannot access the underlying material definition of the
> utility classes that are used to render the text in Text2DEntity. As
> they are all private and not exported from Qt DLLs I would need to copy
> them, but that's something I would really try to avoid. The custom
> material part was straight forward, based on your bug report and on a
> previous implementation of a specialized material definition.
> But now I'm stuck with the missing access.
>
> Cheers Volker
>
> Am 18.12.2018 um 13:38 schrieb Oleg Evseev:
> > Hi Volker,
> >
> > Yes, you have to add custom material because
> > Qt3DRender::QShaderProgram s of default materials are inside private
> > class, so you can't change shaders' code source.
> >
> > Take a look at https://codereview.qt-project.org/#/c/182053/ (that was
> > for including in qt 3d, but you could easily use it as custom material
> > in your own app) and adopt it accordingly to Text2DMaterial.
> >
> > ---
> > With regards, Oleg
> >
> > вт, 18 дек. 2018 г. в 15:07, Volker Enderlein
> >  > >:
> >
> > Hi all,
> >
> > when building a rather complex Qt3D-Scene I needed some 2D-Text
> > that has
> > a 3D position, is always facing the camera, and fixed in size,
> > independent of the camera settings.
> >
> > While looking over the components provided by Qt3D I stumbled across
> > Text2DEntity and thought about how it can be tweaked ot fulfill my
> > requirements.
> >
> > As all my requirements can be done inside a shader I thought about
> > whether the QText2DMaterial that is used inside the class can be
> > replaced by a custom material. But unfortunately the material is not
> > accessible from outside.
> >
> > Text2DEntity can be embedded in another class that applies the camera
> > information to it, but is there an easier solution to this problem?
> >
> > Cheers Volker
> >
> > --
> >
> > ___
> > Interest mailing list
> > Interest@qt-project.org 
> > https://lists.qt-project.org/listinfo/interest
> >
>
> --
>
> ___
> Interest mailing list
> Interest@qt-project.org
> https://lists.qt-project.org/listinfo/interest
>
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] Qt3D How to draw 2D-Text always facing the Camera

2018-12-18 Thread Volker Enderlein

Hi Oleg,

thank you so much for your comment. I saw your entry in the bug tracker 
and therefore I tried to go the way with the custom material. 
Unfortunately I cannot access the underlying material definition of the 
utility classes that are used to render the text in Text2DEntity. As 
they are all private and not exported from Qt DLLs I would need to copy 
them, but that's something I would really try to avoid. The custom 
material part was straight forward, based on your bug report and on a 
previous implementation of a specialized material definition.

But now I'm stuck with the missing access.

Cheers Volker

Am 18.12.2018 um 13:38 schrieb Oleg Evseev:

Hi Volker,

Yes, you have to add custom material because 
Qt3DRender::QShaderProgram s of default materials are inside private 
class, so you can't change shaders' code source.


Take a look at https://codereview.qt-project.org/#/c/182053/ (that was 
for including in qt 3d, but you could easily use it as custom material 
in your own app) and adopt it accordingly to Text2DMaterial.


---
With regards, Oleg

вт, 18 дек. 2018 г. в 15:07, Volker Enderlein 
>:


Hi all,

when building a rather complex Qt3D-Scene I needed some 2D-Text
that has
a 3D position, is always facing the camera, and fixed in size,
independent of the camera settings.

While looking over the components provided by Qt3D I stumbled across
Text2DEntity and thought about how it can be tweaked ot fulfill my
requirements.

As all my requirements can be done inside a shader I thought about
whether the QText2DMaterial that is used inside the class can be
replaced by a custom material. But unfortunately the material is not
accessible from outside.

Text2DEntity can be embedded in another class that applies the camera
information to it, but is there an easier solution to this problem?

Cheers Volker

-- 


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



--

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


Re: [Interest] Qt3D How to draw 2D-Text always facing the Camera

2018-12-18 Thread david crémoux

Hello Volker,

I guess you can achieve it with regular QText2DEntity, with a specific 
frame graph branch in your rendering for your 2d text, a layer filter 
and a custom camera (based on your main camera).


david

On 18-Dec-18 14:37, Volker Enderlein wrote:

Hi all,

when building a rather complex Qt3D-Scene I needed some 2D-Text that has 
a 3D position, is always facing the camera, and fixed in size, 
independent of the camera settings.


While looking over the components provided by Qt3D I stumbled across 
Text2DEntity and thought about how it can be tweaked ot fulfill my 
requirements.


As all my requirements can be done inside a shader I thought about 
whether the QText2DMaterial that is used inside the class can be 
replaced by a custom material. But unfortunately the material is not 
accessible from outside.


Text2DEntity can be embedded in another class that applies the camera 
information to it, but is there an easier solution to this problem?


Cheers Volker


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


Re: [Interest] Qt3D How to draw 2D-Text always facing the Camera

2018-12-18 Thread Oleg Evseev
Hi Volker,

Yes, you have to add custom material because Qt3DRender::QShaderProgram s
of default materials are inside private class, so you can't change shaders'
code source.

Take a look at https://codereview.qt-project.org/#/c/182053/ (that was for
including in qt 3d, but you could easily use it as custom material in your
own app) and adopt it accordingly to Text2DMaterial.

---
With regards, Oleg

вт, 18 дек. 2018 г. в 15:07, Volker Enderlein <
volker.enderl...@ifm-chemnitz.de>:

> Hi all,
>
> when building a rather complex Qt3D-Scene I needed some 2D-Text that has
> a 3D position, is always facing the camera, and fixed in size,
> independent of the camera settings.
>
> While looking over the components provided by Qt3D I stumbled across
> Text2DEntity and thought about how it can be tweaked ot fulfill my
> requirements.
>
> As all my requirements can be done inside a shader I thought about
> whether the QText2DMaterial that is used inside the class can be
> replaced by a custom material. But unfortunately the material is not
> accessible from outside.
>
> Text2DEntity can be embedded in another class that applies the camera
> information to it, but is there an easier solution to this problem?
>
> Cheers Volker
>
> --
>
> ___
> Interest mailing list
> Interest@qt-project.org
> https://lists.qt-project.org/listinfo/interest
>
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


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

2018-11-13 Thread Philip Schuchardt
Yea, it would be really useful to have more add/remove signals. I think
having a way to see if QNode are added/removed to another QNode. There's
currently no way to see if the QNode tree has been modified structurally at
the moment. Aspects can see these changes, via QSceneChanges, but other
that that, it's all private.

I file a bug for converting QNodeId to QNode*: QTBUG-71767

On Tue, Nov 13, 2018 at 5:19 AM Paul Lemire  wrote:

> 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
>
>
>
___
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 and Webassembly

2018-11-13 Thread Morten Sørvig
> On 11 Nov 2018, at 15:56, Pierre Chicoine  wrote:
> 
> Is anyone working on getting Qt3d working on Webassembly, and, if so, any 
> idea of when it will be applied? 
> ___


Hi,

Qt3d makes good use of threads, which is not yet supported by Qt for 
Webassembly. So this is Qt 5.13 material at the earliest.

Morten



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


Re: [Interest] [Qt3D] Assimp OBJ importer can not import a file with 500MB size

2018-10-16 Thread Saif Suleiman
Why then QMesh can import the geometry data even if it is 1GB file ?
Thank you.



On Tue, Oct 16, 2018 at 5:53 PM Olivier B. <
perso.olivier.barthel...@gmail.com> wrote:

> Assimp 4.1, integrated in qt 5.11.1, already added stream reading of
> obj files, and is the most recent version. You will have to raise an
> issue to assimp IMO, then if it can be improved, rebuild qt with that
> new assimp version
> Le mar. 16 oct. 2018 à 16:26, Saif Suleiman  a
> écrit :
> >
> > Hi,
> > As the title says, i can not import a 500MB obj file ( 6 million
> vertices and 11 million faces ) using QSceneloader.
> >
> > getting this msg :
> > Qt3D.AssimpImporter: Assimp scene import failed OBJ: Too many vertices,
> would run out of memory
> >
> > Qt3D.Renderer.SceneLoaders: class Qt3DCore::QEntity *__cdecl
> Qt3DRender::Render::LoadSceneJob::tryLoadScene(class
> Qt3DRender::Render::Scene *,enum Qt3DRender::QSceneLoader::Status &,const
> class QStringList &,const class std::function Qt3DRender::QSceneImporter *)> &) Failed to import
> QUrl("file:///C:/Users/USER/Downloads/a.obj") with errors ("OBJ: Too many
> vertices, would run out of memory")
> >
> >
> > Thanks in advance.
> >
> > ___
> > Interest mailing list
> > Interest@qt-project.org
> > http://lists.qt-project.org/mailman/listinfo/interest
>
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] [Qt3D] Assimp OBJ importer can not import a file with 500MB size

2018-10-16 Thread Saif Suleiman
 sadly the app for 3D printing, which they use obj and stl formats the most.
Thanks.


On Tue, Oct 16, 2018 at 8:07 PM Giuseppe D'Angelo via Interest <
interest@qt-project.org> wrote:

> Il 16/10/18 16:26, Saif Suleiman ha scritto:
> > Hi,
> > As the title says, i can not import a *500MB* obj file *( 6 million
> > vertices and 11 million faces )* using QSceneloader.
>
> I know it's not a solution, but... ditching .obj for such a use case?
> You really want a real 3D format for these sizes (GLTF comes to mind).
>
> My 2 c,
> --
> Giuseppe D'Angelo | giuseppe.dang...@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.com
> KDAB - The Qt, C++ and OpenGL Experts
>
> ___
> Interest mailing list
> Interest@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] [Qt3D] Assimp OBJ importer can not import a file with 500MB size

2018-10-16 Thread Giuseppe D'Angelo via Interest

Il 16/10/18 16:26, Saif Suleiman ha scritto:

Hi,
As the title says, i can not import a *500MB* obj file *( 6 million 
vertices and 11 million faces )* using QSceneloader.


I know it's not a solution, but... ditching .obj for such a use case? 
You really want a real 3D format for these sizes (GLTF comes to mind).


My 2 c,
--
Giuseppe D'Angelo | giuseppe.dang...@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.com
KDAB - The Qt, C++ and OpenGL Experts



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


Re: [Interest] [Qt3D] Assimp OBJ importer can not import a file with 500MB size

2018-10-16 Thread Olivier B.
Assimp 4.1, integrated in qt 5.11.1, already added stream reading of
obj files, and is the most recent version. You will have to raise an
issue to assimp IMO, then if it can be improved, rebuild qt with that
new assimp version
Le mar. 16 oct. 2018 à 16:26, Saif Suleiman  a écrit :
>
> Hi,
> As the title says, i can not import a 500MB obj file ( 6 million vertices and 
> 11 million faces ) using QSceneloader.
>
> getting this msg :
> Qt3D.AssimpImporter: Assimp scene import failed OBJ: Too many vertices, would 
> run out of memory
>
> Qt3D.Renderer.SceneLoaders: class Qt3DCore::QEntity *__cdecl 
> Qt3DRender::Render::LoadSceneJob::tryLoadScene(class 
> Qt3DRender::Render::Scene *,enum Qt3DRender::QSceneLoader::Status &,const 
> class QStringList &,const class std::function Qt3DRender::QSceneImporter *)> &) Failed to import 
> QUrl("file:///C:/Users/USER/Downloads/a.obj") with errors ("OBJ: Too many 
> vertices, would run out of memory")
>
>
> Thanks in advance.
>
> ___
> Interest mailing list
> Interest@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] [Qt3d] QSceneLoader in Thread

2018-10-10 Thread Andrew Ialacci
The worlds best article on the subject:

https://mayaposch.wordpress.com/2011/11/01/how-to-really-truly-use-qthreads-the-full-explanation/



Sent from my iPad

On Oct 10, 2018, at 2:11 PM, Jérôme Godbout 
mailto:godbo...@amotus.ca>> wrote:

Make sure to check how QObject are related to a QThread. Each QObject belong to 
a single QThread and cannot be used into other thread. If you need the object 
into another thread to do processing or signal/slot, you will need the 
QObject::moveToThread() function on each object first.

You might want to check if the moveToThread() does affect children too (I'm not 
sure anymore), so you might only move the root parent or you might need to do 
your own function to move all children too. You also make a lot of parentless 
object into your code above, make sure this is what you want.

I did this with a secondary QQmlEngine that was executing some Qml declaration 
into is own other thread and then move the resulting object back to the main 
loop thread QQmlEngine. So it's doable but not too funny.

The GUI rendering can only work into the Main loop thread, take care if you do 
some rendering of the scene that will be rendered on screen. The offscreen 
rendering into buffer does't suffer from this limitation if I remember well. 
Note this is not Qt3D directly, but my guess here is that it's proabbly working 
the same way.

On Wed, 10 Oct 2018 at 08:01, Saif Suleiman 
mailto:saifqahe...@gmail.com>> wrote:
Currently I am trying to import a scene in my Qt3d application. The problem is, 
when creating an instance from QSceneLoader and set the sources QUrl then add 
it to an Entity, it freezes the application until it finishes the importing. I 
tried to put it in thread like :


void start()
{
qDebug() << "Thread";

QAspectEngine* pAs = new QAspectEngine();
pAs->registerAspect(new QRenderAspect());

QRenderSettings *renderSettings = new QRenderSettings();
renderSettings->setActiveFrameGraph(new Qt3DExtras::QForwardRenderer());

   // Root entity
   Qt3DCore::QEntity *sceneRoot2 = new Qt3DCore::QEntity();
   sceneRoot2->addComponent(renderSettings);

   pAs->setRootEntity(QSharedPointer(sceneRoot2));

   Qt3DRender::QSceneLoader *sceneLoader = new Qt3DRender::QSceneLoader();
   SceneWalker sceneWalker(sceneLoader);
   QObject::connect(sceneLoader, ::QSceneLoader::statusChanged, 
, ::onStatusChanged);

   
sceneLoader->setSource(QUrl::fromLocalFile("C:/Users/USER/Downloads/TreeTest.obj"));
   sceneRoot2->addComponent(sceneLoader);

}


This fuction will run when the Qthread emit the started signal, but then i got 
this : QObject::setParent: Cannot set parent, new parent is in a different 
thread.

So i do not know how to import a scene in qt3d without freezing the app, can 
any one help please.

Thanks in advance.
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


--


[https://docs.google.com/uc?export=download=1PzqBIgnmpnXWUhS9nkg1P3_-Ealbvl-X=0B28h_MWkOCu2V2llWWs1M3gySUxQeVJFa3Q0Y3RxdkdtWjlzPQ]RAPPROCHEZ
 LA DISTANCE

Jérôme Godbout
Senior Software Developer

p: +1 (418) 800-1073 ext.:109
m: +1 (581) 777-0050

amotus.ca
statum-iot.com




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


Re: [Interest] [Qt3d] QSceneLoader in Thread

2018-10-10 Thread Jérôme Godbout
Make sure to check how QObject are related to a QThread. Each QObject
belong to a single QThread and cannot be used into other thread. If you
need the object into another thread to do processing or signal/slot, you
will need the QObject::moveToThread() function on each object first.

You might want to check if the moveToThread() does affect children too (I'm
not sure anymore), so you might only move the root parent or you might need
to do your own function to move all children too. You also make a lot of
parentless object into your code above, make sure this is what you want.

I did this with a secondary QQmlEngine that was executing some Qml
declaration into is own other thread and then move the resulting object
back to the main loop thread QQmlEngine. So it's doable but not too funny.

The GUI rendering can only work into the Main loop thread, take care if you
do some rendering of the scene that will be rendered on screen. The
offscreen rendering into buffer does't suffer from this limitation if I
remember well. Note this is not Qt3D directly, but my guess here is that
it's proabbly working the same way.

On Wed, 10 Oct 2018 at 08:01, Saif Suleiman  wrote:

> Currently I am trying to import a scene in my Qt3d application. The
> problem is, when creating an instance from QSceneLoader and set the sources
> QUrl then add it to an Entity, it freezes the application until it finishes
> the importing. I tried to put it in thread like :
>
> void start(){
> qDebug() << "Thread";
>
> QAspectEngine* pAs = new QAspectEngine();
> pAs->registerAspect(new QRenderAspect());
>
> QRenderSettings *renderSettings = new QRenderSettings();
> renderSettings->setActiveFrameGraph(new Qt3DExtras::QForwardRenderer());
>
>// Root entity
>Qt3DCore::QEntity *sceneRoot2 = new Qt3DCore::QEntity();
>sceneRoot2->addComponent(renderSettings);
>
>pAs->setRootEntity(QSharedPointer(sceneRoot2));
>
>Qt3DRender::QSceneLoader *sceneLoader = new Qt3DRender::QSceneLoader();
>SceneWalker sceneWalker(sceneLoader);
>QObject::connect(sceneLoader, ::QSceneLoader::statusChanged, 
> , ::onStatusChanged);
>
>
> sceneLoader->setSource(QUrl::fromLocalFile("C:/Users/USER/Downloads/TreeTest.obj"));
>sceneRoot2->addComponent(sceneLoader);
>
> }
>
> This fuction will run when the Qthread emit the started signal, but then i
> got this : QObject::setParent: Cannot set parent, new parent is in a
> different thread.
>
> So i do not know how to import a scene in qt3d without freezing the app,
> can any one help please.
> Thanks in advance.
> ___
> Interest mailing list
> Interest@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>


-- 



RAPPROCHEZ LA DISTANCE


*Jérôme Godbout*Senior Software Developer

*p:* +1 (418) 800-1073 ext.:109

*m:* +1 (581) 777-0050

amotus.ca 
statum-iot.com
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Qt3D Framegraphs

2018-09-04 Thread Andy
On Mon, Sep 3, 2018 at 9:25 AM Paul Lemire  wrote:

> Glad to hear that, hopefully things are starting to make more sense now.
>

Getting there - thank you!

On 09/03/2018 02:54 PM, Andy wrote:
>
> Progress! Here's my current framegraph:
>
> [snip]
>
> 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).
>

Got it! If I setAlphaBufferSize( 8 ) on my default format it works.

>
> 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 ...).
>

Bingo. That fixes it.


>   - 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.
>

Texture2DMultisample does indeed make it better. Once I set "samples" to
the same as my QSurfaceFormat::defaultFormat(), I get decent results. Not
100% the same, but very close. (So it does work w/RenderCapture!)

My "final" frame graph (for those following along):

RenderSurfaceSelector:
  Viewport:
ClearBuffers:
  buffers: ColorDepthBuffer
  clearColor: "#faebd7"
  NoDraw: {}
FrustumCulling:
  # OnScreen
  CameraSelector:
objectName: onScreenCameraSelector
RenderCapture:
  objectName: onScreenCapture
  # OffScreen
  CameraSelector:
objectName: offScreenCameraSelector
RenderTargetSelector:
  target:
RenderTarget:
  attachments:
  - RenderTargetOutput:
  attachmentPoint: Color0
  texture:
Texture2DMultisample:
  objectName: offScreenTexture
  width: 1024
  height: 768
  format: RGBFormat
  samples: 8
  - RenderTargetOutput:
  attachmentPoint: Depth
  texture:
Texture2DMultisample:
  width: 1024
  height: 768
  format: D24
  samples: 8
  ClearBuffers:
buffers: ColorDepthBuffer
clearColor: "#faebd7"
NoDraw: {}
  RenderCapture:
objectName: offScreenCapture


If anyone is interested in the code to read framegraphs as YAML like this,
please get in touch and I can clean it up & put on gitlab (sometime next
month). It makes it a lot easier to iterate on building a framegraph. It
also drastically reduces the amount of boilerplate code, you can include &
read them as resources, and you don't have to bring in all of QML.

Now that I have the basics working... I'll need to dig into the multipass
shader stuff to get the effects I want.

Thank you for your patience!
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


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 Framegraphs

2018-09-03 Thread Andy
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.

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 
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Qt3D Framegraphs

2018-08-31 Thread Roland Hughes

  
  
Can we please quit quoting massive chunks of messages which exceed
the "digest" trigger size so each message comes out as a new digest?
-- 
Roland Hughes, President
Logikal Solutions
(630) 205-1593

http://www.theminimumyouneedtoknow.com
http://www.infiniteexposure.net
http://www.johnsmith-book.com
http://www.logikalblog.com
http://www.interestingauthors.com/blog
http://lesedi.us
  

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


Re: [Interest] Qt3D Framegraphs

2018-08-31 Thread Andy
On Fri, Aug 31, 2018 at 10:30 AM Paul Lemire  wrote:

> Hi Andy,
> Some ideas below :)
>

Thanks a lot Paul - answers inline.


> 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
>

Yes, I had it as a sibling of the RenderPassFilter. I didn't know where it
went, because QForwardRenderer has it on the QClearBuffers.


>   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.
>

I have it as a sibling. I'll choose... "unlucky" because I thought I
understood why it was working :-)


> 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)
>

Ah. How do I know which types of node result in drawing? I wouldn't have
expected  FrustumCulling to draw for example - from the docs I thought that
was kind of a "command node" like NoDraw.


> 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
>
>
Even if I take it all the way back to what should be the simplest (I think)
- no FrustumCulling, no capture:

RenderSurfaceSelector:
  Viewport:
ClearBuffers:
  buffers: ColorDepthBuffer
  clearColor: "#80faebd7"
  NoDraw: {}
CameraSelector:
  objectName: cameraSelector
  RenderPassFilter:
matchAny:
- FilterKey:
name: renderingStyle
value: forward

Qt3DRender::QFrameGraphNode::Custom
Qt3DRender::QRenderSurfaceSelector::
Qt3DRender::QViewport::
Qt3DRender::QClearBuffers::
Qt3DRender::QNoDraw::
Qt3DRender::QCameraSelector::cameraSelector
Qt3DRender::QRenderPassFilter::
Qt3DRender::QFilterKey::

I'm getting a cleared screen, no model.

I'm using Qt3DExtras::QPhongMaterial on my entities, so the filter key
should match, right?

Based on what you outlined above, Qt3DExtras::QForwardRenderer doesn't make
sense to me. If QFrustumCulling is doing the drawing, then what's the
purpose of the filter keys on QForwardRenderer since they aren't part of
the QRenderSurfaceSelector branch?

Qt3DExtras::QForwardRenderer::
Qt3DRender::QRenderSurfaceSelector::
Qt3DRender::QViewport::
Qt3DRender::QCameraSelector::
Qt3DRender::QClearBuffers::
Qt3DRender::QFrustumCulling::
Qt3DRender::QFilterKey::

  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
>

Right - I thought they were off by default, but I guess it's better to be
explicit.

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 

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 

Re: [Interest] Qt3D Framegraphs

2018-08-31 Thread Andy
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: {}
  RenderPassFilter:
matchAny:
- FilterKey:
name: renderingStyle
value: forward
  RenderCapture:
objectName: onScreenCapture
  RenderTargetSelector:
target:
  RenderTarget:
attachments:
- RenderTargetOutput:
attachmentPoint: Color0
texture:
  Texture2D:
width: 512
height: 512
format: RGBAFormat
ClearBuffers:
  buffers: ColorDepthBuffer
  clearColor: "#80faebd7"
  NoDraw: {}
RenderPassFilter:
  matchAny:
  - FilterKey:
  name: renderingStyle
  value: forward
RenderCapture:
  objectName: offScreenCapture

Results of the render captures:

   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.

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?

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 states, and
> materials now. :-)
>
> I also have a better appreciation for why most examples are QML - writing
> these in C++ is time consuming and error-prone. I've written a little
> (partially working) experiment to specify them in YAML so I don't have to
> pull in all the QML stuff just for defining my framegraph(s). I may
> continue down that road.
>
> Have there been any thoughts/discussions on providing a non-QML way to
> declare these? Could be useful for tooling (Qt Creator plugin for defining
> them visually?) as well.
>
> Thanks again for taking the time to go through this.
>
> ---
> Andy Maloney  //  https://asmaloney.com
> twitter ~ @asmaloney 
>
>
>
> On Tue, Aug 21, 2018 at 9:10 AM Paul Lemire  wrote:
>
>>
>> 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 

Re: [Interest] Qt3D GeometryRenderer TriangleStrip

2018-08-27 Thread Sean Harmer

On 27/08/2018 11:18, Volker Enderlein wrote:

Am 27/08/2018 um 11:31 schrieb Sean Harmer:

On 27/08/2018 07:31, Volker Enderlein wrote:

Hi,


does the Qt3D GeometryRenderer class support TriangleStrip 
primitives with restartIndexValue separated Strips?


Yes. Set the primitiveType property to LineStrip and you can specify 
the restart index value with 
https://doc.qt.io/qt-5/qt3drender-qgeometryrenderer.html#restartIndexValue-prop.


Cheers,

Sean

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


Thanks, Shawn.


Rereading my question, I think I need to clarify what I'm after.

Is it possible for a single GeometryRenderer with primitiveType 
`TriangleStrip` to contain multiple indexed TriangleStrips where the 
indexArray entries of the strips are separated by a 
`restartIndexValue`? When testing this, I saw some rendering artifacts 
with Qt 5.10.0.


Apparently (according to my tests) a GeometryRenderer with 
primitiveType ' Triangles'  does support this, but is it supported for 
primitiveType `TriangleStrip` too?


It should work, yes. If you have a test case where this doesn't work as 
expected, please file a bug report in jira with the test case.


Cheers,

Sean

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


Re: [Interest] Qt3D GeometryRenderer TriangleStrip

2018-08-27 Thread Volker Enderlein

Am 27/08/2018 um 11:31 schrieb Sean Harmer:

On 27/08/2018 07:31, Volker Enderlein wrote:

Hi,


does the Qt3D GeometryRenderer class support TriangleStrip primitives 
with restartIndexValue separated Strips?


Yes. Set the primitiveType property to LineStrip and you can specify 
the restart index value with 
https://doc.qt.io/qt-5/qt3drender-qgeometryrenderer.html#restartIndexValue-prop.


Cheers,

Sean

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


Thanks, Shawn.


Rereading my question, I think I need to clarify what I'm after.

Is it possible for a single GeometryRenderer with primitiveType 
`TriangleStrip` to contain multiple indexed TriangleStrips where the 
indexArray entries of the strips are separated by a `restartIndexValue`? 
When testing this, I saw some rendering artifacts with Qt 5.10.0.


Apparently (according to my tests) a GeometryRenderer with primitiveType 
' Triangles'  does support this, but is it supported for primitiveType 
`TriangleStrip` too?



Cheers, Volker

--

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


Re: [Interest] Qt3D GeometryRenderer TriangleStrip

2018-08-27 Thread Sean Harmer

On 27/08/2018 07:31, Volker Enderlein wrote:

Hi,


does the Qt3D GeometryRenderer class support TriangleStrip primitives 
with restartIndexValue separated Strips?


Yes. Set the primitiveType property to LineStrip and you can specify the 
restart index value with 
https://doc.qt.io/qt-5/qt3drender-qgeometryrenderer.html#restartIndexValue-prop.


Cheers,

Sean

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


Re: [Interest] Qt3D Framegraphs

2018-08-24 Thread Andy
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 states, and materials
now. :-)

I also have a better appreciation for why most examples are QML - writing
these in C++ is time consuming and error-prone. I've written a little
(partially working) experiment to specify them in YAML so I don't have to
pull in all the QML stuff just for defining my framegraph(s). I may
continue down that road.

Have there been any thoughts/discussions on providing a non-QML way to
declare these? Could be useful for tooling (Qt Creator plugin for defining
them visually?) as well.

Thanks again for taking the time to go through this.

---
Andy Maloney  //  https://asmaloney.com
twitter ~ @asmaloney 



On Tue, Aug 21, 2018 at 9:10 AM Paul Lemire  wrote:

>
> 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=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 {
>   

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=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, etc - 

Re: [Interest] Qt3D Framegraphs

2018-08-21 Thread Andy
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?

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.

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

3) If I want to use any of the "default materials" in extras - Phong,
PhongAlpha, etc - then in (3) and (4.3) the filterkeys must be
"renderingStyle"/"forward", correct? Or can I even use them anymore if I'm
going this route?

4) I will use the offscreen to generate snapshot images and video - I
assume I can turn offscreen rendering on/off dynamically by simply
enabling/disabling the RenderTargetSelector?


Thanks again for your help. I finally feel like I'm in danger of
understanding something here!


On Mon, Aug 20, 2018 at 1:20 AM Paul Lemire  wrote:

> 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 {
> 

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] Windows Deployment. Path to models?

2018-08-13 Thread Oleg Evseev
My bad. Windows Deployment nothing to do with my issue. In fact this was in
release mode even in qt creator due to my mistake with #ifdef QT_DEBUG and
not adding entities to QLayerFilter %)

Sorry for bothering.

2018-08-13 20:08 GMT+03:00 Oleg Evseev :

> Build app without models and its size reduced by size of models. So they
> are the part of exe as other resources, right? But not displayed :(
>
> 2018-08-13 19:46 GMT+03:00 Oleg Evseev :
>
>> Hello!
>>
>> Trying to deploy windows desktop application with qt3d. Application runs
>> but sceneloaders don't load qgltf models added through assest QT3D_MODELS.
>> In code models are loaded from resources:
>> setSceneLoaderSource(QString("qrc:/models/helicopter.qgltf"));
>>
>> In qt creator everything loads fine.
>>
>> Where should I copy qgltf models and theirs files? Tried root directory
>> (beside with exe) and "models" dir - didn't help.
>>
>> Thanks in advance for help!
>>
>> --
>> With regards, Oleg.
>>
>
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] [Qt3D] Windows Deployment. Path to models?

2018-08-13 Thread Oleg Evseev
Build app without models and its size reduced by size of models. So they
are the part of exe as other resources, right? But not displayed :(

2018-08-13 19:46 GMT+03:00 Oleg Evseev :

> Hello!
>
> Trying to deploy windows desktop application with qt3d. Application runs
> but sceneloaders don't load qgltf models added through assest QT3D_MODELS.
> In code models are loaded from resources:
> setSceneLoaderSource(QString("qrc:/models/helicopter.qgltf"));
>
> In qt creator everything loads fine.
>
> Where should I copy qgltf models and theirs files? Tried root directory
> (beside with exe) and "models" dir - didn't help.
>
> Thanks in advance for help!
>
> --
> With regards, Oleg.
>
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] [Qt3D] Issues

2018-08-10 Thread Andy
On Thu, Aug 9, 2018 at 5:38 PM Oleg Evseev  wrote:

> Hi,
>
> I wonder why FirstPersonCameraController now in qt 5.11.1 by arrow up-down
> keys moves camera up and down instead of moving forward like in games (like
> first person view should), and as it is in 5.9.5?
>

The key bindings for the Qt3DExtras camera controllers are done in
QAbstractCameraController. There isn't a way to modify them through the
API. (e.g. See my previous email to the list about the escape key and this
bug report: https://bugreports.qt.io/browse/QTBUG-69802 )


> Also qgltf.exe of qt 5.11.1 for windows "Failed to import" (without any
> other error description) for the one of my model (for both obj and 3ds
> format). qgltf.exe of qt 5.9.5 handles this obj model without problems, but
> can't import 3ds model with "Qt3D.AssimpImporter: Assimp scene import
> failed Chunk is too large".
>

I think the assimp library version changed between Qt versions. You might
try its viewer to see if it's an assimp problem:

 https://github.com/assimp/assimp


> I like that qt 5.11.1 renders objects loaded in SceneLoader with
> phongmaterial with ambient color = "white" as should - it looks similar to
> Blender, while in qt 5.9.5 I need to reduce ambient by half or objects are
> overexposed to white instead of their diffuse color.
>
> But SceneLoader of  qt 5.11.1 still has texture rendering issues that was
> fixed in qt 5.8 (QTBUG-66644) once.
>
> I mean I can't choose version. It looks like qt 3d development still can
> not be stabilize :(
>

I agree that is very frustrating. What I find even more frustrating is the
complete lack of useful documentation for the Qt3D module and the broken
examples. It's really not up to the standard of the other parts of Qt I've
worked with. I really, really want to work with it, but it's not making it
easy (or enjoyable) :-)


> --
> With regards, Oleg.
> ___
> Interest mailing list
> Interest@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>

---
Andy Maloney  //  https://asmaloney.com
twitter ~ @asmaloney 
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] [Qt3D] QAbstractCameraController & escape key

2018-08-07 Thread Andy
I filed a bug report:

   https://bugreports.qt.io/browse/QTBUG-69802

I couldn't figure out how to turn it off through the public API, but I did
come up with a fragile hack to turn it off.

In your inherited camera controller (or, subclass one of the existing ones):

// Find and delete the escape key QActionInput.

// This is a workaround for the change to QAbstractCameraController in Qt 5.11

// which added an escape key handler that performs a "view all" on the scene.

//   https://codereview.qt-project.org/#/c/226879/

//   https://bugreports.qt.io/browse/QTBUG-69802
void inheritedCameraController::_deleteEscapeHandler()

{

   QList   list =
findChildren();


   for ( auto actionInput : list )

   {

  if ( actionInput->buttons().count() != 1 )

  {

 continue;

  }


  if ( actionInput->buttons().at( 0 ) == Qt::Key_Escape )

  {

 delete actionInput;

  }

   }

}


---
Andy Maloney  //  https://asmaloney.com
twitter ~ @asmaloney 



On Wed, Aug 1, 2018 at 6:10 PM Andy  wrote:

> Back in April, a commit added the functionality that the escape key does a
> "view all" on the scene.
>
>  https://codereview.qt-project.org/#/c/226879/
>
> How do I prevent this? I can't figure out a way to turn it off/override it
> in my derived camera controller.
>
> I have a ground plane and a model in the middle of it and when the user
> hits escape it zooms the camera way out and it looks terrible (and it's
> confusing).
>
> This feels like an application-specific functionality that doesn't belong
> in this abstract base class.
>
> ---
> Andy Maloney  //  https://asmaloney.com
> twitter ~ @asmaloney 
>
>
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] [Qt3d] Textures flickering

2018-07-29 Thread Oleg Evseev
 Mike, thanks.

Yes you are right. This is z-conflict.
This model is rendered fine, without flickering in another project with
disabled fragment depth writes to depth buffer.

How can I increase precision of z-buffer in qt 3d?


2018-07-29 21:28 GMT+03:00 Mike Krus :

> Hi
>
> hard to say from the short video, but it looks like you may have z
> fighting going on, two coinciding meshes and the lack on precision causing
> this flickering…
>
> Mike
>
> > On 29 Jul 2018, at 14:58, Oleg Evseev  wrote:
> >
> > Hi all,
> >
> > When I load big models with help QSceneLoader in assimp-cpp test example
> (or small models but move camera far away from object) textures start
> flickering:
> > https://youtu.be/5FUOWc412JE
> >
> > How to fix that?
> > Thanks in advance for help.
> >
> > ---
> > With regards, Oleg
> > ___
> > Interest mailing list
> > Interest@qt-project.org
> > http://lists.qt-project.org/mailman/listinfo/interest
>
> --
> Mike Krus | mike.k...@kdab.com | Senior Software Engineer
> KDAB (UK) Ltd., a KDAB Group company
> Tel: UK Office +44 1625 809908   Mobile +44 7833 491941
> KDAB - The Qt Experts, C++, OpenGL Experts
>
>
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] [Qt3d] Textures flickering

2018-07-29 Thread Mike Krus via Interest
Hi

hard to say from the short video, but it looks like you may have z fighting 
going on, two coinciding meshes and the lack on precision causing this 
flickering…

Mike

> On 29 Jul 2018, at 14:58, Oleg Evseev  wrote:
> 
> Hi all,
> 
> When I load big models with help QSceneLoader in assimp-cpp test example (or 
> small models but move camera far away from object) textures start flickering:
> https://youtu.be/5FUOWc412JE
> 
> How to fix that?
> Thanks in advance for help.
> 
> ---
> With regards, Oleg
> ___
> Interest mailing list
> Interest@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest

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



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


  1   2   3   4   5   >