Specifying a pipeline blend state
Transparent objects are very common in the environment we see every day around us. Such objects are also common in 3D applications. To simulate transparent materials and simplify operations that the hardware needs to perform to render transparent objects, blending was introduced. It mixes the color of a processed fragment with a color that is already stored in a framebuffer. Parameters for this operation are prepared through a graphics pipeline's blend state.
How to do it...
- Create a variable of type
VkPipelineColorBlendAttachmentState
namedattachment_blend_states
. - For each color attachment used in a subpass in which a given graphics pipeline is bound, add a new element to the
attachment_blend_states
vector. If theindependentBlend
feature is not enabled, all elements added to theattachment_blend_states
vector must be exactly the same. If this feature is enabled, elements may be different. Either way, use the following values to initialize members of each...