Qt Quick 3D - Custom Shaders Example
import QtQuick
import QtQuick3D
CustomMaterial {
property real time: 0.0
property real amplitude: 5.0
property real alpha: 1.0
property bool texturing: false
property bool textureFromItem: false
property Item texSrc
Texture {
id: texFromFile
source: "qt_logo.png"
}
Texture {
id: texFromItem
sourceItem: texSrc
}
property TextureInput tex: TextureInput {
enabled: texturing
texture: textureFromItem ? texFromItem : texFromFile
}
shadingMode: CustomMaterial.Unshaded
sourceBlend: alpha < 1.0 ? CustomMaterial.SrcAlpha : CustomMaterial.NoBlend
destinationBlend: alpha < 1.0 ? CustomMaterial.OneMinusSrcAlpha : CustomMaterial.NoBlend
cullMode: CustomMaterial.BackFaceCulling
© 2025 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.