CompositorEffect

package
v0.0.0-...-20ed0ac Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2025 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

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.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advanced

type Advanced = class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

type Any

type Any interface {
	gd.IsClass
	AsCompositorEffect() Instance
}

type EffectCallbackType

type EffectCallbackType int //gd:CompositorEffect.EffectCallbackType
const (
	// The callback is called before our opaque rendering pass, but after depth prepass (if applicable).
	EffectCallbackTypePreOpaque EffectCallbackType = 0
	// The callback is called after our opaque rendering pass, but before our sky is rendered.
	EffectCallbackTypePostOpaque EffectCallbackType = 1
	// 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).
	EffectCallbackTypePostSky EffectCallbackType = 2
	// The callback is called before our transparent rendering pass, but after our sky is rendered and we've created our back buffers.
	EffectCallbackTypePreTransparent EffectCallbackType = 3
	// The callback is called after our transparent rendering pass, but before any built-in post-processing effects and output to our render target.
	EffectCallbackTypePostTransparent EffectCallbackType = 4
	// Represents the size of the [EffectCallbackType] enum.
	EffectCallbackTypeMax EffectCallbackType = 5
)

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this [Extension]See Interface for methods that can be overridden by T.

func (*Extension[T]) AsCompositorEffect

func (self *Extension[T]) AsCompositorEffect() Instance

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsRefCounted

func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted

func (*Extension[T]) AsResource

func (self *Extension[T]) AsResource() Resource.Instance

type ID

type ID Object.ID

ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Implementation

type Implementation = implementation

Implementation implements Interface with empty methods.

type Instance

type Instance [1]gdclass.CompositorEffect

Instance of the class with convieniently typed arguments and results.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AccessResolvedColor

func (self Instance) AccessResolvedColor() bool

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

Note: In RenderCallback, to access the resolved buffer use:

func (Instance) AccessResolvedDepth

func (self Instance) AccessResolvedDepth() bool

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

Note: In RenderCallback, to access the resolved buffer use:

func (Instance) AsCompositorEffect

func (self Instance) AsCompositorEffect() Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsRefCounted

func (self Instance) AsRefCounted() [1]gd.RefCounted

func (Instance) AsResource

func (self Instance) AsResource() Resource.Instance

func (Instance) EffectCallbackType

func (self Instance) EffectCallbackType() EffectCallbackType

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

func (Instance) Enabled

func (self Instance) Enabled() bool

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

func (Instance) ID

func (self Instance) ID() ID

func (Instance) NeedsMotionVectors

func (self Instance) NeedsMotionVectors() bool

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

Note: In RenderCallback, to access the motion vector buffer use:

func (Instance) NeedsNormalRoughness

func (self Instance) NeedsNormalRoughness() bool

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, to access the roughness buffer use:

The raw normal and roughness buffer is stored in an optimized format, different than the one available in Spatial shaders. When sampling the buffer, a conversion function must be applied. Use this function, copied from here:

func (Instance) NeedsSeparateSpecular

func (self Instance) NeedsSeparateSpecular() bool

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.

func (Instance) SetAccessResolvedColor

func (self Instance) SetAccessResolvedColor(value bool)

SetAccessResolvedColor sets the property returned by [GetAccessResolvedColor].

func (Instance) SetAccessResolvedDepth

func (self Instance) SetAccessResolvedDepth(value bool)

SetAccessResolvedDepth sets the property returned by [GetAccessResolvedDepth].

func (Instance) SetEffectCallbackType

func (self Instance) SetEffectCallbackType(value EffectCallbackType)

SetEffectCallbackType sets the property returned by [GetEffectCallbackType].

func (Instance) SetEnabled

func (self Instance) SetEnabled(value bool)

SetEnabled sets the property returned by [GetEnabled].

func (Instance) SetNeedsMotionVectors

func (self Instance) SetNeedsMotionVectors(value bool)

SetNeedsMotionVectors sets the property returned by [GetNeedsMotionVectors].

func (Instance) SetNeedsNormalRoughness

func (self Instance) SetNeedsNormalRoughness(value bool)

SetNeedsNormalRoughness sets the property returned by [GetNeedsNormalRoughness].

func (Instance) SetNeedsSeparateSpecular

func (self Instance) SetNeedsSeparateSpecular(value bool)

SetNeedsSeparateSpecular sets the property returned by [GetNeedsSeparateSpecular].

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

type Interface

type Interface interface {
	// Implement this function with your custom rendering code. 'effect_callback_type' should always match the effect callback type you've specified in [EffectCallbackType]. 'render_data' provides access to the rendering state, it is only valid during rendering and should not be stored.
	//
	// [EffectCallbackType]: https://pkg.go.dev/graphics.gd/classdb/CompositorEffect#Instance.EffectCallbackType
	RenderCallback(effect_callback_type int, render_data RenderData.Instance)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL