[Unity] Star Glow

Question Kid
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:

  1. Extract bright regions that are above a certain threshold
  2. Apply blur effect along the star streak direction
  3. Combine all the blur images together as a composite image
    Blend OneMinusDstColor One
  4. 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;

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Question Kid
Question Kid

Written by Question Kid

An interactive engineer based in Tokyo. CG/Unity/Coding/Book Review

No responses yet

Write a response