Fork me on GitHub

GPU Shader Experiments

Real-time procedural 3D scene generation using ray marching and distance field (also known as 'sphere tracing') accelerated rendering techniques.


Distance Field - Lighting, shadows, AO and camera animation. High-resolution render with anti-aliasing and depth-of-field effect.

Waves - plane deformation, simple reflections.

Waves 2 - more advanced sea water shading, frensel reflections. High-resolution render with anti-aliasing and distance blur effect.

Mountains (in the sunset) - several techniques combined and refined, including real-time fractal noise based terrain generation, natural lighting and height based fogging. Inspiration is again from IQ's amazing work. High-resolution render with anti-aliasing. Nice pink sunset version of same scene. Also a version with reflective water.

Mountains Terrain 1 - more real-time fractal noise based terrain generation, experimenting and learning new noise generation techniques. Trying to add detail to noise in interesting ways. High-resolution render with anti-aliasing.

Mountains Terrain 2 - noise based terrain generation - this one has nice valleys with sharp peaks, details are smoother. Learnt more noise techniques from this article. High-resolution render with anti-aliasing, and another.

Crater Terrain - advanced noise based crater terrain generation. This article has details on using the derivatives from perlin noise to improve the terrain. High-resolution render with anti-aliasing, and another.

Circles of Hell - depth fogging and perlin noise based terrian marching. The fog and glowing rock colour creates quite a hellish atmosphere! High-resolution render with anti-aliasing.

Reflective Spheres - real-time reflections, shadows and general old-skool shinyness.

Fractal - real-time 3D Sierpinski triangle fractal formula from here. High-resolution render with anti-aliasing.

Mandelbulb - real-time 3D mandelbulb fractal - with cool animation of the fractal power factor - formula from here. High-resolution render with anti-aliasing.

Mandelbox - explore the strange world of the mandelbox! Another very cool 3D fractal in real-time, see this thread for more info. High-resolution render with depth-of-field effect.

Mandelcube - Borg Cube?! Outside a more solid looking version of the mandelbox fractal.

Mengersponge - Inside the menger sponge fractal - a three-dimensional analog of the Sierpinski carpet, apparently.

Mengersponge 2 - A modified menger sponge cube - idea and original formula from IQ. This one looks nice with anti-aliasing on - and isn't too slow considering it's real-time!

Trefoil Knot - a set of interesting knot shapes - play with the parameters to create different variations.

Trefoil Knot 2 - on a classic checkerboard floor material with noise texture on the knot surface, plus real-time depth-of-field effect when anti-aliasing is enabled.

Polyhedra Playground - lots of shape possibilities using the 'cut and fold' icosahedral polyhedra generation technique.

Polyhedra Playground 2 - more advanced combination of 'cut and fold' - generates more elaborate shapes. High-resolution render with anti-aliasing and depth-of-field effect.

Polyhedra Playground 3 - textured polyhedra shapes shown as faces, vertices and segments.

Subsurface Hexafield - trying out sub-surface scattering glow effects. High-resolution render with anti-aliasing and depth-of-field effect.

Glowing Columns - more sub-surface scattering glow effects on larger objects, with some wizzy camera animation.

Alien Lake - plane deformation with noise textures, reflections and post effects.

Animated CSG shape - animation of various cut out shapes.

Distance Field 1 - my first success once I got the technique working! Pretty basic compared to the others here, but you have to start somewhere right?



Lots of code/ideas for these demos come from reading and experimenting with techniques from the following resources:

http://www.iquilezles.org/www/material/nvscene2008/rwwtt.pdf

Ray Marching Toolbox thread (pouet.net)

Ray Marching Beginners thread (pouet.net)

http://iquilezles.org/www/articles/distfunctions/distfunctions.htm

http://www.shadertoy.com

http://www.fractalforums.com

The general technique is explained from page 21 onwards in the above PDF link. If you want to understand this stuff read through the PDF and pouet.net links above!



...but they don't work on my machine!

These Web-GL demos work best on Linux or Mac which has good native OpenGL support. Most should work on Windows with a decent GPU.