Post-Process Shader - "Spartan" Scanline
Explanation:
Shader was a basic attempt at a dithering shader; specifically one that could only output in the base additive colors; Red, Green, Blue and Black.
It functioned using the output of the standard diffuse fragment shader in Unity; which it would then turn into an HSB value, then using a 'base value', set to 22 in the lower right (high res) example and iterating through various values in the other two, made decisions about how which color to send through as the output. In order to give the 'moving scanline' appearance; an iterator value is incremented every frame to offset the effect of the 'base value'.
It functioned using the output of the standard diffuse fragment shader in Unity; which it would then turn into an HSB value, then using a 'base value', set to 22 in the lower right (high res) example and iterating through various values in the other two, made decisions about how which color to send through as the output. In order to give the 'moving scanline' appearance; an iterator value is incremented every frame to offset the effect of the 'base value'.
Pseudocode Logic:
If the base value was 7, it would repeat the pattern {0, 1/7, 2/7, 3/7, 4/7, 5/7, 6/7} throughout the image.
If blackness > value; output color is black.
If Saturation < value; output color is white
{White is defined as pixel position red/green/blue sequentially (using modulus on the pixel position as an array index)}
Else
Block repeats for each {Red, Green, Blue}:
{
If the hue is closest to {Red, Green, Blue}
{
If the color is closer than value*120 degrees on the color wheel; Display {Red, Green, Blue}
Else; Display second closest color.
}
}
Apologies; this is an old project and I've lost the source. These .gif's are all that remain of the project.
WIP video:
Video of earlier version, which only used random numbers (static) and only separated into black and white.