HypernovaDesktop Components · docs
Binarymission
WPFShaders Library › FrostedGlassEffect

FrostedGlassEffect

class.NET 6 / 8 / 10.NET Framework 4.8Binarymission.WPF.Shaders.Library.CustomEffects

A pixel shader effect that scatters each pixel of its input by a small pseudo-random amount, which reads as frosted or etched glass laid over it.

public class FrostedGlassEffect : ShaderEffect

Inherits from / implements: ShaderEffect

Remarks

The randomness is computed from the coordinate rather than sampled from a noise texture, so the effect ships as a shader and nothing else. That also makes the scatter fixed for a given Seed: animate the seed, not just the frostiness, to make the glass shimmer.

Members at a glance

FrostedGlassEffectInitializes a new instance of the FrostedGlassEffect class.
FrostinessHow far a pixel may be displaced, in texture coordinates. A useful range is about 0.002 to 0.05; beyond that the input stops being readable.
InputThe image this effect is applied to. It is set for you when the effect is attached to an element; set it directly only when using the effect as a brush.
SeedShifts the scatter pattern. Any value gives a different arrangement of the same frostiness, so animating it shimmers the glass without changing how rough it looks.
FrostinessPropertyIdentifies the Frostiness dependency property.
InputPropertyIdentifies the Input dependency property.
SeedPropertyIdentifies the Seed dependency property.

Constructors

FrostedGlassEffect

public FrostedGlassEffect()

Initializes a new instance of the FrostedGlassEffect class.

Properties

Frostiness

public double Frostiness

How far a pixel may be displaced, in texture coordinates. A useful range is about 0.002 to 0.05; beyond that the input stops being readable.

Input

public Brush Input

The image this effect is applied to. It is set for you when the effect is attached to an element; set it directly only when using the effect as a brush.

Seed

public double Seed

Shifts the scatter pattern. Any value gives a different arrangement of the same frostiness, so animating it shimmers the glass without changing how rough it looks.

Fields

FrostinessProperty

public static readonly DependencyProperty FrostinessProperty

Identifies the Frostiness dependency property.

InputProperty

public static readonly DependencyProperty InputProperty

Identifies the Input dependency property.

SeedProperty

public static readonly DependencyProperty SeedProperty

Identifies the Seed dependency property.