Skip to main content

Inner Glow Filter (beta) Component

Overview

This component adds a visual inner glow effect to the UI object it is applied to, similar to the Photoshop effect.

Properties

Component Screenshot

Property                            TypeDetails
Glow
    SizeFloatThe distance the glow travels from the edge of the Graphic.
    ChokeFloatStarting from the edge, make more of the glow stronger.
    ContourCurveProvides additional falloff for the glow and can be used to shape it.
    Down SampleEnumHow to downsample the texture before blurring. Downsampling gives improved performance, however the quality can be lower especially when animation the blur amount, but for still images it's usually not noticeable. Options are:
Auto - Automatic downsampling will depend on the platform. Typically mobile platforms will get a half downsample. (DEFAULT)
None - No downsampling.
Half - Downsample to half the size.
Quarter - Downsample to a quarter the size.
Eighth - Downsample to an eighth the size.
Fill
    ModeEnumThe fill mode to apply colors to the glow. Options are:
Color - A solid color (DEFAULT).
Gradient - A gradient from left-right corresponding to edge-inner.
Gradient Texture - A texture where the gradient goes left-right.
    ColorColorThe color of the glow when FillMode is set to Color.
    GradientGradientThe color of the glow when FillMode is set to Gradient.
    Gradient TextureTexture2DThe color of the glow when FillMode is set to GradientTexture.
    NoiseFloatAdd noise to the glow. Best performance is set to zero.
    OpacityFloatAdjust opacity of the glow.
Apply
    Render SpaceEnumWhich coordinate system use when rendering this filter. Options are:
Canvas: Render the filter before any transforms (scale/rotation/translation etc) are applied.
Screen: Render the filter after transforms have been applied.
Read more about this property here.
    StrengthFloatStrength of the effect. Default value is 1.0, range is [0..1]

Usage

Add this component to any GameObject that contains a UI Graphic component (eg Text, Image, RawImage, etc). The object will now render with an inner glow.

Usage with TextMeshPro

To use this filter effect with TextMeshPro - Text (UI) use the Filter Stack (TextMeshPro) component.

Scripting

Namespace

The namespace
using ChocDino.UIFX;

Adding the InnerGlowFilter Component

Add the InnerGlowFilter component to your GameObject
// Add the component to your GameObject and set default properties
var glow = AddComponent<InnerGlowFilter>();

glow.BeginPropertyChange();
glow.Size = 24f;
glow.Choke = 0f;
glow.ContourCurve = new AnimationCurve(new Keyframe(0f, 0f, 1f, 1f), new Keyframe(1f, 1f, 1f, 1f));
glow.Downsample = Downsample.Auto;
glow.FillMode = InnerGlowFillMode.Gradient;
glow.Color = Color.white;
glow.Gradient = null;
glow.GradientTexture = null;
glow.Noise = 0f;
glow.Opacity = 1f;
glow.RenderSpace = FilterRenderSpace.Canvas;
glow.Strength = 1f;
glow.EndPropertyChange();