This page looks best with JavaScript enabled

Adding an Accent to our Contrast Shader - Lets Make a Side Scrolling Shooter - Part 4

 ·   ·  ☕ 1 min read

Lets spice up our our contrasting transition shader with an accent color that more clearly marks the border between one color and the next.

Part 1 of building this contrasting shader is here: https://www.youtube.com/watch?v=jJcSbixSy5c

Most of the magic of this shader happens in these lines which select the color we want to draw:

float maskPrimary = (_Transition + barrierSize [LESS THAN] maskStrength);
float maskSecondary = (_Transition - barrierSize [GREATER THAN] maskStrength);
float maskAccent = !(maskPrimary || maskSecondary);
o.Albedo = maskPrimary * _PrimaryColor
  + maskSecondary * _SecondaryColor
  + maskAccent * _AccentColor;

Come join the World of Zero Discord channel to talk software, game development and more: https://discord.gg/hU5Kq2u


Sam Wronski
WRITTEN BY
Sam Wronski
Maker of things and professional software engineer. Lets make something awesome together!