class_geometryinstance3d.rst 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the GeometryInstance3D.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_GeometryInstance3D:
  6. GeometryInstance3D
  7. ==================
  8. **Inherits:** :ref:`VisualInstance3D<class_VisualInstance3D>` **<** :ref:`Node3D<class_Node3D>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. **Inherited By:** :ref:`CPUParticles3D<class_CPUParticles3D>`, :ref:`CSGShape3D<class_CSGShape3D>`, :ref:`GPUParticles3D<class_GPUParticles3D>`, :ref:`MeshInstance3D<class_MeshInstance3D>`, :ref:`MultiMeshInstance3D<class_MultiMeshInstance3D>`, :ref:`SpriteBase3D<class_SpriteBase3D>`
  10. Base node for geometry-based visual instances.
  11. Description
  12. -----------
  13. Base node for geometry-based visual instances. Shares some common functionality like visibility and custom materials.
  14. Properties
  15. ----------
  16. +---------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------+
  17. | :ref:`ShadowCastingSetting<enum_GeometryInstance3D_ShadowCastingSetting>` | :ref:`cast_shadow<class_GeometryInstance3D_property_cast_shadow>` | ``1`` |
  18. +---------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------+
  19. | :ref:`float<class_float>` | :ref:`extra_cull_margin<class_GeometryInstance3D_property_extra_cull_margin>` | ``0.0`` |
  20. +---------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------+
  21. | :ref:`LightmapScale<enum_GeometryInstance3D_LightmapScale>` | :ref:`gi_lightmap_scale<class_GeometryInstance3D_property_gi_lightmap_scale>` | ``0`` |
  22. +---------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------+
  23. | :ref:`GIMode<enum_GeometryInstance3D_GIMode>` | :ref:`gi_mode<class_GeometryInstance3D_property_gi_mode>` | ``0`` |
  24. +---------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------+
  25. | :ref:`bool<class_bool>` | :ref:`ignore_occlusion_culling<class_GeometryInstance3D_property_ignore_occlusion_culling>` | ``false`` |
  26. +---------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------+
  27. | :ref:`float<class_float>` | :ref:`lod_bias<class_GeometryInstance3D_property_lod_bias>` | ``1.0`` |
  28. +---------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------+
  29. | :ref:`Material<class_Material>` | :ref:`material_override<class_GeometryInstance3D_property_material_override>` | |
  30. +---------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------+
  31. | :ref:`float<class_float>` | :ref:`transparency<class_GeometryInstance3D_property_transparency>` | ``0.0`` |
  32. +---------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------+
  33. | :ref:`float<class_float>` | :ref:`visibility_range_begin<class_GeometryInstance3D_property_visibility_range_begin>` | ``0.0`` |
  34. +---------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------+
  35. | :ref:`float<class_float>` | :ref:`visibility_range_begin_margin<class_GeometryInstance3D_property_visibility_range_begin_margin>` | ``0.0`` |
  36. +---------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------+
  37. | :ref:`float<class_float>` | :ref:`visibility_range_end<class_GeometryInstance3D_property_visibility_range_end>` | ``0.0`` |
  38. +---------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------+
  39. | :ref:`float<class_float>` | :ref:`visibility_range_end_margin<class_GeometryInstance3D_property_visibility_range_end_margin>` | ``0.0`` |
  40. +---------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------+
  41. | :ref:`VisibilityRangeFadeMode<enum_GeometryInstance3D_VisibilityRangeFadeMode>` | :ref:`visibility_range_fade_mode<class_GeometryInstance3D_property_visibility_range_fade_mode>` | ``0`` |
  42. +---------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------+-----------+
  43. Methods
  44. -------
  45. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | :ref:`Variant<class_Variant>` | :ref:`get_shader_instance_uniform<class_GeometryInstance3D_method_get_shader_instance_uniform>` **(** :ref:`StringName<class_StringName>` uniform **)** |const| |
  47. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | void | :ref:`set_custom_aabb<class_GeometryInstance3D_method_set_custom_aabb>` **(** :ref:`AABB<class_AABB>` aabb **)** |
  49. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | void | :ref:`set_shader_instance_uniform<class_GeometryInstance3D_method_set_shader_instance_uniform>` **(** :ref:`StringName<class_StringName>` uniform, :ref:`Variant<class_Variant>` value **)** |
  51. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. Enumerations
  53. ------------
  54. .. _enum_GeometryInstance3D_ShadowCastingSetting:
  55. .. _class_GeometryInstance3D_constant_SHADOW_CASTING_SETTING_OFF:
  56. .. _class_GeometryInstance3D_constant_SHADOW_CASTING_SETTING_ON:
  57. .. _class_GeometryInstance3D_constant_SHADOW_CASTING_SETTING_DOUBLE_SIDED:
  58. .. _class_GeometryInstance3D_constant_SHADOW_CASTING_SETTING_SHADOWS_ONLY:
  59. enum **ShadowCastingSetting**:
  60. - **SHADOW_CASTING_SETTING_OFF** = **0** --- Will not cast any shadows. Use this to improve performance for small geometry that is unlikely to cast noticeable shadows (such as debris).
  61. - **SHADOW_CASTING_SETTING_ON** = **1** --- Will cast shadows from all visible faces in the GeometryInstance3D.
  62. Will take culling into account, so faces not being rendered will not be taken into account when shadow casting.
  63. - **SHADOW_CASTING_SETTING_DOUBLE_SIDED** = **2** --- Will cast shadows from all visible faces in the GeometryInstance3D.
  64. Will not take culling into account, so all faces will be taken into account when shadow casting.
  65. - **SHADOW_CASTING_SETTING_SHADOWS_ONLY** = **3** --- Will only show the shadows casted from this object.
  66. In other words, the actual mesh will not be visible, only the shadows casted from the mesh will be.
  67. ----
  68. .. _enum_GeometryInstance3D_GIMode:
  69. .. _class_GeometryInstance3D_constant_GI_MODE_DISABLED:
  70. .. _class_GeometryInstance3D_constant_GI_MODE_BAKED:
  71. .. _class_GeometryInstance3D_constant_GI_MODE_DYNAMIC:
  72. enum **GIMode**:
  73. - **GI_MODE_DISABLED** = **0** --- Disabled global illumination mode. Use for dynamic objects that do not contribute to global illumination (such as characters). When using :ref:`VoxelGI<class_VoxelGI>` and SDFGI, the geometry will *receive* indirect lighting and reflections but will not be considered in GI baking. When using :ref:`LightmapGI<class_LightmapGI>`, the object will receive indirect lighting using lightmap probes instead of using the lightmap texture.
  74. - **GI_MODE_BAKED** = **1** --- Baked global illumination mode. Use for static objects that contribute to global illumination (such as level geometry). This GI mode is effective when using :ref:`VoxelGI<class_VoxelGI>`, SDFGI and :ref:`LightmapGI<class_LightmapGI>`.
  75. - **GI_MODE_DYNAMIC** = **2** --- Dynamic global illumination mode. Use for dynamic objects that contribute to global illumination. This GI mode is only effective when using :ref:`VoxelGI<class_VoxelGI>`, but it has a higher performance impact than :ref:`GI_MODE_BAKED<class_GeometryInstance3D_constant_GI_MODE_BAKED>`.
  76. ----
  77. .. _enum_GeometryInstance3D_LightmapScale:
  78. .. _class_GeometryInstance3D_constant_LIGHTMAP_SCALE_1X:
  79. .. _class_GeometryInstance3D_constant_LIGHTMAP_SCALE_2X:
  80. .. _class_GeometryInstance3D_constant_LIGHTMAP_SCALE_4X:
  81. .. _class_GeometryInstance3D_constant_LIGHTMAP_SCALE_8X:
  82. .. _class_GeometryInstance3D_constant_LIGHTMAP_SCALE_MAX:
  83. enum **LightmapScale**:
  84. - **LIGHTMAP_SCALE_1X** = **0** --- The standard texel density for lightmapping with :ref:`LightmapGI<class_LightmapGI>`.
  85. - **LIGHTMAP_SCALE_2X** = **1** --- Multiplies texel density by 2× for lightmapping with :ref:`LightmapGI<class_LightmapGI>`. To ensure consistency in texel density, use this when scaling a mesh by a factor between 1.5 and 3.0.
  86. - **LIGHTMAP_SCALE_4X** = **2** --- Multiplies texel density by 4× for lightmapping with :ref:`LightmapGI<class_LightmapGI>`. To ensure consistency in texel density, use this when scaling a mesh by a factor between 3.0 and 6.0.
  87. - **LIGHTMAP_SCALE_8X** = **3** --- Multiplies texel density by 8× for lightmapping with :ref:`LightmapGI<class_LightmapGI>`. To ensure consistency in texel density, use this when scaling a mesh by a factor greater than 6.0.
  88. - **LIGHTMAP_SCALE_MAX** = **4** --- Represents the size of the :ref:`LightmapScale<enum_GeometryInstance3D_LightmapScale>` enum.
  89. ----
  90. .. _enum_GeometryInstance3D_VisibilityRangeFadeMode:
  91. .. _class_GeometryInstance3D_constant_VISIBILITY_RANGE_FADE_DISABLED:
  92. .. _class_GeometryInstance3D_constant_VISIBILITY_RANGE_FADE_SELF:
  93. .. _class_GeometryInstance3D_constant_VISIBILITY_RANGE_FADE_DEPENDENCIES:
  94. enum **VisibilityRangeFadeMode**:
  95. - **VISIBILITY_RANGE_FADE_DISABLED** = **0** --- Will not fade itself nor its visibility dependencies, hysteresis will be used instead. See :ref:`visibility_range_begin<class_GeometryInstance3D_property_visibility_range_begin>` and :ref:`Node3D.visibility_parent<class_Node3D_property_visibility_parent>` for more information.
  96. - **VISIBILITY_RANGE_FADE_SELF** = **1** --- Will fade-out itself when reaching the limits of its own visibility range. The fading range is determined by :ref:`visibility_range_begin_margin<class_GeometryInstance3D_property_visibility_range_begin_margin>` and :ref:`visibility_range_end_margin<class_GeometryInstance3D_property_visibility_range_end_margin>`.
  97. - **VISIBILITY_RANGE_FADE_DEPENDENCIES** = **2** --- Will fade-in its visibility dependencies (see :ref:`Node3D.visibility_parent<class_Node3D_property_visibility_parent>`) when reaching the limits of its own visibility range. The fading range is determined by :ref:`visibility_range_begin_margin<class_GeometryInstance3D_property_visibility_range_begin_margin>` and :ref:`visibility_range_end_margin<class_GeometryInstance3D_property_visibility_range_end_margin>`.
  98. Property Descriptions
  99. ---------------------
  100. .. _class_GeometryInstance3D_property_cast_shadow:
  101. - :ref:`ShadowCastingSetting<enum_GeometryInstance3D_ShadowCastingSetting>` **cast_shadow**
  102. +-----------+---------------------------------+
  103. | *Default* | ``1`` |
  104. +-----------+---------------------------------+
  105. | *Setter* | set_cast_shadows_setting(value) |
  106. +-----------+---------------------------------+
  107. | *Getter* | get_cast_shadows_setting() |
  108. +-----------+---------------------------------+
  109. The selected shadow casting flag. See :ref:`ShadowCastingSetting<enum_GeometryInstance3D_ShadowCastingSetting>` for possible values.
  110. ----
  111. .. _class_GeometryInstance3D_property_extra_cull_margin:
  112. - :ref:`float<class_float>` **extra_cull_margin**
  113. +-----------+------------------------------+
  114. | *Default* | ``0.0`` |
  115. +-----------+------------------------------+
  116. | *Setter* | set_extra_cull_margin(value) |
  117. +-----------+------------------------------+
  118. | *Getter* | get_extra_cull_margin() |
  119. +-----------+------------------------------+
  120. The extra distance added to the GeometryInstance3D's bounding box (:ref:`AABB<class_AABB>`) to increase its cull box.
  121. ----
  122. .. _class_GeometryInstance3D_property_gi_lightmap_scale:
  123. - :ref:`LightmapScale<enum_GeometryInstance3D_LightmapScale>` **gi_lightmap_scale**
  124. +-----------+---------------------------+
  125. | *Default* | ``0`` |
  126. +-----------+---------------------------+
  127. | *Setter* | set_lightmap_scale(value) |
  128. +-----------+---------------------------+
  129. | *Getter* | get_lightmap_scale() |
  130. +-----------+---------------------------+
  131. The texel density to use for lightmapping in :ref:`LightmapGI<class_LightmapGI>`. Greater scale values provide higher resolution in the lightmap, which can result in sharper shadows for lights that have both direct and indirect light baked. However, greater scale values will also increase the space taken by the mesh in the lightmap texture, which increases the memory, storage, and bake time requirements. When using a single mesh at different scales, consider adjusting this value to keep the lightmap texel density consistent across meshes.
  132. ----
  133. .. _class_GeometryInstance3D_property_gi_mode:
  134. - :ref:`GIMode<enum_GeometryInstance3D_GIMode>` **gi_mode**
  135. +-----------+--------------------+
  136. | *Default* | ``0`` |
  137. +-----------+--------------------+
  138. | *Setter* | set_gi_mode(value) |
  139. +-----------+--------------------+
  140. | *Getter* | get_gi_mode() |
  141. +-----------+--------------------+
  142. The global illumination mode to use for the whole geometry. Use a mode that matches the purpose
  143. ----
  144. .. _class_GeometryInstance3D_property_ignore_occlusion_culling:
  145. - :ref:`bool<class_bool>` **ignore_occlusion_culling**
  146. +-----------+-------------------------------------+
  147. | *Default* | ``false`` |
  148. +-----------+-------------------------------------+
  149. | *Setter* | set_ignore_occlusion_culling(value) |
  150. +-----------+-------------------------------------+
  151. | *Getter* | is_ignoring_occlusion_culling() |
  152. +-----------+-------------------------------------+
  153. ----
  154. .. _class_GeometryInstance3D_property_lod_bias:
  155. - :ref:`float<class_float>` **lod_bias**
  156. +-----------+---------------------+
  157. | *Default* | ``1.0`` |
  158. +-----------+---------------------+
  159. | *Setter* | set_lod_bias(value) |
  160. +-----------+---------------------+
  161. | *Getter* | get_lod_bias() |
  162. +-----------+---------------------+
  163. ----
  164. .. _class_GeometryInstance3D_property_material_override:
  165. - :ref:`Material<class_Material>` **material_override**
  166. +----------+------------------------------+
  167. | *Setter* | set_material_override(value) |
  168. +----------+------------------------------+
  169. | *Getter* | get_material_override() |
  170. +----------+------------------------------+
  171. The material override for the whole geometry.
  172. If a material is assigned to this property, it will be used instead of any material set in any material slot of the mesh.
  173. ----
  174. .. _class_GeometryInstance3D_property_transparency:
  175. - :ref:`float<class_float>` **transparency**
  176. +-----------+-------------------------+
  177. | *Default* | ``0.0`` |
  178. +-----------+-------------------------+
  179. | *Setter* | set_transparency(value) |
  180. +-----------+-------------------------+
  181. | *Getter* | get_transparency() |
  182. +-----------+-------------------------+
  183. Transparency applied to the whole geometry. In spatial shaders, transparency is set as the default value of the ``ALPHA`` built-in.
  184. ----
  185. .. _class_GeometryInstance3D_property_visibility_range_begin:
  186. - :ref:`float<class_float>` **visibility_range_begin**
  187. +-----------+-----------------------------------+
  188. | *Default* | ``0.0`` |
  189. +-----------+-----------------------------------+
  190. | *Setter* | set_visibility_range_begin(value) |
  191. +-----------+-----------------------------------+
  192. | *Getter* | get_visibility_range_begin() |
  193. +-----------+-----------------------------------+
  194. Starting distance from which the GeometryInstance3D will be visible, taking :ref:`visibility_range_begin_margin<class_GeometryInstance3D_property_visibility_range_begin_margin>` into account as well. The default value of 0 is used to disable the range check.
  195. ----
  196. .. _class_GeometryInstance3D_property_visibility_range_begin_margin:
  197. - :ref:`float<class_float>` **visibility_range_begin_margin**
  198. +-----------+------------------------------------------+
  199. | *Default* | ``0.0`` |
  200. +-----------+------------------------------------------+
  201. | *Setter* | set_visibility_range_begin_margin(value) |
  202. +-----------+------------------------------------------+
  203. | *Getter* | get_visibility_range_begin_margin() |
  204. +-----------+------------------------------------------+
  205. Margin for the :ref:`visibility_range_begin<class_GeometryInstance3D_property_visibility_range_begin>` threshold. The GeometryInstance3D will only change its visibility state when it goes over or under the :ref:`visibility_range_begin<class_GeometryInstance3D_property_visibility_range_begin>` threshold by this amount.
  206. ----
  207. .. _class_GeometryInstance3D_property_visibility_range_end:
  208. - :ref:`float<class_float>` **visibility_range_end**
  209. +-----------+---------------------------------+
  210. | *Default* | ``0.0`` |
  211. +-----------+---------------------------------+
  212. | *Setter* | set_visibility_range_end(value) |
  213. +-----------+---------------------------------+
  214. | *Getter* | get_visibility_range_end() |
  215. +-----------+---------------------------------+
  216. Distance from which the GeometryInstance3D will be hidden, taking :ref:`visibility_range_end_margin<class_GeometryInstance3D_property_visibility_range_end_margin>` into account as well. The default value of 0 is used to disable the range check.
  217. ----
  218. .. _class_GeometryInstance3D_property_visibility_range_end_margin:
  219. - :ref:`float<class_float>` **visibility_range_end_margin**
  220. +-----------+----------------------------------------+
  221. | *Default* | ``0.0`` |
  222. +-----------+----------------------------------------+
  223. | *Setter* | set_visibility_range_end_margin(value) |
  224. +-----------+----------------------------------------+
  225. | *Getter* | get_visibility_range_end_margin() |
  226. +-----------+----------------------------------------+
  227. Margin for the :ref:`visibility_range_end<class_GeometryInstance3D_property_visibility_range_end>` threshold. The GeometryInstance3D will only change its visibility state when it goes over or under the :ref:`visibility_range_end<class_GeometryInstance3D_property_visibility_range_end>` threshold by this amount.
  228. ----
  229. .. _class_GeometryInstance3D_property_visibility_range_fade_mode:
  230. - :ref:`VisibilityRangeFadeMode<enum_GeometryInstance3D_VisibilityRangeFadeMode>` **visibility_range_fade_mode**
  231. +-----------+---------------------------------------+
  232. | *Default* | ``0`` |
  233. +-----------+---------------------------------------+
  234. | *Setter* | set_visibility_range_fade_mode(value) |
  235. +-----------+---------------------------------------+
  236. | *Getter* | get_visibility_range_fade_mode() |
  237. +-----------+---------------------------------------+
  238. Controls which instances will be faded when approaching the limits of the visibility range. See :ref:`VisibilityRangeFadeMode<enum_GeometryInstance3D_VisibilityRangeFadeMode>` for possible values.
  239. Method Descriptions
  240. -------------------
  241. .. _class_GeometryInstance3D_method_get_shader_instance_uniform:
  242. - :ref:`Variant<class_Variant>` **get_shader_instance_uniform** **(** :ref:`StringName<class_StringName>` uniform **)** |const|
  243. ----
  244. .. _class_GeometryInstance3D_method_set_custom_aabb:
  245. - void **set_custom_aabb** **(** :ref:`AABB<class_AABB>` aabb **)**
  246. Overrides the bounding box of this node with a custom one. To remove it, set an :ref:`AABB<class_AABB>` with all fields set to zero.
  247. ----
  248. .. _class_GeometryInstance3D_method_set_shader_instance_uniform:
  249. - void **set_shader_instance_uniform** **(** :ref:`StringName<class_StringName>` uniform, :ref:`Variant<class_Variant>` value **)**
  250. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  251. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  252. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  253. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  254. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  255. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`