This resource allows for creating a custom rendering effect.
This resource defines a custom rendering effect that can be applied to [Viewport]s 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.
Implement this function with your custom rendering code. [param effect_callback_type] should always match the effect callback type you've specified in [member effect_callback_type]. [param render_data] provides access to the rendering state, it is only valid during rendering and should not be stored.
If [code]true[/code] and MSAA is enabled, this will trigger a color buffer resolve before the effect is run.
[b]Note:[/b] In [method _render_callback], to access the resolved buffer use:
[codeblock]
var render_scene_buffers : RenderSceneBuffersRD = render_data.get_render_scene_buffers()
var color_buffer = render_scene_buffers.get_texture("render_buffers", "color")
[/codeblock]
If [code]true[/code] and MSAA is enabled, this will trigger a depth buffer resolve before the effect is run.
[b]Note:[/b] In [method _render_callback], to access the resolved buffer use:
[codeblock]
var render_scene_buffers : RenderSceneBuffersRD = render_data.get_render_scene_buffers()
var depth_buffer = render_scene_buffers.get_texture("render_buffers", "depth")
[/codeblock]
The type of effect that is implemented, determines at what stage of rendering the callback is called.
If [code]true[/code] this rendering effect is applied to any viewport it is added to.
If [code]true[/code] this triggers motion vectors being calculated during the opaque render state.
[b]Note:[/b] In [method _render_callback], to access the motion vector buffer use:
[codeblock]
var render_scene_buffers : RenderSceneBuffersRD = render_data.get_render_scene_buffers()
var motion_buffer = render_scene_buffers.get_velocity_texture()
[/codeblock]
If [code]true[/code] this triggers normal and roughness data to be output during our depth pre-pass, only applicable for the Forward+ renderer.
[b]Note:[/b] In [method _render_callback], to access the roughness buffer use:
[codeblock]
var render_scene_buffers : RenderSceneBuffersRD = render_data.get_render_scene_buffers()
var roughness_buffer = render_scene_buffers.get_texture("forward_clustered", "normal_roughness")
[/codeblock]
If [code]true[/code] this triggers specular data being rendered to a separate buffer and combined after effects have been applied, only applicable for the Forward+ renderer.
The callback is called before our opaque rendering pass, but after depth prepass (if applicable).
The callback is called after our opaque rendering pass, but before our sky is rendered.
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).
The callback is called before our transparent rendering pass, but after our sky is rendered and we've created our back buffers.
The callback is called after our transparent rendering pass, but before any build in post effects and output to our render target.
Represents the size of the [enum EffectCallbackType] enum.