TStaticBlendState

A static RHI blend state resource.

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

RHI

Header

/Engine/Source/Runtime/RHI/Public/RHIStaticStates.h

Include

#include "RHIStaticStates.h"

Syntax

template<EColorWriteMask RT0ColorWriteMask, EBlendOperation RT0ColorBlendOp, EBlendFactor RT0ColorSrcBlend, EBlendFactor RT0ColorDestBlend, EBlendOperation RT0AlphaBlendOp, EBlendFactor RT0AlphaSrcBlend, EBlendFactor RT0AlphaDestBlend, EColorWriteMask RT1ColorWriteMask, EBlendOperation RT1ColorBlendOp, EBlendFactor RT1ColorSrcBlend, EBlendFactor RT1ColorDestBlend, EBlendOperation RT1AlphaBlendOp, EBlendFactor RT1AlphaSrcBlend, EBlendFactor RT1AlphaDestBlend, EColorWriteMask RT2ColorWriteMask, EBlendOperation RT2ColorBlendOp, EBlendFactor RT2ColorSrcBlend, EBlendFactor RT2ColorDestBlend, EBlendOperation RT2AlphaBlendOp, EBlendFactor RT2AlphaSrcBlend, EBlendFactor RT2AlphaDestBlend, EColorWriteMask RT3ColorWriteMask, EBlendOperation RT3ColorBlendOp, EBlendFactor RT3ColorSrcBlend, EBlendFactor RT3ColorDestBlend, EBlendOperation RT3AlphaBlendOp, EBlendFactor RT3AlphaSrcBlend, EBlendFactor RT3AlphaDestBlend, EColorWriteMask RT4ColorWriteMask, EBlendOperation RT4ColorBlendOp, EBlendFactor RT4ColorSrcBlend, EBlendFactor RT4ColorDestBlend, EBlendOperation RT4AlphaBlendOp, EBlendFactor RT4AlphaSrcBlend, EBlendFactor RT4AlphaDestBlend, EColorWriteMask RT5ColorWriteMask, EBlendOperation RT5ColorBlendOp, EBlendFactor RT5ColorSrcBlend, EBlendFactor RT5ColorDestBlend, EBlendOperation RT5AlphaBlendOp, EBlendFactor RT5AlphaSrcBlend, EBlendFactor RT5AlphaDestBlend, EColorWriteMask RT6ColorWriteMask, EBlendOperation RT6ColorBlendOp, EBlendFactor RT6ColorSrcBlend, EBlendFactor RT6ColorDestBlend, EBlendOperation RT6AlphaBlendOp, EBlendFactor RT6AlphaSrcBlend, EBlendFactor RT6AlphaDestBlend, EColorWriteMask RT7ColorWriteMask, EBlendOperation RT7ColorBlendOp, EBlendFactor RT7ColorSrcBlend, EBlendFactor RT7ColorDestBlend, EBlendOperation RT7AlphaBlendOp, EBlendFactor RT7AlphaSrcBlend, EBlendFactor RT7AlphaDestBlend>
class TStaticBlendState : public TStaticStateRHI< TStaticBlendState< RT0ColorWriteMask, RT0ColorBlendOp, RT0ColorSrcBlend, RT0ColorDestBlend, RT0AlphaBlendOp, RT0AlphaSrcBlend, RT0AlphaDestBlend, RT1ColorWriteMask, RT1ColorBlendOp, RT1ColorSrcBlend, RT1ColorDestBlend, RT1AlphaBlendOp, RT1AlphaSrcBlend, RT1AlphaDestBlend, RT2ColorWriteMask, RT2ColorBlendOp, RT2ColorSrcBlend, RT2ColorDestBlend, RT2AlphaBlendOp, RT2AlphaSrcBlend, RT2AlphaDestBlend, RT3ColorWriteMask, RT3ColorBlendOp, RT3ColorSrcBlend, RT3ColorDestBlend, RT3AlphaBlendOp, RT3AlphaSrcBlend, RT3AlphaDestBlend, RT4ColorWriteMask, RT4ColorBlendOp, RT4ColorSrcBlend, RT4ColorDestBlend, RT4AlphaBlendOp, RT4AlphaSrcBlend, RT4AlphaDestBlend, RT5ColorWriteMask, RT5ColorBlendOp, RT5ColorSrcBlend, RT5ColorDestBlend, RT5AlphaBlendOp, RT5AlphaSrcBlend, RT5AlphaDestBlend, RT6ColorWriteMask, RT6ColorBlendOp, RT6ColorSrcBlend, RT6ColorDestBlend, RT6AlphaBlendOp, RT6AlphaSrcBlend, RT6AlphaDestBlend, RT7ColorWriteMask, RT7ColorBlendOp, RT7ColorSrcBlend, RT7ColorDestBlend, RT7AlphaBlendOp, RT7AlphaSrcBlend, RT7AlphaDestBlend >, FBlendStateRHIRef, FRHIBlendState * >

Remarks

A static RHI blend state resource. TStaticBlendStateRHI<...>::GetStaticState() will return a FBlendStateRHIRef to a blend state with the desired settings. Should only be used from the rendering thread.

Alpha blending happens on GPU's as: FinalColor.rgb = SourceColor * ColorSrcBlend (ColorBlendOp) DestColor * ColorDestBlend; if (BlendState->bSeparateAlphaBlendEnable) FinalColor.a = SourceAlpha * AlphaSrcBlend (AlphaBlendOp) DestAlpha * AlphaDestBlend; else Alpha blended the same way as rgb

Where source is the color coming from the pixel shader, and target is the color in the render target.

So for example, TStaticBlendState<BO_Add,BF_SourceAlpha,BF_InverseSourceAlpha,BO_Add,BF_Zero,BF_One> produces: FinalColor.rgb = SourceColor * SourceAlpha + DestColor * (1 - SourceAlpha); FinalColor.a = SourceAlpha * 0 + DestAlpha * 1;

Functions

Name Description

Public function Static

FBlendStateR...

 

CreateRHI()

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss