Description
I noticed, that there is a Problem with the QML Effect item, when applying a texture and a material at the same time.
Following example code is displaying a Cube that has a texture an material applied.
The texture color and the materal color are mixed correctly.
Cube { effect: Effect { decal: true texture: "qtlogo.png" material: Material { diffuseColor: "blue" } } }
However, if you change the order of the properties in the Effect item to:
Cube { effect: Effect { material: Material { diffuseColor: "blue" } decal: true texture: "qtlogo.png" } }
This doesnt work correctly any more. Only a blue cube will be displayed. This is because (in the second example) internally first
the texture property is processed. Because the effect doesn't contain any material yet, a new material is created that holds the texture.
Afterwards the material property is processed which applies the material to the effect, effectivly obscuring the other material.
In the first example, the material is applied first to the effect. When the texture property is set afterwards, the texture
is applied to the existing material.
The same applies for the color property in the Effect item btw.
As solution I propose to just remove the texture and color property from the Effect item, because it is there anyway in the
Material item (but not documented).
Following code would work just fine:
Cube { effect: Effect { material: Material { diffuseColor: "blue" textureUrl: "qtlogo.png" } decal: true } }
Attachments
Issue Links
- is replaced by
-
QTBUG-22091 Change properties of nodes within model tree
-
- Withdrawn
-
For Gerrit Dashboard: QTBUG-24696 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
29397,2 | Added additional documentation for the Effect class in QML. | master | qt/qt3d | Status: MERGED | +2 | 0 |