Overview | Documentation | Support

Glow Effect is designed to be as flexible and efficient as possible. It is also optimized to be able run on mobile devices. This package contains four different methods of generating glow:

Setup
Adding the glow effect can be done in as little as three steps:

Customizable Values

The following variables can be modified to customize the way your glow effect looks:

Standard Glow Effect

The source of the glow can come from up to four different sources: the main texture, glow texture, glow color, or vertex color. In Unity 4.1 and beyond you can specify what source to use on each material. Prior to Unity 4.1 you are limited to specifying it for the scene. The amount of glow is based off of the glow texture. This glow texture is different between the standard glow effect and the alpha glow effect. In both cases, main texture is your standard main texture for the shader.

Alpha Glow Effect

The alpha glow effect is very efficient because it does not need to a separate camera to apply the glow. The alpha glow effect uses the object's alpha channel to determine the amount to glow. A glow mask texture can be provided to prevent areas from glowing. A glow mask value of 1 (white) means the fragment should glow and a value of 0 (black) means it should not glow. A limitation of the alpha glow effect is that you cannot have an object in the transparent queue and not glow. If your design requires this, use the standard glow method. It will run just fine on most modern devices. If the camera’s background color is visible in the game and a glowing object is in the foreground then the alpha channel must be set to 1 of the camera's background color to get the full glow effect.

Built-In Shaders

BuiltInShaders.unitypackage/BuiltInShaders4.3+.unitypackage contains a modified version of the Unity built in shaders to add glow (with standard glow) or remove glow (with alpha glow). The 4.3+ versions includes the built in shaders starting with Unity 4.3.

Creating your own Shaders

Standard Glow Effect

Add the following to your shader:

See the Glow.shader and GlowAlphaBlend.shader in the Shaders folder for examples.

Alpha Glow Effect

Add the following to your shader:

The following is an example of a surface shader that applies the alpha glow effect:

            void surf (Input IN, inout SurfaceOutput o) {
                        half4 c = tex2D (_MainTex, IN.uv_MainTex);
                        half4 g = tex2D (_GlowMask, IN.uv_MainTex);
                        o.Albedo = c.rgb;
                        o.Alpha = g.a;
            }

Examples of these shaders can be found in the Shaders folder as AlphaGlow.shader, AlphaGlowAlphaBlend.shader and SurfaceAlphaGlow.shader.

Shaders/UnlitNoGlow.shader provides an example of no glow occuring when using the alpha channel method. It returns 0 for the alpha channel.

If you have any questions please post on the forum or contact support@opsive.com.