3 ms·
You write GLSL, which is a shader language. Specifically, in this case, you write code that determines the color of a pixel given its coordinates (and some othe
by Netcob 6y ago
You write GLSL, which is a shader language. Specifically, in this case, you write code that determines the color of a pixel given its coordinates (and some other input variables).
On Shadertoy, they use WebGL to create a little rendering pipeline that in the simplest configuration renders two triangles to form a rectangle, using your GLSL code. Since it's WebGL (should be supported by all modern browsers, mobile included), that code is executed directly on your GPU.
In more complex Shadertoy scenarios, you can do multiple passes where you render to different buffers and then use those buffers as textures in other passes. One of the uses of that is keeping state between frames, which would not be possible in a purely shader-based system otherwise. For example, if you have some sort of player character you move around the world, you may use one pixel to store the position, another to store the rotation and so on. Or you can use the image output from the previous frame as the input for the next frame to compute IIR functions, simulate cellular automatons and so on. I think by now you can even render to cube maps and multiple viewports (for VR).
There's even a "sound" shader you can write that is called once and then renders a waveform for one minute and then plays that back while displaying the regular shader.