Color Contrast Shader - Lets Make a Side Scrolling Shooter - Part 3 @WorldOfZeroDevelopment
Color Contrast Shader - Lets Make a Side Scrolling Shooter - Part 3  @WorldOfZeroDevelopment
Uploaded July 2018 | Updated November 2026, 2 days ago
Continuing to build out our side scrolling shooter. We're going to be building an effect that is essential to one of the main mechanics I am trying to build for this game. A contrast between two colors that allows you to damage one but makes the other invulnerable. You'll need to switch at the correct time to effectively eliminate enemies. The effect will be composed from a simple shader based off of the same concepts from the [dissolving shader](youtu.be/rGt9haUx-aQ) we built previously.

Our shader is based off of this formula.

```
weight * colorA + (1 - weight) * colorB;
```

This formula uses a weight to balance between two colors. We can modify this by using a boolean value for the weight which will make it 1 when the boolean is true or 0 when the boolean is false. This will make it possible to turn our gradient between two colors into a hard transition instead.

We can modify our material in C# using code like this in order to animate it from code:

```csharp
material.SetFloat("_Transition", currentTransitionState);
```

Join the World of Zero Discord server: discord.gg/hU5Kq2u
Color Contrast Shader - Lets Make a Side Scrolling Shooter - Part 3Using AnimatedValues in Custom Unity EditorsI Built a Tool That Turns GitHub Contributions into Bookmarks Heres How It WorksBuilding Markdown Based Powerpoint Presentations with Remark.JSI See Game Objects - Unity Observer - Part 2Inline Initializing C# Dictionaries - Quick TipLive Coding a 3D Voxel Cube in UnitySetting Up A Minecraft ServerCreating our own Dockerized Mindustry ServerImporting .NET Libraries Into Unity 3DCounting Characters in a Bash String - Quick TipA Pixelated Shader - Circular Pixel Shader - Part 1
World of Zero |

Color Contrast Shader - Lets Make a Side Scrolling Shooter - Part 3

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER