GPU Shader Experiments

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


Water - fresnel reflections, fractal noise animation and height maps, refraction and transparency.

Choppy Waves - improved sea water shading. High-resolution render with anti-aliasing.

Deep Sea Waves - sea water shading, fresnel reflections and attenuation. High-resolution render with anti-aliasing and distance blur effect.

Volumetic Clouds - volumetic clouds over deep sea water. Thanks to David Hoskins technique from shadertoy for the clouds magic.

Sandy Shore - sandy shoreline with water refraction. High-resolution render with anti-aliasing.

Ibiza Sunset - sunset shoreline with beach ball. This has multiple surface types and a simplified shadow test to keep the performance up. High-resolution render.

Simple Waves - first try at moving water surface - basic plane deformation, simple reflections.

Terrain - fractal noise height maps, natural lighting, fogging.

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.
Really enjoyed experimenting with this terrain, so tried adding reflective water etc. which looks nice but was no longer real-time! Here are a few renders of the lakes in the mountains: [1] [2] [3]

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.

Tried some experiments with real 3D noise fractal terrain - everything else above is made from simple 2D fractal height maps. This allows overhangs, caves and proper depth etc. in the surface but is definitely not real-time! Here are some of the rock surface results: [1] [2] [3] [4] [5]

Fractals - Mandel, Menger and Sierpinski fractals generated in real-time.

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!

Shiny things - reflections, soft shadows, procedural surfaces.

Point Lighting - good quality shadows from a point light source, blinn specular highlights and textured marble surface.

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

Reflections and liquid metal - reflections, shadows and some liquid metal "Terminator 2" effects on a classic marble floor.

Reflective materials over water - reflections, shadows and multiple material types.

Infinite shape field - randomly generated, highly reflective shapes over liquid metal surface.

Polyhedra and knots - shapes, folds and knots with formulas mainly from www.fractalforums.com.

Trefoil Knot 1 - 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 1 - 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.

Miscellaneous and demos - stuff that doesn't fit anywhere else, and my early attempts at the technique.

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

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

Animated Hexfield - hemispherical AO from this article plus edge rendering.

Shaded Hexfield - hemispherical AO, texture bump mapping with simple environment mapping and edge rendering.

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.