-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #80214 from BastiaanOlij/rendering_effect
Implement hooks into renderer
- Loading branch information
Showing
64 changed files
with
2,432 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<class name="Compositor" inherits="Resource" experimental="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> | ||
<brief_description> | ||
The compositor resource holds the configuration with which rendering of a viewport can be customised. | ||
</brief_description> | ||
<description> | ||
The compositor resource holds the configuration with which rendering of a viewport can be customised. | ||
[b]Note:[/b] This functionality is still experimental as more customisation of the rendering pipeline will be added in the near future. | ||
</description> | ||
<tutorials> | ||
</tutorials> | ||
<members> | ||
<member name="compositor_effects" type="CompositorEffect[]" setter="set_compositor_effects" getter="get_compositor_effects" default="[]"> | ||
The custom [CompositorEffect]s that are applied during rendering of viewports using this compositor. | ||
</member> | ||
</members> | ||
</class> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<class name="CompositorEffect" inherits="Resource" experimental="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> | ||
<brief_description> | ||
This resource allows for creating a custom rendering effect. | ||
</brief_description> | ||
<description> | ||
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. | ||
[b]Note:[/b] This functionality is still experimental, there will be changes to the implementation as we expose more of the rendering internals. | ||
</description> | ||
<tutorials> | ||
</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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<class name="FramebufferCacheRD" inherits="Object" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> | ||
<brief_description> | ||
Framebuffer cache manager for Rendering Device based renderers. | ||
</brief_description> | ||
<description> | ||
Framebuffer cache manager for Rendering Device based renderers. Provides a way to create a framebuffer and reuse it in subsequent calls for as long as the used textures exists. Framebuffers will automatically be cleaned up when dependent objects are freed. | ||
</description> | ||
<tutorials> | ||
</tutorials> | ||
<methods> | ||
<method name="get_cache_multipass" qualifiers="static"> | ||
<return type="RID" /> | ||
<param index="0" name="textures" type="RID[]" /> | ||
<param index="1" name="passes" type="RDFramebufferPass[]" /> | ||
<param index="2" name="views" type="int" /> | ||
<description> | ||
Creates, or obtains a cached, framebuffer. [param textures] lists textures accessed. [param passes] defines the subpasses and texture allocation, if left empty a single pass is created and textures are allocated depending on their usage flags. [param views] defines the number of views used when rendering. | ||
</description> | ||
</method> | ||
</methods> | ||
</class> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<class name="RenderData" inherits="Object" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> | ||
<brief_description> | ||
Abstract render data object, holds frame data related to rendering a single frame of a viewport. | ||
</brief_description> | ||
<description> | ||
Abstract render data object, exists for the duration of rendering a single viewport. | ||
[b]Note:[/b] This is an internal rendering server object, do not instantiate this from script. | ||
</description> | ||
<tutorials> | ||
</tutorials> | ||
<methods> | ||
<method name="get_camera_attributes" qualifiers="const"> | ||
<return type="RID" /> | ||
<description> | ||
Returns the [RID] of the camera attributes object in the [RenderingServer] being used to render this viewport. | ||
</description> | ||
</method> | ||
<method name="get_environment" qualifiers="const"> | ||
<return type="RID" /> | ||
<description> | ||
Returns the [RID] of the environments object in the [RenderingServer] being used to render this viewport. | ||
</description> | ||
</method> | ||
<method name="get_render_scene_buffers" qualifiers="const"> | ||
<return type="RenderSceneBuffers" /> | ||
<description> | ||
Returns the [RenderSceneBuffers] object managing the scene buffers for rendering this viewport. | ||
</description> | ||
</method> | ||
<method name="get_render_scene_data" qualifiers="const"> | ||
<return type="RenderSceneData" /> | ||
<description> | ||
Returns the [RenderSceneData] object managing this frames scene data. | ||
</description> | ||
</method> | ||
</methods> | ||
</class> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<class name="RenderDataExtension" inherits="RenderData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> | ||
<brief_description> | ||
This class allows for a RenderData implementation to be made in GDExtension. | ||
</brief_description> | ||
<description> | ||
This class allows for a RenderData implementation to be made in GDExtension. | ||
</description> | ||
<tutorials> | ||
</tutorials> | ||
<methods> | ||
<method name="_get_camera_attributes" qualifiers="virtual const"> | ||
<return type="RID" /> | ||
<description> | ||
Implement this in GDExtension to return the [RID] for the implementations camera attributes object. | ||
</description> | ||
</method> | ||
<method name="_get_environment" qualifiers="virtual const"> | ||
<return type="RID" /> | ||
<description> | ||
</description> | ||
</method> | ||
<method name="_get_render_scene_buffers" qualifiers="virtual const"> | ||
<return type="RenderSceneBuffers" /> | ||
<description> | ||
Implement this in GDExtension to return the [RID] of the implementations environment object. | ||
</description> | ||
</method> | ||
<method name="_get_render_scene_data" qualifiers="virtual const"> | ||
<return type="RenderSceneData" /> | ||
<description> | ||
Implement this in GDExtension to return the implementations [RenderSceneDataExtension] object. | ||
</description> | ||
</method> | ||
</methods> | ||
</class> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<class name="RenderDataRD" inherits="RenderData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> | ||
<brief_description> | ||
Render data implementation for the RenderingDevice based renderers. | ||
[b]Note:[/b] This is an internal rendering server object, do not instantiate this from script. | ||
</brief_description> | ||
<description> | ||
This object manages all render data for the rendering device based renderers. | ||
[b]Note:[/b] This is an internal rendering server object only exposed for GDExtension plugins. | ||
</description> | ||
<tutorials> | ||
</tutorials> | ||
</class> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<class name="RenderSceneData" inherits="Object" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> | ||
<brief_description> | ||
Abstract render data object, holds scene data related to rendering a single frame of a viewport. | ||
</brief_description> | ||
<description> | ||
Abstract scene data object, exists for the duration of rendering a single viewport. | ||
[b]Note:[/b] This is an internal rendering server object, do not instantiate this from script. | ||
</description> | ||
<tutorials> | ||
</tutorials> | ||
<methods> | ||
<method name="get_cam_projection" qualifiers="const"> | ||
<return type="Projection" /> | ||
<description> | ||
Returns the camera projection used to render this frame. | ||
[b]Note:[/b] If more than one view is rendered, this will return a combined projection. | ||
</description> | ||
</method> | ||
<method name="get_cam_transform" qualifiers="const"> | ||
<return type="Transform3D" /> | ||
<description> | ||
Returns the camera transform used to render this frame. | ||
[b]Note:[/b] If more than one view is rendered, this will return a centered transform. | ||
</description> | ||
</method> | ||
<method name="get_uniform_buffer" qualifiers="const"> | ||
<return type="RID" /> | ||
<description> | ||
Return the [RID] of the uniform buffer containing the scene data as a UBO. | ||
</description> | ||
</method> | ||
<method name="get_view_count" qualifiers="const"> | ||
<return type="int" /> | ||
<description> | ||
Returns the number of views being rendered. | ||
</description> | ||
</method> | ||
<method name="get_view_eye_offset" qualifiers="const"> | ||
<return type="Vector3" /> | ||
<param index="0" name="view" type="int" /> | ||
<description> | ||
Returns the eye offset per view used to render this frame. This is the offset between our camera transform and the eye transform. | ||
</description> | ||
</method> | ||
<method name="get_view_projection" qualifiers="const"> | ||
<return type="Projection" /> | ||
<param index="0" name="view" type="int" /> | ||
<description> | ||
Returns the view projection per view used to render this frame. | ||
[b]Note:[/b] If a single view is rendered, this returns the camera projection. If more than one view is rendered, this will return a projection for the given view including the eye offset. | ||
</description> | ||
</method> | ||
</methods> | ||
</class> |
Oops, something went wrong.