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
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
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
Enabled
If true this rendering effect is applied to any viewport it is added to.
public bool Enabled { get; set; }
Property Value
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
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
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
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_nameName of the method to check for.
Returns
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_nameName of the signal to check for.
Returns
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_nameName of the method to invoke.
args
NativeVariantPtrArgsArguments to use with the invoked method.
ret
godot_variantValue returned by the invoked method.
Returns
_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
intrenderData
RenderData