RMObjectModifierBase
Namespace: Raymarcher.Objects.Modifiers
The RMObjectModifierBase class serves as a foundational class for scripts defining 'modifiers' for SDF objects within the Raymarcher renderer.
RMObjectModifierBase contains an interface implementation of ISDFEntity, establishing common parameters for all SDF entities, including modifiers.
For a visual representation of the data structure of Raymarcher objects and modifiers, refer to the image below:
Inherit from this class to define your custom SDF object modifier in the Raymarcher renderer.
After adding a modifier to a gameObject with any SDF object script in Unity, the Raymarcher will automatically integrate the modifier with the target SDF object. The converter will prompt for Raymarcher's recompilation.
It is crucial to accurately define the base modifier's properties that the RMObjectModifierBase class requires to be overridden.
Additionally, note that the order of modifiers in the inspector plays a significant role in the Raymarcher.
Some modifiers may exhibit different behavior if they are affected by 'more-prioritized' modifiers that are compiled first.
List of abstract methods and properties essential for proper modifier definition:
public virtual void SdfBufferRecompiled()
public abstract string SdfMethodName { get; }
public abstract ISDFEntity.SDFUniformField[] SdfUniformFields { get; }
public abstract string SdfMethodBody { get; }
public virtual string SdfMethodExtension { get; }
public abstract void PushSdfEntityToShader(in Material raymarcherSessionMaterial, in string iterationIndex);
public virtual InlineMode ModifierInlineMode() => InlineMode.PostSdfInstance;
public virtual object CreateSharedModifierContainer { get; } = null;
public virtual bool ModifierSupportsSharedContainer { get; } = false;
public virtual void PassModifierDataToSharedContainer()
public virtual void PassSharedContainerDataToModifier()
List of public fields and properties shared among all Raymarcher modifiers:
protected const string VARCONST_POSITION = "p";
protected const string VARCONST_SDF = "sdf";
protected const string VARCONST_MATERIAL_INSTANCE = "materialInstance";
protected const string VARCONST_MATERIAL_TYPE = "materialType";
protected const string VARCONST_COLOR = "color";
public RMSdfObjectBase SdfTarget { get; }
public RMObjectModifierSharedContainer SharedModifierContainer { get; }