[Unity] Star Glow
Mar 30, 2021

This is an example show that how to use post-processing to create the star glow effect.
ApplyBrightnessEffect(src, brightness);
ApplyBlurEffect(brightness, blur1, blur2, composite);
CompositeEffect(src, dst, composite);
The overall idea could be summarized as the following steps:
- Extract bright regions that are above a certain threshold
- Apply blur effect along the star streak direction
- Combine all the blur images together as a composite image
Blend OneMinusDstColor One
- Combine the composite image with the original image
The blurred image along is computed as :
for (int j = 0; j < 4; j++) {
color += saturate(tex2D(_MainTex, uv) * pow(_BlurAttenuation,
i.power * j));
uv += i.offset;
}
where we define the offset as :
var glowAngle = anglePerDivision * i + glowAngleOffset;
var blurOffset = (Quaternion.AngleAxis(glowAngle, Vector3.forward) * Vector2.up).normalized;offset = _MainTex_TexelSize.xy * _BlurOffset * o.power;