Effect QML Type | Qt Quick 3D 5.15.2

- Qt 5.15
- Qt Quick 3D
- QML Types
- Effect QML Type
- Qt Quick 3D | Commercial or GPLv3

# Effect QML Type

Base component for creating a post-processing effect. More...

Import Statement: | import QtQuick3D.Effects 1.15
Inherits: | Object3D

- List of all members, including inherited members

## Properties

- passes : list

## Detailed Description

The Effect type allows the user to implement their own post-processing effects for QtQuick3D. This is how to create your own effect, using GaussianBlur as an example:

     Effect {
         // The property name is generated as a uniform to the shader code, so it must match
         // the name and type used in shader code.
         property real amount: 2 // 0 - 10

         // The vertex shaders are defined with the Shader type.
         Shader {
             id: vertical
             stage: Shader.Vertex
             shader: "shaders/blurvertical.vert"
         }
         Shader {
             id: horizontal
             stage: Shader.Vertex
             shader: "shaders/blurhorizontal.vert"
         }

         // The fragment shader is defined with the Shader type.
         Shader {
             id: gaussianblur
             stage: Shader.Fragment
             shader: "shaders/gaussianblur.frag"
         }

         // In this shader we need a temporary buffer to store the output of the first blur pass.
         Buffer {
             id: tempBuffer
             name: "tempBuffer"
             format: Buffer.RGBA8
             textureFilterOperation: Buffer.Linear
             textureCoordOperation: Buffer.ClampToEdge
             bufferFlags: Buffer.None // Lifetime of the buffer is one frame
         }

         // GaussianBlur needs two passes; a horizontal blur and a vertical blur.
         // Only the vertex shader is different in this case, so we can use the same fragment
         // shader for both passes.
         passes: [
             Pass {
                 shaders: [ horizontal, gaussianblur ]
                 output: tempBuffer
             },
             Pass {
                 shaders: [ vertical, gaussianblur ]
                 commands: [
                     // We feed the output of the first pass as an input for the second pass.
                     BufferInput {
                         buffer: tempBuffer
                     }
                 ]
             }
         ]
     }

See also Shader, Buffer, and Pass.

## Property Documentation

passes : list

Contains a list of render passes implemented by the effect.