Shaders - Unity-Technologies/EndlessRunnerSampleGame GitHub Wiki
The projects use 3 main custom shaders:
- Unlit/UnlitBlinking
- Unlit/CurvedUnlit
- Unlit/CurvedRotation
UnlitBlinking
UnlitBlinking is used by character. It is a very simple Unlit shader that just lerp between the normal texture color and a "bright" color (hard coded value of (1,1,0.75,1)) to do the blinking effect when character are hit and in their invincible phase.
The lerp factor, _BlinkingValue, is alternated between 0 and 1 in the script CharacterCollider
in the function InvincibleTimer
CurvedUnlit and CurvedRotation
Those are 2 shaders used by all the objects in the game world appart for the player. CurvedUnlit is used by set pieces and obstacles, and CurvedRotation is used by the collectible objects (fishbones, anchovies and powerup)
They both create the "horizon curve" effect the game use to hide the track segments being spawned and give a greater impression of speed and distance.
They simply move all vertex on the clip space y vector depending on the distance to the camera.
Curved rotation also make the object spin on it's origin along its local Y axis (see Optimizations for why is this)