- Qt 6.12
- Qt Quick 3D
- QML Types
- renderTargetBlend
- Qt Quick 3D | Commercial or GPLv3

# renderTargetBlend QML Value Type

Defines blending parameters for a single color attachment of a render pass. More...

Import Statement: | `import QtQuick3D`
Since: | Qt 6.11

## Properties

- blendEnabled : bool
- colorWrite : enumeration
- dstAlpha : enumeration
- dstColor : enumeration
- opAlpha : enumeration
- opColor : enumeration
- srcAlpha : enumeration
- srcColor : enumeration

## Detailed Description

The renderTargetBlend type is used to specify blending parameters for a single color attachment of a RenderPass. An instance of renderTargetBlend can be assigned to one of the PipelineStateOverride `targetBlend0` through `targetBlend7` properties, where the index corresponds to the color attachment slot.

The color blend equation is:

     result.rgb = srcColor * src.rgb  opColor  dstColor * dst.rgb
     result.a   = srcAlpha * src.a   opAlpha  dstAlpha * dst.a

## Property Documentation

### blendEnabled : bool

If set to `true`, enables blending for the color attachment. If set to `false`, disables blending and the output color is written directly to the attachment. The default value is `false`.

### colorWrite : enumeration

A bitmask that controls which color channels are written to the color attachment. Multiple values can be combined with the `|` operator. The default value is `R | G | B | A`.

Constant | Description
--- | ---
`RenderTargetBlend.R` | Write to the red channel.
`RenderTargetBlend.G` | Write to the green channel.
`RenderTargetBlend.B` | Write to the blue channel.
`RenderTargetBlend.A` | Write to the alpha channel.

### dstAlpha : enumeration

Sets the destination alpha blend factor. This value scales the alpha component of the current value in the color attachment before the blend operation. The default value is `OneMinusSrcAlpha`. See `srcColor` for the list of available values.

### dstColor : enumeration

Sets the destination color blend factor. This value scales the RGB components of the current value in the color attachment before the blend operation. The default value is `OneMinusSrcAlpha`. See `srcColor` for the list of available values.

### opAlpha : enumeration

Sets the arithmetic operation used to combine the scaled source and destination alpha components. The default value is `Add`. See `opColor` for the list of available values.

### opColor : enumeration

Sets the arithmetic operation used to combine the scaled source and destination color components. The default value is `Add`.

Constant | Description
--- | ---
`RenderTargetBlend.Add` | Result = src + dst.
`RenderTargetBlend.Subtract` | Result = src - dst.
`RenderTargetBlend.ReverseSubtract` | Result = dst - src.
`RenderTargetBlend.Min` | Result = min(src, dst).
`RenderTargetBlend.Max` | Result = max(src, dst).

### srcAlpha : enumeration

Sets the source alpha blend factor. This value scales the alpha component of the fragment shader output before the blend operation. The default value is `One`. See `srcColor` for the list of available values.

### srcColor : enumeration

Sets the source color blend factor. This value scales the RGB components of the fragment shader output before the blend operation. The default value is `One`.

Constant | Description
--- | ---
`RenderTargetBlend.Zero` | Factor is (0, 0, 0).
`RenderTargetBlend.One` | Factor is (1, 1, 1).
`RenderTargetBlend.SrcColor` | Factor is the source color (r, g, b).
`RenderTargetBlend.OneMinusSrcColor` | Factor is (1-r, 1-g, 1-b) of the source.
`RenderTargetBlend.DstColor` | Factor is the destination color (r, g, b).
`RenderTargetBlend.OneMinusDstColor` | Factor is (1-r, 1-g, 1-b) of the destination.
`RenderTargetBlend.SrcAlpha` | Factor is the source alpha (a, a, a).
`RenderTargetBlend.OneMinusSrcAlpha` | Factor is (1-a, 1-a, 1-a) of the source.
`RenderTargetBlend.DstAlpha` | Factor is the destination alpha (a, a, a).
`RenderTargetBlend.OneMinusDstAlpha` | Factor is (1-a, 1-a, 1-a) of the destination.
`RenderTargetBlend.ConstantColor` | Factor is the constant color set on the pipeline.
`RenderTargetBlend.OneMinusConstantColor` | Factor is one minus the constant color.
`RenderTargetBlend.ConstantAlpha` | Factor is the constant alpha.
`RenderTargetBlend.OneMinusConstantAlpha` | Factor is one minus the constant alpha.
`RenderTargetBlend.SrcAlphaSaturate` | Factor is min(src.a, 1-dst.a) for RGB, 1 for A.
`RenderTargetBlend.Src1Color` | Factor is from the second color output of the fragment shader.
`RenderTargetBlend.OneMinusSrc1Color` | Factor is one minus the second color output.
`RenderTargetBlend.Src1Alpha` | Factor is the alpha of the second color output.
`RenderTargetBlend.OneMinusSrc1Alpha` | Factor is one minus the alpha of the second output.