Just a repost of one of my first shaders on Shadertoy. This is a simple realtime path tracer, implemented in a WebGL fragment shader. The shader shows motion blur, depth of field and importance sampling.
The path tracer is based on this excellent article about path tracing by Iñigo Quílez.
To speed up rendering I cast a ray through a 2d grid. For all grid cells in the line of sight, an intersection test is done with two spheres in each cell, until a sphere is hit. The (pseudo-random) offset of the two spheres in each cell is based on the time and the hash of the id of the cell.
You can find (the full source of) the fragment shader on Shadertoy: https://www.shadertoy.com/view/lsX3DH.
I have also rendered a movie of this shader. You can find this movie on YouTube.
If you like this post, you may also like one of my other posts:
- Yet another Cornell Box
- Robotic Arm
- Wolfenstein: Ray Tracing On using WebGL1
- Old watch: a WebGL path tracer
- Ray Tracing – Primitives