2023-08-03 20:10:03 +08:00
<?xml version="1.0" encoding="UTF-8" ?>
2024-02-23 22:16:01 +08:00
<class name= "CompositorEffect" inherits= "Resource" experimental= "The implementation may change as more of the rendering internals are exposed over time." xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "../class.xsd" >
2023-08-03 20:10:03 +08:00
<brief_description >
This resource allows for creating a custom rendering effect.
</brief_description>
<description >
2024-08-10 12:28:31 +08:00
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. CompositorEffect is an abstract base class and must be extended to implement specific rendering logic.
2023-08-03 20:10:03 +08:00
</description>
<tutorials >
2024-08-15 13:04:12 +08:00
<link title= "The Compositor" > $DOCS_URL/tutorials/rendering/compositor.html</link>
2023-08-03 20:10:03 +08:00
</tutorials>
<methods >
<method name= "_render_callback" qualifiers= "virtual" >
<return type= "void" />
<param index= "0" name= "effect_callback_type" type= "int" />
<param index= "1" name= "render_data" type= "RenderData" />
<description >
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.
</description>
</method>
</methods>
<members >
<member name= "access_resolved_color" type= "bool" setter= "set_access_resolved_color" getter= "get_access_resolved_color" >
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]
</member>
<member name= "access_resolved_depth" type= "bool" setter= "set_access_resolved_depth" getter= "get_access_resolved_depth" >
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]
</member>
<member name= "effect_callback_type" type= "int" setter= "set_effect_callback_type" getter= "get_effect_callback_type" enum= "CompositorEffect.EffectCallbackType" >
The type of effect that is implemented, determines at what stage of rendering the callback is called.
</member>
<member name= "enabled" type= "bool" setter= "set_enabled" getter= "get_enabled" >
If [code]true[/code] this rendering effect is applied to any viewport it is added to.
</member>
<member name= "needs_motion_vectors" type= "bool" setter= "set_needs_motion_vectors" getter= "get_needs_motion_vectors" >
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]
</member>
<member name= "needs_normal_roughness" type= "bool" setter= "set_needs_normal_roughness" getter= "get_needs_normal_roughness" >
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]
</member>
<member name= "needs_separate_specular" type= "bool" setter= "set_needs_separate_specular" getter= "get_needs_separate_specular" >
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.
</member>
</members>
<constants >
<constant name= "EFFECT_CALLBACK_TYPE_PRE_OPAQUE" value= "0" enum= "EffectCallbackType" >
The callback is called before our opaque rendering pass, but after depth prepass (if applicable).
</constant>
<constant name= "EFFECT_CALLBACK_TYPE_POST_OPAQUE" value= "1" enum= "EffectCallbackType" >
The callback is called after our opaque rendering pass, but before our sky is rendered.
</constant>
<constant name= "EFFECT_CALLBACK_TYPE_POST_SKY" value= "2" enum= "EffectCallbackType" >
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).
</constant>
<constant name= "EFFECT_CALLBACK_TYPE_PRE_TRANSPARENT" value= "3" enum= "EffectCallbackType" >
The callback is called before our transparent rendering pass, but after our sky is rendered and we've created our back buffers.
</constant>
<constant name= "EFFECT_CALLBACK_TYPE_POST_TRANSPARENT" value= "4" enum= "EffectCallbackType" >
The callback is called after our transparent rendering pass, but before any build in post effects and output to our render target.
</constant>
<constant name= "EFFECT_CALLBACK_TYPE_MAX" value= "5" enum= "EffectCallbackType" >
Represents the size of the [enum EffectCallbackType] enum.
</constant>
</constants>
</class>