[Development] Qt3D questions and wishes
randy.oreilly at Colorado.EDU
Mon Aug 10 10:15:17 CEST 2015
Harald — I filed a few bug tickets with example code for some of these issues, as noted below.
> On Aug 9, 2015, at 11:35 PM, Harald Vistnes <harald.vistnes at gmail.com> wrote:
> I have played with the tech preview of Qt3D 2.0 and I have some questions and wishes.
> 1. Transparency. It does not seem like Qt3D handles transparency at all. For instance, phong.frag always returns alpha=1.0. I would expect materials like Qt3D::QPhongMaterial to have an opacity parameter and that the renderer would first render opaque meshes and then transparent meshes sorted by depth. Ideally I would love to have support for OIT out of the box, but that may be too specialized. Will there be any support for transparent materials in the upcoming release?
This requires extra transparency-specific shader code and alpha blending logic, so that is presumably why it is not supported by default. But hopefully the next release will include these kinds of transparency cases:
> 2. Shared vertex buffers. How can multiple meshes share the same vertex buffer?
> 3. Updating vertex buffers. How can one update the vertices of an existing mesh? Qt3D::QAbstractMesh only expose the meshFunctor() function, so I don't see how to update an existing mesh with new vertex data.
there is an update() method on the abstract mesh, which sends a property update signal for the mesh functor or something like that.
> 4. Text. It would be nice with an example showing how to add text to a Qt3D scene. Both 2D (specified in screen coordinates) and 3D (specified in world coordinates). I'm only using C++, so that is what is of interest to me.
This is probably not super efficient but it does work: renders text to a QImage and uses that for a texture. Using the transparent version of the texture you just get the 2D text floating in space. Uses 3D coordinates, but renders text to a plane.
> 5. It would be nice to have a class like QTriangleMesh out of the box where the user can specify his own vertices, normals, indices, etc. I implemented such a class following the pattern of the Qt3D::QCylinderMesh implementation, but ended up with a copy of the vertex/index arrays in both the TriangleMeshPrivate and TriangleMeshFunctor class before they were actually used in the Qt3D::QAbstractMeshFunctor::operator()(). Is there a better way to handle this, to avoid all those copies of the data?
I wrote a TriangleStripSet class that has float vectors for vertices and normals, and for per-vertex colors, and an int vector for indexes — it was fairly straightforward but uses non-Qt dynamic vector classes so not directly sharable. It also uses the primitive reset index technique so you can easily restart the triangle strips: https://bugreports.qt.io/browse/QTBUG-47291
> 6. Polygon offset to handle z-fighting.
> 7. All examples in C++. In the tech preview, many of the examples were QML only.
> Thanks. I'm looking forward to see the progress in the next release!
> Best regards
> Harald Vistnes
> Development mailing list
> Development at qt-project.org
More information about the Development