Skip to content
Gabriel Sales Dorea (Gassa)
Lab

Lab UI material · Unreal Engine 5

Circular desaturation

A small UI material built to understand the Desaturation node. A circle grows from the center to the edges and leaves the image in grayscale. The radius can loop on its own or be set from Blueprint or a UMG animation.

Breakdown

Domain
User Interface
Blend mode
Translucent
Used in
UMG Image brush
Edge
Hard (Step)
  1. A circular mask from UV distance

    Subtracting 0.5 centers the UVs, and VectorLength gives the distance to the center: 0 in the middle, 0.5 at the sides and about 0.707 at the corners. A Step against the radius feeds the Fraction input of Desaturation. The texture alpha goes to Opacity to keep the cutout.

  2. Two ways to drive the radius

    Time multiplied by AnimSpeed goes through Sine and ConstantBiasScale to loop between 0 and 1. Or EffectRadius sets it directly, which suits a cooldown or a disabled state.

    HLSL (equivalent Custom node)
    // Inputs: Color (float4), UV (float2), Radius (float)
    float dist = length(UV - 0.5);
    float mask = step(dist, Radius);               // 1 inside the circle
    float gray = dot(Color.rgb, float3(0.3, 0.59, 0.11));
    return lerp(Color.rgb, gray.xxx, mask);

Exposed parameters

Texture
image to desaturate
AnimSpeed
speed of the loop (0.3)
EffectRadius
radius of the circle; 0.71 or more covers the corners

Next iteration

  • Soft edge: replace Step with a narrow SmoothStep.
  • Multiply the UV by the aspect ratio so the circle is not stretched on a rectangular card.
  • Glowing rim from the difference between two Steps with close radii.

Known issues

Corners stay colored at radius 0.5
center to corner is about 0.707, so the radius has to reach 0.71