- Qt Creator Manual
- Using Custom Shaders
- Qt Creator Manual 4.14.1

Applying 3D Effects ◦ Creating Custom Effects and Materials

# Using Custom Shaders

You can use the Qt Quick 3D shader utilities and commands to create your own effects and materials.

For more information on using the shaders, see Creating Custom Effects and Materials.

See the following tables for available shader utilities and commands.

## Available Custom Shader Utilities

Custom Shader | Description
--- | ---
Buffer | A buffer to be used for a pass of a Custom Material or an Effect. Specify attributes for the buffer by defining the Name and Format and Allocation Flags properties. The Filter property specifies the filter operation when a render pass is reading the buffer that differs in size in comparison to the current output buffer.

The Coordinate Operation property specifies the texture coordinate operation for coordinates outside [0, 1] range.

You can also specify the Size Multiplier of the buffer. Value of 1.0 creates buffer with the same size while 0.5 creates buffer with width and height halved.

Custom Material | The base component for creating custom materials used to shade models. Specify the attributes of the Custom Material by defining the Transparency, Refraction and Always Dirty properties. The Passes property contains a list of render passes implemented by the material. The Shader Info specifies the shader info of the material. For more information, see Creating Custom Effects and Materials.
Effect | A base component for creating post-processing effects. The Passes property contains a list of render passes implemented by the effect. For more information, see Creating Custom Effects and Materials.
Pass | A render pass in a Custom Material or an Effect. The Commands property specifies the list of render commands of the pass. You can further define a render pass by using the Buffer and Shaders properties.
Shader | A container component for defining shader code used by Custom Materials and Effects. Define the Shader attributes by specifying the Source and Stage properties.
Shader Info | Basic information about custom shader code for Custom Materials. The Version property specifies the shader code version, while the Type property defines the shader code type. The Key property specifies the options used by the shader using the combination of shader key values, such as diffuse or specular lighting, refraction, transparency, displacement, transmissiveness, glossiness, and alpha cutout.
Texture Input | A texture channel for a Custom Material or an Effect. The Texture property specifies the texture to input, while the Enabled determines whether the texture is enabled.

## Available Custom Shader Commands

Command | Description
--- | ---
Blending | A pass command that specifies the source blending function. Use the Source and Destination to further define the function.
Buffer Blit | A copy operation between two buffers in a pass of a Custom Material or an Effect. Define the source and the destination buffer of the copy-operation by using the Source and Destination properties.
Buffer Input | An input buffer to be used for a pass of a Custom Material or an Effect. The Buffer property specifies the buffer used for the parameter. The Parameter specifies the name of the input parameter in the shader.
Cull Mode | A culling mode for a render pass. The Mode specifies the culling mode in a pass when the State property of the Render State is set to CullFace.
Depth Input | An output texture for the depth buffer. The Parameter property specifies the name of the texture the depth buffer will bind to.
Render State | The render state to be enabled or disabled in a pass of a Custom Material or an Effect. The State property specifies the render state to enable or disable in a pass.
Set Uniform Value | A value to be set during a single pass. The Target property specifies the name of the uniform that will have its value changed during the pass, while the Value specifies the value that will be set on the target uniform.

Applying 3D Effects ◦ Creating Custom Effects and Materials