A pixel effect is a texture to texture transformation that defines a pixel shader. Example of a pixel effect is a ripple:
public static PixelEffect Ripple(this PointBl Center, DoubleBl Amplitude,
DoubleBl Frequency, DoubleBl Phase) {
return new PixelEffect(Input => new Texture(UV => {
PointBl ToPoint = UV - Center;
DoubleBl Distance = ToPoint.Length;
PointBl Direction = ToPoint / Distance;
PointBl Wave = new Angle2DBl(Frequency * Distance + Phase).ToPoint;
DoubleBl Falloff = (1d - Distance).Saturate.Square;
DoubleBl Lighting = (Wave.Y * Falloff).Saturate * 0.2 + 0.8;
PointBl Distance2 = Distance + Amplitude * Wave.X * Falloff;
ColorBl Color = Input[Center + Distance2 * Direction];
var Color2 = ColorBl.FromScRGB(Color.ScA, Color.ScRGB * Amplitude.Lerp(1d, Lighting));
return Color2;
}));
}
The above pixel effect is self contained and creates a ripple, as
