[Interest] Qt3D face culling
Sean Harmer
sean.harmer at kdab.com
Thu Mar 10 18:13:51 CET 2016
On Thursday 10 Mar 2016 15:13:07 Юрий Дынников wrote:
> Hello, I'm trying to use Qt3D (C++) module, and there is one huge problem:
> How can I enable displaying any surface (or triangle, to be simple) from
> both sides?
>
> I've read that that's all about face-culling, but I can't find where it is
> applied during preparation of scene.
> I've found QCullFace class and managed to find the place where it should
> belong by finding QML examples with culling settings:
> QMaterial->QTechnique->QRenderPass->QCullFace(or any other QRenderState).
> But if I replace QCuboidMesh with QPlaneMesh in "Basic shapes" examples,
> and try to debug all those levels of structure, I find that neither for
> QPhongMaterial (tested it on Qt5.5.1) nor for QGoochMaterial (It works on
> Qt5.6.0rc1) there are no QCullFace objects in their compositions.
>
> I've also tried to make a class for mesh of two triangles based on three
> vertices, but rearranging indexes to make it "flip" didn't work. Neither
> did modifying normals or tangents.
Instead of adding the CullFace to the materials, you can also add it to the
framegraph. Take a copy of the ForwardRenderer.qml framegraph (if you're usign
that) and add a StateSet (RenderStateSet in 5.7) to the tree containing the
CullFaceState and you will also need to add in a DepthTest state object too
since we are replacing Qt3D's default state.
See https://bugreports.qt.io/browse/QTBUG-51770 and my comment there.
Cheers,
Sean
>
> Thanks in advance,
> morodeer
--
Dr Sean Harmer | sean.harmer at kdab.com | Managing Director UK
KDAB (UK) Ltd, a KDAB Group company
Tel. +44 (0)1625 809908; Sweden (HQ) +46-563-540090
Mobile: +44 (0)7545 140604
KDAB - Qt Experts
More information about the Interest
mailing list