Shader Battle
Make the image on the left match the image on the right by editing the fragment shader code below.
Here, we're making a kaleidoscope-esque effect. The images below are sliced up like pies and given a repeated pattern. You'll have to flip every second slice so that they all mirror each other like in the image on the right.
Make These Images Match
By Editing This Code
What do I do With This Thing?
The pixels in the image can be manipulated with the fragment shader code written above.
Fragment shaders run once for each pixel in an image. Each run is given the coordinate of a pixel in the image, and outputs the color we want that pixel to have.
Fragment shaders are written in GLSL. Think of it as a strange dialect of C.
GLSL has various built-in functions, see the official documentation.
Note that in GLSL, floats can't be used together with ints as you may be used to. I recommend using only floats, e.g. 2.0, and not ints, e.g. 2, when solving these tasks.
If you've got the time, The Book of Shaders has a nice introduction, and a lot more.