This really isn’t a true saturation shader, but I was bored, and I was at the moment determined to make my game the most colorful game ever. So, I added a simple for loop to my desaturation-except-reds shader.
Original picture:
First attempt:
Less loop iterations:
Different algorithm:
Turning the hurt up:
A little bit closer:
Got what I wanted:
What a waste of my half-hour. Enjoy the awesomeness.
float4 saturated;
for ( int i = 0; i < 4; i += 1 )
{
//BLACK AND WHITE
//saturated = (original*original)/((grayscale-0.1)/0.9);
// REGULAR
//saturated = (original*original)/(grayscale);
// SATURATE
//saturated = ((original+1)*(original));
// DESATURATE ALTERNATE
//saturated = ((original+1)*(original+1))*(grayscale);
// Keep this line for good luck
original = saturated;
}
Yeah, that looks awesome (I like the black-white version). I’d appreciate if you would explain the use of these shaders here (is it also makeable in free version of Unity?).
Thank you guys for the complements. : )
Well, it’ll be Pro-only, because obviously it’s a screen shader. I don’t have the time at the moment to give a totally in depth picture tutorial, but here’s what I did:
+In the Pro Standard Assets, there’s a screen shader called “GrayscaleEffect.” Ironically, this is what you use to get more color, more because it’s a very simple shader and easy to remove everything. Duplicate the shader and C# script to your own name. Mine is called “RedscaleEffect” because the shader I originally used to convey the player’s health.
+Take the shader, and rename it. Remove all the grayscale ramp samplers and fields. You should be left with the following code in the pixel/fragment program:
+The resultant code is really easy to understand. It actually does nothing. Now that you have a basic shell for ANY color based shader, you can now fool around. Enjoy.
+The red in some of the shots is due to the redscale code in my version of the shader. It is a threshold. The way it works is if the original scene’s red is greater than the threshold, and the created scene is darker than the threshold, then the created scene will get the red from the original scene. When combined with the contrast code, everything gets all unpredictable, and so some cool effects spring up.