reckfellENGINE

CompositorEffect

Base callback resource for a compositor stage.

On this page
class CompositorEffectReckfellSharpInherits Resource

Create a C# subclass, override _RenderCallback and add the resource to Compositor.CompositorEffects. Defaults are enabled, PostTransparent and all additional-data flags false. Without a custom callback the base resource produces no visual result.

Forward+ dispatches five stages; current Mobile only PreOpaque, PreTransparent and PostTransparent. Requesting PostOpaque on Mobile warns; PostSky is not dispatched there. PostTransparent runs before subsequent postprocessing and tonemapping. Do not use Max as a stage.

Complete executed diagnostic class. It counts callbacks and frames with valid RIDs for every view, but does not run a compute shader or change the image:

C#
using System.Threading;
using Reckfell;

[GlobalClass]
public partial class BufferProbeEffect : CompositorEffect
{
    private int callbacks;
    private int validFrames;
    public int CallbackCount => Volatile.Read(ref callbacks);
    public int ValidFrameCount => Volatile.Read(ref validFrames);

    public BufferProbeEffect()
    {
        EffectCallbackType = EffectCallbackTypeEnum.PostTransparent;
    }

    public override void _RenderCallback(int effectCallbackType, RenderData renderData)
    {
        if (effectCallbackType != (int)EffectCallbackTypeEnum.PostTransparent)
            return;

        Interlocked.Increment(ref callbacks);
        if (renderData.GetRenderSceneBuffers() is not RenderSceneBuffersRD buffers)
            return;

        Vector2I size = buffers.GetInternalSize();
        if (size.X <= 0 || size.Y <= 0 || buffers.GetViewCount() == 0)
            return;

        for (uint view = 0; view < buffers.GetViewCount(); view++)
        {
            if (!buffers.GetColorLayer(view).IsValid || !buffers.GetDepthLayer(view).IsValid)
                return;
        }
        Interlocked.Increment(ref validFrames);
    }
}

RenderData and buffers are borrowed from the renderer. Do not retain them after the callback, free borrowed RIDs or change the Entity tree from the render thread. Use GetInternalSize() and process all GetViewCount() layers. GPU work requires the main RenderingDevice; a local device does not own frame RIDs.

Dispatch, valid RIDs and Enabled were checked on Windows/Vulkan Forward+ and Mobile. The unsupported PostOpaque warning remains in the raw report. Additional buffers and MSAA were source-reviewed; their contents, shaders, XR, resizing and performance were not tested in this run.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

CompositorEffectConstructor
# CompositorEffect
C#
public CompositorEffect();

Creates an enabled base effect at PostTransparent with all additional flags false. The base callback does not change the image; override _RenderCallback in a subclass.

Properties7

AccessResolvedColorProperty
# AccessResolvedColor
C#
public bool AccessResolvedColor { get; set; }

Requests ordinary resolved color before an intermediate stage with MSAA; initially false. It neither disables MSAA nor converts the format to LDR. Hidden in Inspector for PostTransparent. Request only when needed; a valid RID does not mean an early stage contains completed scene color.

AccessResolvedDepthProperty
# AccessResolvedDepth
C#
public bool AccessResolvedDepth { get; set; }

Requests resolved MSAA depth; initially false. Support depends on renderer and device; true does not guarantee resolved depth in every configuration. Hidden in Inspector for PostTransparent. This is neither linearized depth nor a reverse-Z switch.

EffectCallbackTypeProperty
# EffectCallbackType
C#
public CompositorEffect.EffectCallbackTypeEnum EffectCallbackType { get; set; }

Callback stage, initially PostTransparent. Forward+ dispatches PreOpaque, PostOpaque, PostSky, PreTransparent and PostTransparent. Current Mobile dispatches only PreOpaque, PreTransparent and PostTransparent: PostOpaque warns and PostSky is not called. PostTransparent precedes subsequent postprocessing and tonemapping. Max is a sentinel, not a valid stage.

EnabledProperty
# Enabled
C#
public bool Enabled { get; set; }

Whether the effect is enabled; defaults to true. False excludes it from dispatch without deleting the resource or GPU objects it created. No CompositorEffects array reassignment is needed; queued frames can finish with the previous state.

NeedsMotionVectorsProperty
# NeedsMotionVectors
C#
public bool NeedsMotionVectors { get; set; }

Requests motion-vector preparation in Forward+; initially false. Describes the effect’s requirement, not guaranteed buffer availability in every renderer. Enabling it can change rendering preparation; do not request unused data.

NeedsNormalRoughnessProperty
# NeedsNormalRoughness
C#
public bool NeedsNormalRoughness { get; set; }

Requests normal/roughness in Forward+ and affects prepass preparation; initially false. Does not automatically make those data available in Mobile. Check the appropriate buffer and stage before use.

NeedsSeparateSpecularProperty
# NeedsSeparateSpecular
C#
public bool NeedsSeparateSpecular { get; set; }

Requests separate specular in Forward+ at PostSky; initially false. Inspector hides this property for other stages. Current Mobile does not dispatch PostSky. This requests data rather than automatically producing a visual effect.

Methods15

GetAccessResolvedColorbool
# GetAccessResolvedColor
C#
public bool GetAccessResolvedColor();

Returns the value of CompositorEffect.AccessResolvedColor.

Returns bool

The current CompositorEffect.AccessResolvedColor value; reading a request flag does not establish corresponding buffer availability.

GetAccessResolvedDepthbool
# GetAccessResolvedDepth
C#
public bool GetAccessResolvedDepth();

Returns the value of CompositorEffect.AccessResolvedDepth.

Returns bool

The current CompositorEffect.AccessResolvedDepth value; reading a request flag does not establish corresponding buffer availability.

GetEffectCallbackTypeCompositorEffect.EffectCallbackTypeEnum
# GetEffectCallbackType
C#
public CompositorEffect.EffectCallbackTypeEnum GetEffectCallbackType();

Returns the value of CompositorEffect.EffectCallbackType.

Returns CompositorEffect.EffectCallbackTypeEnum

The selected stage. Execution depends on the renderer and compositor attachment.

GetEnabledbool
# GetEnabled
C#
public bool GetEnabled();

Returns the value of CompositorEffect.Enabled.

Returns bool

True when the effect is enabled; this does not establish actual callback dispatch for the active camera.

GetNeedsMotionVectorsbool
# GetNeedsMotionVectors
C#
public bool GetNeedsMotionVectors();

Returns the value of CompositorEffect.NeedsMotionVectors.

Returns bool

The current CompositorEffect.NeedsMotionVectors value; reading a request flag does not establish corresponding buffer availability.

GetNeedsNormalRoughnessbool
# GetNeedsNormalRoughness
C#
public bool GetNeedsNormalRoughness();

Returns the value of CompositorEffect.NeedsNormalRoughness.

Returns bool

The current CompositorEffect.NeedsNormalRoughness value; reading a request flag does not establish corresponding buffer availability.

GetNeedsSeparateSpecularbool
# GetNeedsSeparateSpecular
C#
public bool GetNeedsSeparateSpecular();

Returns the value of CompositorEffect.NeedsSeparateSpecular.

Returns bool

The current CompositorEffect.NeedsSeparateSpecular value; reading a request flag does not establish corresponding buffer availability.

SetAccessResolvedColorvoid
# SetAccessResolvedColor
C#
public void SetAccessResolvedColor(bool enable);

Assigns the value of CompositorEffect.AccessResolvedColor.

Parameters
NameTypeDefault
enablebool—
enable

New request value for CompositorEffect.AccessResolvedColor.

SetAccessResolvedDepthvoid
# SetAccessResolvedDepth
C#
public void SetAccessResolvedDepth(bool enable);

Assigns the value of CompositorEffect.AccessResolvedDepth.

Parameters
NameTypeDefault
enablebool—
enable

New request value for CompositorEffect.AccessResolvedDepth.

SetEffectCallbackTypevoid
# SetEffectCallbackType
C#
public void SetEffectCallbackType(CompositorEffect.EffectCallbackTypeEnum effectCallbackType);

Assigns the value of CompositorEffect.EffectCallbackType.

Parameters
NameTypeDefault
effectCallbackTypeCompositorEffect.EffectCallbackTypeEnum—
effectCallbackType

A stage supported by the selected renderer; not Max. Current Mobile does not execute PostOpaque or PostSky.

SetEnabledvoid
# SetEnabled
C#
public void SetEnabled(bool enabled);

Assigns the value of CompositorEffect.Enabled.

Parameters
NameTypeDefault
enabledbool—
enabled

True to enable, false to exclude from callbacks; property CompositorEffect.Enabled.

SetNeedsMotionVectorsvoid
# SetNeedsMotionVectors
C#
public void SetNeedsMotionVectors(bool enable);

Assigns the value of CompositorEffect.NeedsMotionVectors.

Parameters
NameTypeDefault
enablebool—
enable

New request value for CompositorEffect.NeedsMotionVectors.

SetNeedsNormalRoughnessvoid
# SetNeedsNormalRoughness
C#
public void SetNeedsNormalRoughness(bool enable);

Assigns the value of CompositorEffect.NeedsNormalRoughness.

Parameters
NameTypeDefault
enablebool—
enable

New request value for CompositorEffect.NeedsNormalRoughness.

SetNeedsSeparateSpecularvoid
# SetNeedsSeparateSpecular
C#
public void SetNeedsSeparateSpecular(bool enable);

Assigns the value of CompositorEffect.NeedsSeparateSpecular.

Parameters
NameTypeDefault
enablebool—
enable

New request value for CompositorEffect.NeedsSeparateSpecular.

_RenderCallbackvoid
# _RenderCallback
C#
public virtual void _RenderCallback(int effectCallbackType, RenderData renderData);

Renderer hook for the selected stage. Override in a subclass; do not call it manually as a substitute for rendering. Use RenderData and its buffers only during the callback; neither retain them for another frame nor release borrowed RIDs. Do not modify the Entity tree or UI on the render thread. Process every XR view and obtain dimensions from RenderSceneBuffersRD.GetInternalSize().

Parameters
NameTypeDefault
effectCallbackTypeint—
renderDataRenderData—
effectCallbackType

The dispatched stage number; compare with EffectCallbackTypeEnum. It is neither effect count nor frame index.

renderData

Borrowed data for the current pass, valid only inside the callback. Obtain RenderSceneBuffers and check its concrete type.

CompositorEffect.EffectCallbackTypeEnum

ValueDescription
Max = 5

Represents the size of the CompositorEffect.EffectCallbackTypeEnum enum.

PostOpaque = 1

The callback is called after our opaque rendering pass, but before our sky is rendered.

PostSky = 2

The callback is called after our sky is rendered, but before our back buffers are created (and if enabled, before subsurface scattering and/or screen space reflections).

PostTransparent = 4

The callback is called after our transparent rendering pass, but before any built-in post-processing effects and output to our render target.

PreOpaque = 0

The callback is called before our opaque rendering pass, but after depth prepass (if applicable).

PreTransparent = 3

The callback is called before our transparent rendering pass, but after our sky is rendered and we've created our back buffers.

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.