babylon.quarks - v1.0.0
    Preparing search index...

    Type Alias BlendOutput

    BlendOutput: "straight" | "premultiply" | "multiply"

    How a particle's colour has to leave the fragment shader for its blend mode, so that its alpha means coverage: alpha 0 leaves the frame as it was, alpha 1 draws the colour in full, and the fades (soft particles, erosion, a rim fade, alpha over life) only lower alpha. Unity's particle shaders do the same for their Alpha, Premultiply, Additive and Multiply modes. Alpha has no such meaning for an opaque material, nor under ALPHA_INTERPOLATE (constant blend colour), ALPHA_REPLACE_COLOR (replaces the frame) and ALPHA_DUAL_SRC0_ADD_SRC1xDST (reads a second shader output the particle shaders do not write); these leave the colour as it is.

    • 'straight': the blend weighs the colour by its alpha itself (Babylon's ALPHA_COMBINE, ALPHA_ADD, ALPHA_LAYER_ACCUMULATE, …) or does not blend; the colour leaves as it is.
    • 'premultiply': the blend takes the colour at full weight, or the frame by one minus the colour (ALPHA_PREMULTIPLIED, ALPHA_ONEONE, ALPHA_SCREENMODE, ALPHA_SUBTRACT, ALPHA_MAXIMIZED, ALPHA_MAX, …), so the shader multiplies it by its alpha: black, which these modes leave the frame alone with, at alpha 0. Textures stay straight alpha, as in Unity's Premultiply mode. The fade is linear in alpha except under ALPHA_MAXIMIZED, whose blend weighs the colour by alpha once more, and ALPHA_MAX.
    • 'multiply': the blend multiplies the frame by the colour (ALPHA_MULTIPLY, ALPHA_MIN), so the shader moves it toward white, which leaves the frame alone, as alpha falls. ALPHA_MIN clamps a frame brighter than 1 (an HDR target) to 1 where a particle draws, even at alpha 0.