Material QML Type

Non-creatable abstract base for materials. More...

Import Statement: import Qt3D.Render 2.12
Since: Qt 5.5
Instantiates: QMaterial

Properties

Detailed Description

Material provides a way to specify the rendering of an entity. Any aspect can define its own subtype of Material so that a Material can be used to describe a visual element; for example, the way sound should reflect off an element, the temperature of a surface, and so on.

In itself, a Material doesn't do anything. It's only when it references an Effect node that a Material becomes useful.

In practice, it often happens that a single Effect is being referenced by several Material components. This allows to only create the effect, techniques, passes and shaders once while allowing to specify the material by adding Parameter instances.

A Parameter defined on a Material is overridden by a Parameter (of the same name) defined in a TechniqueFilter or a RenderPassFilter.

Effect {
    id: effect

    technique: [
        Technique {
            id: gl3Technique
            graphicsApiFilter {
                api: GraphicsApiFilter.OpenGL
                profile: GraphicsApiFilter.CoreProfile
                majorVersion: 3
                minorVersion: 1
            }
            renderPasses: [
                RenderPass {
                    id: gl3Pass
                    shaderProgram: ShaderProgram {
                        ...
                    }
                }
            ]
        }
    ]
}

Material {
    id: material1
    parameters: [
        Parameter { name: "color"; value: "green" }
    ]
}

Material {
    id: material2
    parameters: [
        Parameter { name: "color"; value: "white" }
    ]
}

See also Effect, Technique, and Parameter.

Property Documentation

effect : Effect

Specifies the effect to be used with the material.


parameters : list<Parameter>

Holds the list of parameters used by the material.


© 2019 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.