/Compute-Shader-Fractal-Ray-Marching

Render engine which uses ray marching to render 3D fractals composed of folded primitives. Implemented using HLSL compute shaders through Unity3D.

Primary LanguageHLSL

Compute Shader Ray Marching

Render engine to use ray marching to render, in real-time, 3D fractals composed of (conformally) transformed primitives. Implemented using HLSL compute shaders through Unity3D. Unity is used to render the final image to screen and to handle user input. Inspired by http://blog.hvidtfeldts.net/index.php/2011/06/distance-estimated-3d-fractals-part-i/ .

When opening the UnityProject folder in Unity3D add the script (in the assets folder) 'Scripts/RayMarcher.cs' to the main camera.

Currently Implemented:

  • First-person movement through the fractals.
  • Unlit shading.
  • Lit shading by approximating normal vectors by using central difference.
  • Directional shadows by retracing from the point where a camera ray hits the geometry to the light source.
  • Surface glow implemented by visualising how close non-hitting rays get to the geometry.
  • Coarse ambient occlusion by using the number of marching steps as an analogue for the complexity of the geometry.
  • Position based coloring.
  • Color based visualisation of rendering complexity for each pixel by keeping track how many marches are required to terminate.

Screenshots