Raymarched Bounding Volumes
is a collection of
Unity
packages designed to enhance the visualization and manipulation of complex geometries through
raymarching techniques. This repository provides the following packages:
RBV
: The core package that introduces the fundamental capabilities for raymarched bounding volumes, enabling efficient rendering and manipulation of3D
objects.RBV.4D
: An extension package that introduces four-dimensional features, allowing for dynamic exploration of4D
geometries in a familiar3D
space, with full compatibility withRBV Features
.RBV.Heatmapping
: A specialized extension designed to visualize raymarched bounding volumes using heatmaps, providing intuitive exploration, debugging, and performance analysis by mapping raymarching iterations to color gradients.
Raymarched Bounding Volumes
equips developers with essential tools for achieving advanced graphical results.
RBV
(short for
Raymarched Bounding Volumes
) is a core package for raymarching in Unity. It is designed for the
effective visualization and manipulation of 3D objects and their combinations.
The name Raymarched Bounding Volumes
comes from the idea of
using bounding volumes to define the rendering space for raymarching, which has been proven to be more effective
than rendering in the entire screen space
(refer to
RaymarchingRenderingSpacePerformanceTesting
).
- Ready-to-Use Configurable 3D Objects
A wide variety of 3D objects that can be easily customized to suit your needs.
- Ready-to-Use Configurable Combining Operations
Utilize various operations to combine 3D objects in creative ways, enabling complex scene creation with ease.
- Operation Nesting Support
Supports nesting of operations up to
10
levels deep (currently a hardcoded value, but could be easily made dynamic, wait for future updates). - Editor and Runtime Object Creation/Deletion Support
Create and delete objects seamlessly during both the editing phase and at runtime.
- High Reactivity
All object and operation properties are observable, ensuring immediate feedback and interaction.
- Render Settings for Each Object
Customize render settings for each object, currently supporting color adjustments.
- Advanced Shading Options
Configurable shading per material, with support for four types of shadows, ambient occlusion, and
Unity
directional and ambient light. - Raymarching Configuration
Fine-tune raymarching settings on a per-material basis, including iterations, accuracy, and far rendering plane.
- GPU Instancing
Leverage GPU instancing for the main
RaymarchedVolume
shader, improving performance. - Shared Shader Depth
Utilizing the same pixel depth system as
Unity
,RBV
ensures accurate depth calculations and allows for correct intersections and overlapping with standardUnity
objects, enhancing the integration between raymarched and conventional elements in your scene. - Bounding Volumes
Limit the rendering space of raymarching to improve performance by confining calculations to specific areas.
- Raymarched Volume Mesh Configuration
Change the mesh scale for object bounding volumes to suit various visualization needs.
- Custom Inspectors
Features custom property drawers, material property drawers, custom attributes, and editors for a tailored user experience.
RBV
package using one of the following methods:
- Unity Package Manager
- Open
Unity
, then go toWindow -> Package Manager
. - Click on the drop-down and select
Add package from git URL...
. - Paste the following
URL
and clickAdd
:https://github.com/danliukuri/RaymarchedBoundingVolumes.git?path=RaymarchedBoundingVolumes.Unity/Assets/Plugins/RBV
RBV/Samples
in thePackage Manager
and clickImport
for the desired ones. - Open
- Download From Releases
- Go to the
Releases Page
. - Download the desired package(s):
- Core package:
[email protected]
. - Samples (optional):
[email protected]
.
- Core package:
- Import the package(s) into your
Unity
project.
- Go to the
RBV
package, follow these steps to set up your scene:
- Open your Desired Scene
Begin by opening theUnity
scene where you want to use raymarching. - Navigate to the Prefabs Folder
Go to the package's prefabs folder located atRBV/Prefabs
. - Add the Raymarching Engine
Drag and drop theRaymarchingEngine
prefab into your scene hierarchy. This object contains two crucial components:RaymarchingServicesRegister
: Serves as the entry point for the package, handling the creation of services and their dependencies.RaymarchingSceneUpdater
: The main loop of the package lifecycle, ensuring proper shader data updates and managing the construction of the raymarching scene.
- Add Raymarched Objects and Operations
Now that your scene is set up, you can start dragging and droppingRaymarchedObject
andRaymarchingOperation
prefabs into the scene, tailoring it to suit your specific needs. - Configure the Visualization Space
Last step is to configure the visualization space for the raymarching volume. For more details on how to do this, refer to theVolume Mesh Configuration
section.
RBV
utilizes the concept of bounding volumes, scaling the
Transform
adjusts the raymarching space scale. To address this, the mesh of the volume itself can be
scaled. For simplifying this process, the
RaymarchedVolumeMeshConfigurator
has been designed, enabling straightforward adjustments to the mesh scale.
To utilize the
RaymarchedVolumeMeshConfigurator
, follow these steps:
- Drag and Drop the Configurator Prefab
Drag and drop theRaymarchedVolumeMeshConfigurator
prefab located atRBV/Prefabs
into the desired scene. - Parent Volume GameObjects
Parent the desired volume-definingGameObjects
to theRaymarchedVolumeMeshConfigurator
. This can include not onlyRaymarchedObjects
, as the volume is not limited to them; volume mesh renderers can exist as separateGameObjects
. - Set the Mesh via Context Menu
In the context menu of theRaymarchedVolumeMeshConfigurator
component, select one of the options to set the mesh for the children. - Adjust the Mesh Size
Change the size of the mesh by modifying theSize
field in theRaymarchedVolumeMeshConfigurator
component.
PentakisDodecahedron
is used as the default mesh due to its efficiency in defining an accurate
sphere shape with minimal vertices and triangles. Additionally, the package includes the
Icosahedron
mesh. Moreover, the regular Unity
cube mesh can also work well in many cases.
Tip
RBV
, the following samples have been created.
Cover
,
where you can observe how numerous
RaymarchedObject
instances smoothly unite to create a cohesive composition.

RBV
cover scene preview
Warning
RBV
and raymarching in
general, as this scene has many
RaymarchedObject
instances concentrated in one area. Since they occupy the entire camera
rendering screen space, we do not gain any performance benefits from utilizing bounding volumes. Given that
raymarching is inherently slow, this scene may even lead to performance issues for all the aforementioned reasons.
RBV
package.
Note
RBV/Samples
, symbolic inks were utilized. If you're using Windows
, refer to
Symbolic Links in Windows
for more information.
RBV.4D
is an extension package for RBV
that
introduce four-dimensional features. It enables the visualization and manipulation of 4D
objects within
raymarched volumes by slicing through these objects along a fourth spatial dimension and projecting them into
3D
, while leveraging all the techniques provided by the core RBV
package.
This functionality allows for dynamic exploration of 4D
geometry in a familiar 3D
space.
- Ready-to-Use Configurable 4D Objects
Provides pre-configured4D
objects that are easily customizable and ready for immediate use in your scene. - 4D Transformations
Enables movement, rotation, and scaling of4D
objects along the fourth spatial dimension, while remain supporting such transformations in the standard three dimensions.
Note
RBV.4D
explicitly depends on RBV
, ensure the
base package is installed before proceeding.
See RBV Installation
for more details.
RBV.4D
package using one of the following methods:
- Unity Package Manager
- Open
Unity
, then go toWindow -> Package Manager
. - Click on the drop-down and select
Add package from git URL...
. - Paste the following
URL
and clickAdd
:https://github.com/danliukuri/RaymarchedBoundingVolumes.git?path=RaymarchedBoundingVolumes.Unity/Assets/Plugins/RBV.4D
RBV.4D/Samples
in thePackage Manager
and clickImport
for the desired ones. - Open
- Download From Releases
- Go to the
Releases Page
. - Download the desired package(s):
- Core package:
[email protected]
. - Samples (optional):
[email protected]
.
- Core package:
- Import the package into your
Unity
project.
- Go to the
RBV.4D
package, follow the same steps for
Scene Construction
as in the RBV
package to set up your scene. The only differences are:
- Step 3: Add the Raymarching Engine
Add theRaymarchingEngine4D
prefab, which contains the sameRaymarchingSceneUpdater
component but includes theRaymarching4DServicesRegister
. This component extendsRaymarchingServicesRegister
and additionally handling the creation of 4D-related services and their dependencies. - Step 4: Add Raymarched Objects and Operations
With theRBV.4D
package installed, you can use4D
objects by dragging and dropping theRaymarchedObject4D
into the scene.
RBV.4D/Prefabs
.
RBV.4D
, the following samples have been created.
Cover
, where you can observe how numerous
RaymarchedObject4D
instances smoothly unite to create a cohesive composition. In this scene,
you can also observe how seamlessly 4D
objects interact with regular raymarched ones.

RBV.4D
cover scene preview
Warning
RBV.4D
and raymarching in
general, as this scene has many
RaymarchedObject4D
instances concentrated in one area. Since they occupy the entire camera
rendering screen space, we do not gain any performance benefits from utilizing bounding volumes. Given that
raymarching is inherently slow, this scene may even lead to performance issues for all the aforementioned reasons.
RBV.4D
package.
Note
RBV.4D/Samples
, symbolic inks were utilized. If you're using Windows
, refer to
Symbolic Links in Windows
for more information.
RBV.Heatmapping
is a specialized extension package for
RBV
designed to visualize raymarched bounding volumes using heatmaps by mapping
raymarching iterations to color gradients, allowing for intuitive exploration, debugging, and analysis.
- Settings in Unity Preferences
Configure heatmapping parameters on a per-user basis through the
Unity Editor Preferences
, allowing for seamless integration and flexibility. - Customizable Textures
The package comes with three built-in heatmap textures, while also supporting customizable textures to tailor color gradients to specific visualization needs.
Note
RBV.Heatmapping
explicitly depends on
RBV
, ensure the base package is installed before proceeding.
See RBV Installation
for more details.
RBV.Heatmapping
package using one of the following
methods:
- Unity Package Manager
- Open
Unity
, then go toWindow -> Package Manager
. - Click on the drop-down and select
Add package from git URL...
. - Paste the following
URL
and clickAdd
:https://github.com/danliukuri/RaymarchedBoundingVolumes.git?path=RaymarchedBoundingVolumes.Unity/Assets/Plugins/RBV.Heatmapping
- Open
- Download From Releases
- Go to the
Releases Page
. - Download the desired package:
[email protected]
. - Import the package into your
Unity
project.
- Go to the
RBV.Heatmapping
package in action, it must first be enabled
in the settings for all materials that utilize the
RaymarchedVolume
shader.
- Open the
Unity Editor Preferences
and navigate to theRaymarched Bounding Volumes/Heatmapping
settings. -
Enable the heatmapping feature using the
Enabled
toggle field.
Texture
field will be used for the heatmap visualization. By default, the
HitmapMagma
texture is specified.

RBV.Heatmapping
settings in
Unity Editor Preferences
HitmapCustom
texture selected and setting the maximum number of iterations for ray marching to 32
will result in the
following appearance for the scene
(for clarity, the background is set to the color corresponding to zero iterations):

Scene heatmap example with texture, showcasing the corresponding color for each iteration
For more details, refer to the
RaymarchingRenderingSpacePerformanceTesting
RBV.Heatmapping
package.