Raymarcher Technical & APi Documentation
Raymarcher Core Structure
The Structure
Raymarcher is constructed from a collection of classes and components, forming a complex framework with a specific structure that follows a strict data flow.

Raymarcher exists when the user creates a 'Raymarcher Session' in the Wizard window.
The Raymarcher Session is saved as a unique .shader file along with all its dependencies.
This shader is automatically generated and managed by Raymarcher's converter system.

To remove a Raymarcher Session, the user can delete the Raymarcher object in the scene or invoke 'Remove Raymarcher Session' directly on the RMRenderMaster.
The session can also be cloned and moved to a new scene.
However, if the user clones the session, they are responsible for the previous Raymarcher session data and its dependencies.
In essence, the Raymarcher Session is bound to a specific Unity scene but can be transferred across different scenes by manually cloning the session.

Raymarcher is divided into five major groups:

1. Raymarcher Renderer
This category contains the core rendering system and the data communication pipeline between the CPU and GPU.
It includes core rendering data, mapping master, lighting data, and material master.


2. Raymarcher Object Entities
This category contains all components representing 'SDF objects' and their modifiers.
Specifically, it includes the object base class (from which all SDF objects inherit), the modifier base class (from which all modifiers inherit), and shared modifier containers.


3. Raymarcher Materials
This category contains all components related to Raymarcher's material pipeline.
Raymarcher features its own material pipeline, including the material base object (from which each material instance inherits), material identifier (each material type with its unique identifier),
and material data buffer (each material type inheriting from this class).


4. Raymarcher Converter from User Language to Shader Language
This category contains three individual classes of the converter:
- SdfObjectBuffer converter (converts SDF objects from human language to shader)
- MaterialBuffer converter (converts materials from human language to shader)
- Common converter (converts render master material source from human language to shader)


5. Raymarcher's Toolkit
This category includes a comprehensive toolkit library that Raymarcher features.
It's an out-of-the-box library that users can use without touching the code.
The library features various voxel painters, volume depth samplers, mesh-to-volume renderers, volume character controllers, and more.





Render Types
Raymarcher features three distinct render types: Quality, Standard, and Performant.
Each render type comes with its own set of advantages and disadvantages in terms of memory allocation and performance, as well as different limitations and possibilities for using Raymarcher components.


Quality (experimental)
The Quality render type represents the highest rendering quality available in Raymarcher. It utilizes the highest precision (float) and enables all the features provided by the Raymarcher package.
Allocating a single SDF object costs 32 bytes of memory. It synchronizes every SDF object's full transform (passing a full transform matrix to the shader) with position, rotation, and scale, along with the active state.
This render type allows the use of a texture per object instance with locally set 'uvs', and each object can have its own unique color in the full RGB range.
Additionally, global and per-object materials can be used.
This render type is suitable for high-end devices, mostly used for experimental projects, and is not recommended for production-use.


Standard (recommended in most cases)
The Standard render type is the recommended choice, as it employs a mix of high and half precision (float/half) and enables most of the Raymarcher features.
Allocating a single SDF object costs 16 bytes of memory. It synchronizes every SDF object's full transform with position, rotation, scale, and active state.
While it allows a hue shift per-object, there is no full RGB range possibility, and no texture per-object is supported (use materials instead).
Global and per-object materials can be utilized.
This render type is suitable for most devices and is ready for production use.


Performant (recommended for mobiles/WebGL/low-end devices)
The Performant render type is the most resource-efficient option in Raymarcher. It uses the lowest precision (half) and enables fewer Raymarcher features.
Allocating a single SDF object costs 8 bytes of memory. It synchronizes only the position of each SDF object (use rotation modifiers for syncing object rotation and an active state modifier for syncing the active status).
Similar to the Standard type, it allows a hue shift per-object, but there is no full RGB range possibility, and no texture per-object is supported (use materials instead).
Only global materials can be used, no per-object materials.
This render type is suitable for low-end devices and is ready for production use.

Please carefully choose the appropriate render type when setting up the Raymarcher renderer. It's also possible to switch to a different render type even after the Raymarcher has been configured.