Coin Shimmer |
In the world of mobile development, lighting can bog your game down very easily. We needed an effect where a bunch of coins burst out to indicate the player had achieved a goal. I used a particle system emitting cylindrical meshes for the coins, but they looked stale without any lighting. Even with lighting turned on, the coins didn't glint and glimmer in a desired fashion. Using Shader Forge in Unity, I created a shader that masks out highlights based on screen position.
The shader is pretty simple. It maps a black and white mask across the screen with an additive effect on the white areas. This makes it so that when a coin moves across a certain part of the screen, it appears like it is catching the light and creating a shimmer effect.
The shimmer is also masked by the AO Mask (Essentially a Specular Map), so that the darker areas don't get blown out while shimmering.