Class reference

RDPipelineColorBlendStateAttachment

Inherits RefCounted

Pipeline color blend state attachment (used by RenderingDevice).

Description

Controls how blending between source and destination fragments is performed when using RenderingDevice. For reference, this is how common user-facing blend modes are implemented in Redot's 2D renderer: Mix:

		var attachment = RDPipelineColorBlendStateAttachment.new()
		attachment.enable_blend = true
		attachment.color_blend_op = RenderingDevice.BLEND_OP_ADD
		attachment.src_color_blend_factor = RenderingDevice.BLEND_FACTOR_SRC_ALPHA
		attachment.dst_color_blend_factor = RenderingDevice.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA
		attachment.alpha_blend_op = RenderingDevice.BLEND_OP_ADD
		attachment.src_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_ONE
		attachment.dst_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA
		

Add:

		var attachment = RDPipelineColorBlendStateAttachment.new()
		attachment.enable_blend = true
		attachment.alpha_blend_op = RenderingDevice.BLEND_OP_ADD
		attachment.color_blend_op = RenderingDevice.BLEND_OP_ADD
		attachment.src_color_blend_factor = RenderingDevice.BLEND_FACTOR_SRC_ALPHA
		attachment.dst_color_blend_factor = RenderingDevice.BLEND_FACTOR_ONE
		attachment.src_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_SRC_ALPHA
		attachment.dst_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_ONE
		

Subtract:

		var attachment = RDPipelineColorBlendStateAttachment.new()
		attachment.enable_blend = true
		attachment.alpha_blend_op = RenderingDevice.BLEND_OP_REVERSE_SUBTRACT
		attachment.color_blend_op = RenderingDevice.BLEND_OP_REVERSE_SUBTRACT
		attachment.src_color_blend_factor = RenderingDevice.BLEND_FACTOR_SRC_ALPHA
		attachment.dst_color_blend_factor = RenderingDevice.BLEND_FACTOR_ONE
		attachment.src_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_SRC_ALPHA
		attachment.dst_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_ONE
		

Multiply:

		var attachment = RDPipelineColorBlendStateAttachment.new()
		attachment.enable_blend = true
		attachment.alpha_blend_op = RenderingDevice.BLEND_OP_ADD
		attachment.color_blend_op = RenderingDevice.BLEND_OP_ADD
		attachment.src_color_blend_factor = RenderingDevice.BLEND_FACTOR_DST_COLOR
		attachment.dst_color_blend_factor = RenderingDevice.BLEND_FACTOR_ZERO
		attachment.src_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_DST_ALPHA
		attachment.dst_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_ZERO
		

Pre-multiplied alpha:

		var attachment = RDPipelineColorBlendStateAttachment.new()
		attachment.enable_blend = true
		attachment.alpha_blend_op = RenderingDevice.BLEND_OP_ADD
		attachment.color_blend_op = RenderingDevice.BLEND_OP_ADD
		attachment.src_color_blend_factor = RenderingDevice.BLEND_FACTOR_ONE
		attachment.dst_color_blend_factor = RenderingDevice.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA
		attachment.src_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_ONE
		attachment.dst_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA
		

Properties

int alpha_blend_op = 0

The blend mode to use for the alpha channel.

int color_blend_op = 0

The blend mode to use for the red/green/blue color channels.

int dst_alpha_blend_factor = 0

Controls how the blend factor for the alpha channel is determined based on the destination's fragments.

int dst_color_blend_factor = 0

Controls how the blend factor for the color channels is determined based on the destination's fragments.

int src_alpha_blend_factor = 0

Controls how the blend factor for the alpha channel is determined based on the source's fragments.

int src_color_blend_factor = 0

Controls how the blend factor for the color channels is determined based on the source's fragments.

bool write_a = true

If true, writes the new alpha channel to the final result.

bool write_b = true

If true, writes the new blue color channel to the final result.

bool write_g = true

If true, writes the new green color channel to the final result.

bool write_r = true

If true, writes the new red color channel to the final result.

Methods

Source revision 4f5b14abade2
Connection interrupted. Reload×

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.