My Early Shadertoy Shaders

These are some of the first few Shadertoy shaders I made. They are quite old now and some are simple compared to newer shaders on the site but I still think they are quite fun and interesting.

Coffee and Tablet

Shadertoy had video streaming quite early and I wanted to try displaying the video on a reflective screen. I thought a tablet would be quite an easy thing to model with Signed Distance Fields.

I also wanted to experiment with using the closest distance from a line to a point to show a glowing lightsource.

Candlestick

This shader came about from me playing around with different materials. I started toying with the cubemap feature and to make the reflections pop I applied an inverse tonemap function to recreate an HDR cubemap from an LDR one. There are also some hacks to try to get an approximation of diffuse lighting from the cubemap too.

Jack-o’-lantern

(Press play to see the shader, it fades in and starts dark).

This was a doodle I did for halloween. The main things I was looking at was the bumpmap / material on the floor, the glowing effect of light shining through the pumpkin and using the 2d SDF that is used to cut the shape of the face from the pumpkin to provide a bloom / glow effect.

Spout

This was my first experiment with raymarching transparent objects.

Larval

I had seen a number of people implement similar KIFS fractals on Shadertoy and wanted to experiment with one myself. I was trying to get the lighting and shading to be very fast so there is very simple lighting and a reflection that just looks up the cubemap. I also wanted to get some sort of approximate bloom / glow effect based on the distance field.

There is a version with additional parameters here https://www.shadertoy.com/view/Msffzn

Shadertoy

I wanted to try to reproduce the Shadertoy logo in shadertoy.

The characters are made up of a mixture of curve segments, ovals filled in triangles and filled in convex quadrilaterals.

I made another Shadertoy to illustrate how the curved segments work.

https://www.shadertoy.com/view/Xds3Dn

I could probably have made something generic to extract the data from the font but I actually made a javascript program that I used to plot the curves manually, tracing over an image of the Shadertoy logo. You can see some of the characters have slightly wonky outlines from my manual plotting of the data.

Reprojection

(press play to see animation)

There were only a couple of images available on Shadertoy so I wanted to do something with them. I thought if I modelled some of the scenery in 3D, I could project the image onto the 3D scene and this would allow a small amount of camera movement. Fortunately the sweeping curve of the buildings in the scene is geometrically quite simple.

Click in the image to see the 3D scene the image is projected onto.

I had to take this photo in Piccadilly Circus when visiting London in 2018.

Check it out, I’m in Shadertoy!

Me in Piccadilly Circus

Reprojection II

(press play to see animation)

Following on from the above experiment, I did the same thing with one of the shadertoy cubemaps. Again, it was lucky that the geometry in the cubemap was quite simple.

Click on the image to see the 3d scene.

Chains and Gears

This shader pre-dates shadertoy and was originally written for glsl sandbox. I had just started looking at raymarching and was experimenting with domain repetition and rotational symmetry.

Timewarp

This shader also pre-dates shadertoy and was originally written for glsl sandbox. I had started to experiment with SDF domain warping and thought this would be a fun thing to make with the technique.

http://glsl.heroku.com/e#2606

This was clearly inspired by the clocks in the Dali painting “Persistence of Memory”.

Dali surrealist painting Persistence of Memory with pictures of melting / warped clocks

Palindrome

I had made a number of scenes and effects in Shadertoy and wanted to make something bigger with more of a demo production feel to it.

There were a number of audio tracks on Shadertoy so I made something to fit in with one of them.

I quite like how the camera movement turned out. This is animated along a spline.

The audio is also used to drive the intensity of the light inside the pyramid. The light uses a cubemap texture to project a pattern onto the walls.

Something that is quite different in Shadertoy where we have all the information in one shader is that we can vary a lot of things per pixel. We wouldn’t be able to do if we were using rasterization to draw triangles. In this shader I randomly offset the scene time for each pixel to give a simple motion blur effect. This gave me the idea to do the rewind at the end of the sequence (and hence the shader name). When The shader is rewinding, different pixels on the screen are rewinding by different amounts based on a sine wave pattern from the centre of the screen which gives the crazy distorted look.

Cheesy

After experimenting a bit with Signed Distance Field modelling and Ray Marching, I wanted to try something different and made a more traditional raytracer where the geometry is intersected analytically. This shader does CSG with interval arithmetic by figuring out the spans of rays that are inside an object (i.e. when a ray enters and exits the object) and then performing CSG on these spans.

The holes in the cheese were a good fit for this. When a ray hits the cheese, it uses the intersection position as a seed to generate a random hole nearby.