class_compositoreffect.rst 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/CompositorEffect.xml.
  6. .. _class_CompositorEffect:
  7. CompositorEffect
  8. ================
  9. **Experimental:** The implementation may change as more of the rendering internals are exposed over time.
  10. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  11. This resource allows for creating a custom rendering effect.
  12. .. rst-class:: classref-introduction-group
  13. Description
  14. -----------
  15. This resource defines a custom rendering effect that can be applied to :ref:`Viewport<class_Viewport>`\ s through the viewports' :ref:`Environment<class_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.
  16. .. rst-class:: classref-reftable-group
  17. Properties
  18. ----------
  19. .. table::
  20. :widths: auto
  21. +---------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
  22. | :ref:`bool<class_bool>` | :ref:`access_resolved_color<class_CompositorEffect_property_access_resolved_color>` |
  23. +---------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
  24. | :ref:`bool<class_bool>` | :ref:`access_resolved_depth<class_CompositorEffect_property_access_resolved_depth>` |
  25. +---------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
  26. | :ref:`EffectCallbackType<enum_CompositorEffect_EffectCallbackType>` | :ref:`effect_callback_type<class_CompositorEffect_property_effect_callback_type>` |
  27. +---------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
  28. | :ref:`bool<class_bool>` | :ref:`enabled<class_CompositorEffect_property_enabled>` |
  29. +---------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
  30. | :ref:`bool<class_bool>` | :ref:`needs_motion_vectors<class_CompositorEffect_property_needs_motion_vectors>` |
  31. +---------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
  32. | :ref:`bool<class_bool>` | :ref:`needs_normal_roughness<class_CompositorEffect_property_needs_normal_roughness>` |
  33. +---------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
  34. | :ref:`bool<class_bool>` | :ref:`needs_separate_specular<class_CompositorEffect_property_needs_separate_specular>` |
  35. +---------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
  36. .. rst-class:: classref-reftable-group
  37. Methods
  38. -------
  39. .. table::
  40. :widths: auto
  41. +--------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | |void| | :ref:`_render_callback<class_CompositorEffect_private_method__render_callback>`\ (\ effect_callback_type\: :ref:`int<class_int>`, render_data\: :ref:`RenderData<class_RenderData>`\ ) |virtual| |
  43. +--------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. .. rst-class:: classref-section-separator
  45. ----
  46. .. rst-class:: classref-descriptions-group
  47. Enumerations
  48. ------------
  49. .. _enum_CompositorEffect_EffectCallbackType:
  50. .. rst-class:: classref-enumeration
  51. enum **EffectCallbackType**: :ref:`🔗<enum_CompositorEffect_EffectCallbackType>`
  52. .. _class_CompositorEffect_constant_EFFECT_CALLBACK_TYPE_PRE_OPAQUE:
  53. .. rst-class:: classref-enumeration-constant
  54. :ref:`EffectCallbackType<enum_CompositorEffect_EffectCallbackType>` **EFFECT_CALLBACK_TYPE_PRE_OPAQUE** = ``0``
  55. The callback is called before our opaque rendering pass, but after depth prepass (if applicable).
  56. .. _class_CompositorEffect_constant_EFFECT_CALLBACK_TYPE_POST_OPAQUE:
  57. .. rst-class:: classref-enumeration-constant
  58. :ref:`EffectCallbackType<enum_CompositorEffect_EffectCallbackType>` **EFFECT_CALLBACK_TYPE_POST_OPAQUE** = ``1``
  59. The callback is called after our opaque rendering pass, but before our sky is rendered.
  60. .. _class_CompositorEffect_constant_EFFECT_CALLBACK_TYPE_POST_SKY:
  61. .. rst-class:: classref-enumeration-constant
  62. :ref:`EffectCallbackType<enum_CompositorEffect_EffectCallbackType>` **EFFECT_CALLBACK_TYPE_POST_SKY** = ``2``
  63. 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).
  64. .. _class_CompositorEffect_constant_EFFECT_CALLBACK_TYPE_PRE_TRANSPARENT:
  65. .. rst-class:: classref-enumeration-constant
  66. :ref:`EffectCallbackType<enum_CompositorEffect_EffectCallbackType>` **EFFECT_CALLBACK_TYPE_PRE_TRANSPARENT** = ``3``
  67. The callback is called before our transparent rendering pass, but after our sky is rendered and we've created our back buffers.
  68. .. _class_CompositorEffect_constant_EFFECT_CALLBACK_TYPE_POST_TRANSPARENT:
  69. .. rst-class:: classref-enumeration-constant
  70. :ref:`EffectCallbackType<enum_CompositorEffect_EffectCallbackType>` **EFFECT_CALLBACK_TYPE_POST_TRANSPARENT** = ``4``
  71. The callback is called after our transparent rendering pass, but before any build in post effects and output to our render target.
  72. .. _class_CompositorEffect_constant_EFFECT_CALLBACK_TYPE_MAX:
  73. .. rst-class:: classref-enumeration-constant
  74. :ref:`EffectCallbackType<enum_CompositorEffect_EffectCallbackType>` **EFFECT_CALLBACK_TYPE_MAX** = ``5``
  75. Represents the size of the :ref:`EffectCallbackType<enum_CompositorEffect_EffectCallbackType>` enum.
  76. .. rst-class:: classref-section-separator
  77. ----
  78. .. rst-class:: classref-descriptions-group
  79. Property Descriptions
  80. ---------------------
  81. .. _class_CompositorEffect_property_access_resolved_color:
  82. .. rst-class:: classref-property
  83. :ref:`bool<class_bool>` **access_resolved_color** :ref:`🔗<class_CompositorEffect_property_access_resolved_color>`
  84. .. rst-class:: classref-property-setget
  85. - |void| **set_access_resolved_color**\ (\ value\: :ref:`bool<class_bool>`\ )
  86. - :ref:`bool<class_bool>` **get_access_resolved_color**\ (\ )
  87. If ``true`` and MSAA is enabled, this will trigger a color buffer resolve before the effect is run.
  88. \ **Note:** In :ref:`_render_callback<class_CompositorEffect_private_method__render_callback>`, to access the resolved buffer use:
  89. ::
  90. var render_scene_buffers : RenderSceneBuffersRD = render_data.get_render_scene_buffers()
  91. var color_buffer = render_scene_buffers.get_texture("render_buffers", "color")
  92. .. rst-class:: classref-item-separator
  93. ----
  94. .. _class_CompositorEffect_property_access_resolved_depth:
  95. .. rst-class:: classref-property
  96. :ref:`bool<class_bool>` **access_resolved_depth** :ref:`🔗<class_CompositorEffect_property_access_resolved_depth>`
  97. .. rst-class:: classref-property-setget
  98. - |void| **set_access_resolved_depth**\ (\ value\: :ref:`bool<class_bool>`\ )
  99. - :ref:`bool<class_bool>` **get_access_resolved_depth**\ (\ )
  100. If ``true`` and MSAA is enabled, this will trigger a depth buffer resolve before the effect is run.
  101. \ **Note:** In :ref:`_render_callback<class_CompositorEffect_private_method__render_callback>`, to access the resolved buffer use:
  102. ::
  103. var render_scene_buffers : RenderSceneBuffersRD = render_data.get_render_scene_buffers()
  104. var depth_buffer = render_scene_buffers.get_texture("render_buffers", "depth")
  105. .. rst-class:: classref-item-separator
  106. ----
  107. .. _class_CompositorEffect_property_effect_callback_type:
  108. .. rst-class:: classref-property
  109. :ref:`EffectCallbackType<enum_CompositorEffect_EffectCallbackType>` **effect_callback_type** :ref:`🔗<class_CompositorEffect_property_effect_callback_type>`
  110. .. rst-class:: classref-property-setget
  111. - |void| **set_effect_callback_type**\ (\ value\: :ref:`EffectCallbackType<enum_CompositorEffect_EffectCallbackType>`\ )
  112. - :ref:`EffectCallbackType<enum_CompositorEffect_EffectCallbackType>` **get_effect_callback_type**\ (\ )
  113. The type of effect that is implemented, determines at what stage of rendering the callback is called.
  114. .. rst-class:: classref-item-separator
  115. ----
  116. .. _class_CompositorEffect_property_enabled:
  117. .. rst-class:: classref-property
  118. :ref:`bool<class_bool>` **enabled** :ref:`🔗<class_CompositorEffect_property_enabled>`
  119. .. rst-class:: classref-property-setget
  120. - |void| **set_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
  121. - :ref:`bool<class_bool>` **get_enabled**\ (\ )
  122. If ``true`` this rendering effect is applied to any viewport it is added to.
  123. .. rst-class:: classref-item-separator
  124. ----
  125. .. _class_CompositorEffect_property_needs_motion_vectors:
  126. .. rst-class:: classref-property
  127. :ref:`bool<class_bool>` **needs_motion_vectors** :ref:`🔗<class_CompositorEffect_property_needs_motion_vectors>`
  128. .. rst-class:: classref-property-setget
  129. - |void| **set_needs_motion_vectors**\ (\ value\: :ref:`bool<class_bool>`\ )
  130. - :ref:`bool<class_bool>` **get_needs_motion_vectors**\ (\ )
  131. If ``true`` this triggers motion vectors being calculated during the opaque render state.
  132. \ **Note:** In :ref:`_render_callback<class_CompositorEffect_private_method__render_callback>`, to access the motion vector buffer use:
  133. ::
  134. var render_scene_buffers : RenderSceneBuffersRD = render_data.get_render_scene_buffers()
  135. var motion_buffer = render_scene_buffers.get_velocity_texture()
  136. .. rst-class:: classref-item-separator
  137. ----
  138. .. _class_CompositorEffect_property_needs_normal_roughness:
  139. .. rst-class:: classref-property
  140. :ref:`bool<class_bool>` **needs_normal_roughness** :ref:`🔗<class_CompositorEffect_property_needs_normal_roughness>`
  141. .. rst-class:: classref-property-setget
  142. - |void| **set_needs_normal_roughness**\ (\ value\: :ref:`bool<class_bool>`\ )
  143. - :ref:`bool<class_bool>` **get_needs_normal_roughness**\ (\ )
  144. If ``true`` this triggers normal and roughness data to be output during our depth pre-pass, only applicable for the Forward+ renderer.
  145. \ **Note:** In :ref:`_render_callback<class_CompositorEffect_private_method__render_callback>`, to access the roughness buffer use:
  146. ::
  147. var render_scene_buffers : RenderSceneBuffersRD = render_data.get_render_scene_buffers()
  148. var roughness_buffer = render_scene_buffers.get_texture("forward_clustered", "normal_roughness")
  149. .. rst-class:: classref-item-separator
  150. ----
  151. .. _class_CompositorEffect_property_needs_separate_specular:
  152. .. rst-class:: classref-property
  153. :ref:`bool<class_bool>` **needs_separate_specular** :ref:`🔗<class_CompositorEffect_property_needs_separate_specular>`
  154. .. rst-class:: classref-property-setget
  155. - |void| **set_needs_separate_specular**\ (\ value\: :ref:`bool<class_bool>`\ )
  156. - :ref:`bool<class_bool>` **get_needs_separate_specular**\ (\ )
  157. 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.
  158. .. rst-class:: classref-section-separator
  159. ----
  160. .. rst-class:: classref-descriptions-group
  161. Method Descriptions
  162. -------------------
  163. .. _class_CompositorEffect_private_method__render_callback:
  164. .. rst-class:: classref-method
  165. |void| **_render_callback**\ (\ effect_callback_type\: :ref:`int<class_int>`, render_data\: :ref:`RenderData<class_RenderData>`\ ) |virtual| :ref:`🔗<class_CompositorEffect_private_method__render_callback>`
  166. Implement this function with your custom rendering code. ``effect_callback_type`` should always match the effect callback type you've specified in :ref:`effect_callback_type<class_CompositorEffect_property_effect_callback_type>`. ``render_data`` provides access to the rendering state, it is only valid during rendering and should not be stored.
  167. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  168. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  169. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  170. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  171. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  172. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  173. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  174. .. |void| replace:: :abbr:`void (No return value.)`