premult
Converts a color from 'straight alpha' to 'premultiplied alpha' format, a critical step for correct semi-transparent blending.
Core Advantages
By performing the `output.rgb = input.rgb * input.a` conversion, it ensures correct rendering of semi-transparent effects like fire and glass during alpha blending, fundamentally preventing common artifacts like black fringes on texture edges and ensuring compatibility with modern rendering pipelines.
Common Uses
At the end of any custom transparent material, to format the final color output for correct GPU blending.
In post-processing, to normalize layers before compositing them together simply and correctly.
Before processing straight-alpha textures with filters like blur inside a shader, to prevent interpolation errors.
How to adjust
This node has no adjustable parameters; it performs a fixed mathematical conversion. Its effect is entirely determined by the input color's alpha channel: an alpha of 1.0 results in no change to RGB, an alpha of 0.5 halves the RGB values, and an alpha of 0.0 turns RGB to 0 (black).
Code Examples
1// In a transparent material, combine color and opacity, then convert to premultiplied alpha
2const finalColor = premult( vec4( baseColor, opacity ) );