By Ward Dehairs, March 22, 2019

Raymarching is a special rendering technique that can be used to render "mathematical" objects that are far too complex for rasterization or even ray tracing. This can be strikingly beautiful on say fractals, since they tend to have simple mathematical descriptions and yet very complex shapes.

Even better, Raymarching is surprisingly enough possible to do in Unity!

Note that these are all rendered in real time in Unity! Doing so full screen does take good hardware but nothing too outrageous.

The Raymarching toolkit is ready and now available on the
Unity asset store.
It was named FERM for Fast Easy RayMarching. In particular I made 3 videos to showcase and explain the strengths of the toolkit.

The first video is a general trailer showing a andful of scenes rendered with FERM.

The second video showcases the audioreaction scripting.

And an example/tutorial video showing how you can create a specific effect.

Music credit to BenSound

A short explanation of the showcased scenes:

  • Title scene:
    The background is the SkyFractals scene. In the foreground there is a representation of the FERM logo, the F consists of smoothly mixed boxes, the E is a sphere with 2 boxes differenced away, the R is intersected with a rotating mandelbulb fractal and finnaly the M is a tilted capsule shape that is recursively scaled and mirrored.
  • MandelZoo:
    This is just an animated zoom in of the Mandelbulb fractal. The fractal is shaded with a gradient that depends on the radial coordinate. This gradient slowly shifts over time.
  • FERM rollaball:
    This is just a simple assembly of boxes, unioned and differenced to the point of making a functional rollaball setup. This result is repeated infinitely and bent to give the final effect. This is the only example using standard shading, with a basic gold scheme.
  • AudioReact soundscape:
    This scene is set up with a sierpinski fractal that deforms over time. This fractal is revolved around its primary axis to yield ring formations laid out in a cone. By rotating the source fractal, these rings grow, shrink, move, dissapear and appear. This fractal is repeated in the x- and z-axis directions and mixed smoothly with an infinite plane. This plane is also deformed by a 2D sine wave. The parameters of this scene are subject to audioreact input, which makes it respond to the music.
  • SkyFractals:
    This is the same mirror box fractal shown in the tutorial video. In this case, this fractal is stretched out infinitely using the modulo operator (which leaves a gap in the cardinal directions). This result is also slightly bent to hide infinite cubic grid artefacts. The shading is just a single color, only the regular occlusion effect is inverted: more 'occluded' surfaces are colored brightly, while the nearby surfaces are colored black.