Limitations

Raymarching is an unusual technique for videogame developers, so there’re some things to be aware of when using this toolkit:

Performance

Since raymarching is a very performance-heavy rendering technique, a complex scene will rarely reach 60FPS at full resolution. Note that the Raymarching Toolkit requires a gaming-grade GPU, and its performance is bound to certain limitations:

  • Every operation adds a considerable performance hit: as you add objects, blends and modifiers, your max framerate will go down.
    • We recommend having less than 10 raymarched objects in a scene.
    • You’ll need to be creative and use as few operations as possible to construct your scene. For example, complex scenes can be made out of objects that use the Repeat modifier. One object + One infinitely repeating modifier is cheaper to render than two or more objects!
  • After adding or removing an object or component the Unity Editor might slow down while the shader regenerates, depending on scene complexity.
    • This only happens when the scene’s structure changes, not when changing parameters, nor at runtime.

We included common optimizations to render your scene faster, and we’ve been successful in making interesting scenes run at good framerates on a gaming-grade GPU using these:

  • A slider in the Raymarcher component lets you render the scene at a lower resolution. Rendering at 70% resolution usually looks just as good and runs considerably faster.
  • The shader can be set to only regenerate manually.
  • Shadows and ambient occlusion can be tweaked or disabled.
  • A raymarched scene can be rendered only inside of an area or a regular mesh, taking full advantage of dynamic occlusion.

Object hierarchy cannot change in Play mode

Normally in Unity it’s fine to re-parent an object at runtime.

When using the Raymarching toolkit, the structure of your scene can’t be changed at runtime. This is because the shader that is automatically generated in the Editor has that structure baked into it, and can’t be regenerated during Play mode.

That means you can’t add or delete raymarched objects, blends, and modifiers during Play mode.

However, you can change the objects, blends and modifiers’ parameters to change how they look, you can move/rotate/scale the objects to change where they are.

  • A workaround to “add and remove” objects is to add multiple objects to your scene in the Editor and move them out of sight of your camera until you need them to be visible.

Objects that don’t have a Raymarching Toolkit component can be re-parented as usual.

Some modifiers require “Extra Accuracy” knob

Modifiers that twist and bend space around your objects may result in visual artifacts like holes appearing.

You can use the “Extra Accuracy” slider in the Raymarcher component to trade more GPU time for greater accuracy and minimize some of these artifacts.

Doesn’t work with orthographic cameras.

Currently the toolkit only supports cameras in perspective mode.