Table of Contents

Class CompositorEffect

Namespace
Godot
Assembly
GodotSharp.dll

This resource defines a custom rendering effect that can be applied to Viewports through the viewports' Environment. You can implement a callback that is called during rendering at a given stage of the rendering pipeline and allows you to insert additional passes. Note that this callback happens on the rendering thread. CompositorEffect is an abstract base class and must be extended to implement specific rendering logic.

public class CompositorEffect : Resource, IDisposable
Inheritance
CompositorEffect
Implements
Inherited Members

Constructors

CompositorEffect()

public CompositorEffect()

Properties

AccessResolvedColor

If true and MSAA is enabled, this will trigger a color buffer resolve before the effect is run.

Note: In _RenderCallback(int, RenderData), to access the resolved buffer use:

var render_scene_buffers : RenderSceneBuffersRD = render_data.get_render_scene_buffers()
  var color_buffer = render_scene_buffers.get_texture("render_buffers", "color")
public bool AccessResolvedColor { get; set; }

Property Value

bool

AccessResolvedDepth

If true and MSAA is enabled, this will trigger a depth buffer resolve before the effect is run.

Note: In _RenderCallback(int, RenderData), to access the resolved buffer use:

var render_scene_buffers : RenderSceneBuffersRD = render_data.get_render_scene_buffers()
  var depth_buffer = render_scene_buffers.get_texture("render_buffers", "depth")
public bool AccessResolvedDepth { get; set; }

Property Value

bool

EffectCallbackType

The type of effect that is implemented, determines at what stage of rendering the callback is called.

public CompositorEffect.EffectCallbackTypeEnum EffectCallbackType { get; set; }

Property Value

CompositorEffect.EffectCallbackTypeEnum

Enabled

If true this rendering effect is applied to any viewport it is added to.

public bool Enabled { get; set; }

Property Value

bool

NeedsMotionVectors

If true this triggers motion vectors being calculated during the opaque render state.

Note: In _RenderCallback(int, RenderData), to access the motion vector buffer use:

var render_scene_buffers : RenderSceneBuffersRD = render_data.get_render_scene_buffers()
  var motion_buffer = render_scene_buffers.get_velocity_texture()
public bool NeedsMotionVectors { get; set; }

Property Value

bool

NeedsNormalRoughness

If true this triggers normal and roughness data to be output during our depth pre-pass, only applicable for the Forward+ renderer.

Note: In _RenderCallback(int, RenderData), to access the roughness buffer use:

var render_scene_buffers : RenderSceneBuffersRD = render_data.get_render_scene_buffers()
  var roughness_buffer = render_scene_buffers.get_texture("forward_clustered", "normal_roughness")
public bool NeedsNormalRoughness { get; set; }

Property Value

bool

NeedsSeparateSpecular

If true this triggers specular data being rendered to a separate buffer and combined after effects have been applied, only applicable for the Forward+ renderer.

public bool NeedsSeparateSpecular { get; set; }

Property Value

bool

Methods

HasGodotClassMethod(in godot_string_name)

Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.

protected override bool HasGodotClassMethod(in godot_string_name method)

Parameters

method godot_string_name

Name of the method to check for.

Returns

bool

HasGodotClassSignal(in godot_string_name)

Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.

protected override bool HasGodotClassSignal(in godot_string_name signal)

Parameters

signal godot_string_name

Name of the signal to check for.

Returns

bool

InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)

Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.

protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)

Parameters

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool

_RenderCallback(int, RenderData)

Implement this function with your custom rendering code. effectCallbackType should always match the effect callback type you've specified in EffectCallbackType. renderData provides access to the rendering state, it is only valid during rendering and should not be stored.

public virtual void _RenderCallback(int effectCallbackType, RenderData renderData)

Parameters

effectCallbackType int
renderData RenderData