[Interest] Entity sub-tree opacity in Quick3D 2.0
Sean Harmer
sean.harmer at kdab.com
Wed Apr 1 12:36:17 CEST 2015
Hi,
On Wednesday 01 Apr 2015 00:14:28 Unai IRIGOYEN wrote:
> Hi,
> I have been playing with the upcoming Qt3D those days and especially the QML
> APIs.
> I was wondering if there is a means of changing the opacity of an entity and
> all children at the same time (same behavior as in QtQuick). At the moment
> I must change the opacity in the material color of each entity in the tree
> which results in verbose code. I have been trying to see if I can apply an
> effect to the sub-tree using alpha composition or shaders but I'm out of
> luck.
At present, property changes do not recurse down to children as there is no
promise that children will even have the same properties. In Qt Quick this
works because opacity is a property of the base Item element.
With Qt3D's Entity it has no such default properties. However, what you can do
is to make your own custom QEntity subclass and use that in your QML scene
such that when you set a property it recurses down to it's children and also
sets their opacities too.
The alternative would be to have the renderer on the backend do this
automatically but then the hierarchy is conflating transformation composition
and opacity composition. This assumption would likely break in other cases.
E.g. if somebody wants to have some opaque objects flying around a transparent
object.
> As a side note, I'm also interested in particles for Qt3D. I understand it's
> not priority number 1 but just take this as a vote for the feature.
Once the new Buffer/Attribute API lands this should be possible in an indirect
way using a custom set of shaders and framegraph to perform the particle
updates on the GPU. Out of the box support for particles will come later.
Please file a JIRA request if you need this.
Cheers,
Sean
--
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