BakedLightmap.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="BakedLightmap" inherits="VisualInstance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
  3. <brief_description>
  4. Prerendered indirect light map for a scene.
  5. </brief_description>
  6. <description>
  7. Baked lightmaps are an alternative workflow for adding indirect (or baked) lighting to a scene. Unlike the [GIProbe] approach, baked lightmaps work fine on low-end PCs and mobile devices as they consume almost no resources in run-time.
  8. [b]Procedural generation:[/b] Lightmap baking functionality is only available in the editor. This means [BakedLightmap] is not suited to procedurally generated or user-built levels. For procedurally generated or user-built levels, use [GIProbe] instead.
  9. [b]Note:[/b] Due to how lightmaps work, most properties only have a visible effect once lightmaps are baked again.
  10. </description>
  11. <tutorials>
  12. <link>$DOCS_URL/tutorials/3d/baked_lightmaps.html</link>
  13. </tutorials>
  14. <methods>
  15. <method name="bake">
  16. <return type="int" enum="BakedLightmap.BakeError" />
  17. <argument index="0" name="from_node" type="Node" default="null" />
  18. <argument index="1" name="data_save_path" type="String" default="&quot;&quot;" />
  19. <description>
  20. Bakes the lightmap, scanning from the given [code]from_node[/code] root and saves the resulting [BakedLightmapData] in [code]data_save_path[/code]. If no root node is provided, parent of this node will be used as root instead. If no save path is provided it will try to match the path from the current [member light_data].
  21. </description>
  22. </method>
  23. </methods>
  24. <members>
  25. <member name="atlas_generate" type="bool" setter="set_generate_atlas" getter="is_generate_atlas_enabled" default="true">
  26. If [code]true[/code], the lightmapper will merge the textures for all meshes into one or several large layered textures. If [code]false[/code], every mesh will get its own lightmap texture, which is less efficient.
  27. [b]Note:[/b] Atlas lightmap rendering is only supported in GLES3, [i]not[/i] GLES2. Non-atlas lightmap rendering is supported by both GLES3 and GLES2. If [member ProjectSettings.rendering/quality/driver/fallback_to_gles2] is [code]true[/code], consider baking lightmaps with [member atlas_generate] set to [code]false[/code] so that the resulting lightmap is visible in both GLES3 and GLES2.
  28. </member>
  29. <member name="atlas_max_size" type="int" setter="set_max_atlas_size" getter="get_max_atlas_size" default="4096">
  30. Maximum size of each lightmap layer, only used when [member atlas_generate] is enabled.
  31. </member>
  32. <member name="bias" type="float" setter="set_bias" getter="get_bias" default="0.005">
  33. Raycasting bias used during baking to avoid floating point precision issues.
  34. </member>
  35. <member name="bounce_indirect_energy" type="float" setter="set_bounce_indirect_energy" getter="get_bounce_indirect_energy" default="1.0">
  36. The energy multiplier for each bounce. Higher values will make indirect lighting brighter. A value of [code]1.0[/code] represents physically accurate behavior, but higher values can be used to make indirect lighting propagate more visibly when using a low number of bounces. This can be used to speed up bake times by lowering the number of [member bounces] then increasing [member bounce_indirect_energy]. Unlike [member BakedLightmapData.energy], this property does not affect direct lighting emitted by light nodes, emissive materials and the environment.
  37. [b]Note:[/b] [member bounce_indirect_energy] only has an effect if [member bounces] is set to a value greater than or equal to [code]1[/code].
  38. </member>
  39. <member name="bounces" type="int" setter="set_bounces" getter="get_bounces" default="3">
  40. Number of light bounces that are taken into account during baking. See also [member bounce_indirect_energy].
  41. </member>
  42. <member name="capture_cell_size" type="float" setter="set_capture_cell_size" getter="get_capture_cell_size" default="0.5">
  43. Grid size used for real-time capture information on dynamic objects.
  44. </member>
  45. <member name="capture_enabled" type="bool" setter="set_capture_enabled" getter="get_capture_enabled" default="true">
  46. When enabled, an octree containing the scene's lighting information will be computed. This octree will then be used to light dynamic objects in the scene.
  47. </member>
  48. <member name="capture_propagation" type="float" setter="set_capture_propagation" getter="get_capture_propagation" default="1.0">
  49. Bias value to reduce the amount of light propagation in the captured octree.
  50. </member>
  51. <member name="capture_quality" type="int" setter="set_capture_quality" getter="get_capture_quality" enum="BakedLightmap.BakeQuality" default="1">
  52. Bake quality of the capture data.
  53. </member>
  54. <member name="default_texels_per_unit" type="float" setter="set_default_texels_per_unit" getter="get_default_texels_per_unit" default="16.0">
  55. If a baked mesh doesn't have a UV2 size hint, this value will be used to roughly compute a suitable lightmap size.
  56. </member>
  57. <member name="environment_custom_color" type="Color" setter="set_environment_custom_color" getter="get_environment_custom_color">
  58. The environment color when [member environment_mode] is set to [constant ENVIRONMENT_MODE_CUSTOM_COLOR].
  59. </member>
  60. <member name="environment_custom_energy" type="float" setter="set_environment_custom_energy" getter="get_environment_custom_energy">
  61. The energy scaling factor when when [member environment_mode] is set to [constant ENVIRONMENT_MODE_CUSTOM_COLOR] or [constant ENVIRONMENT_MODE_CUSTOM_SKY].
  62. </member>
  63. <member name="environment_custom_sky" type="Sky" setter="set_environment_custom_sky" getter="get_environment_custom_sky">
  64. The [Sky] resource to use when [member environment_mode] is set o [constant ENVIRONMENT_MODE_CUSTOM_SKY].
  65. </member>
  66. <member name="environment_custom_sky_rotation_degrees" type="Vector3" setter="set_environment_custom_sky_rotation_degrees" getter="get_environment_custom_sky_rotation_degrees">
  67. The rotation of the baked custom sky.
  68. </member>
  69. <member name="environment_min_light" type="Color" setter="set_environment_min_light" getter="get_environment_min_light" default="Color( 0, 0, 0, 1 )">
  70. Minimum ambient light for all the lightmap texels. This doesn't take into account any occlusion from the scene's geometry, it simply ensures a minimum amount of light on all the lightmap texels. Can be used for artistic control on shadow color.
  71. </member>
  72. <member name="environment_mode" type="int" setter="set_environment_mode" getter="get_environment_mode" enum="BakedLightmap.EnvironmentMode" default="0">
  73. Decides which environment to use during baking.
  74. </member>
  75. <member name="extents" type="Vector3" setter="set_extents" getter="get_extents" default="Vector3( 10, 10, 10 )">
  76. Size of the baked lightmap. Only meshes inside this region will be included in the baked lightmap, also used as the bounds of the captured region for dynamic lighting.
  77. </member>
  78. <member name="image_path" type="String" setter="set_image_path" getter="get_image_path">
  79. Deprecated, in previous versions it determined the location where lightmaps were be saved.
  80. </member>
  81. <member name="light_data" type="BakedLightmapData" setter="set_light_data" getter="get_light_data">
  82. The calculated light data.
  83. </member>
  84. <member name="quality" type="int" setter="set_bake_quality" getter="get_bake_quality" enum="BakedLightmap.BakeQuality" default="1">
  85. Determines the amount of samples per texel used in indirect light baking. The amount of samples for each quality level can be configured in the project settings.
  86. </member>
  87. <member name="use_color" type="bool" setter="set_use_color" getter="is_using_color" default="true">
  88. Store full color values in the lightmap textures. When disabled, lightmap textures will store a single brightness channel. Can be disabled to reduce disk usage if the scene contains only white lights or you don't mind losing color information in indirect lighting.
  89. </member>
  90. <member name="use_denoiser" type="bool" setter="set_use_denoiser" getter="is_using_denoiser" default="true">
  91. When enabled, a lightmap denoiser will be used to reduce the noise inherent to Monte Carlo based global illumination.
  92. </member>
  93. <member name="use_hdr" type="bool" setter="set_use_hdr" getter="is_using_hdr" default="true">
  94. If [code]true[/code], stores the lightmap textures in a high dynamic range format (EXR). If [code]false[/code], stores the lightmap texture in a low dynamic range PNG image. This can be set to [code]false[/code] to reduce disk usage, but light values over 1.0 will be clamped and you may see banding caused by the reduced precision.
  95. [b]Note:[/b] Setting [member use_hdr] to [code]true[/code] will decrease lightmap banding even when using the GLES2 backend or if [member ProjectSettings.rendering/quality/depth/hdr] is [code]false[/code].
  96. </member>
  97. </members>
  98. <constants>
  99. <constant name="BAKE_QUALITY_LOW" value="0" enum="BakeQuality">
  100. The lowest bake quality mode. Fastest to calculate.
  101. </constant>
  102. <constant name="BAKE_QUALITY_MEDIUM" value="1" enum="BakeQuality">
  103. The default bake quality mode.
  104. </constant>
  105. <constant name="BAKE_QUALITY_HIGH" value="2" enum="BakeQuality">
  106. A higher bake quality mode. Takes longer to calculate.
  107. </constant>
  108. <constant name="BAKE_QUALITY_ULTRA" value="3" enum="BakeQuality">
  109. The highest bake quality mode. Takes the longest to calculate.
  110. </constant>
  111. <constant name="BAKE_ERROR_OK" value="0" enum="BakeError">
  112. Baking was successful.
  113. </constant>
  114. <constant name="BAKE_ERROR_NO_SAVE_PATH" value="1" enum="BakeError">
  115. Returns if no viable save path is found. This can happen where an [member image_path] is not specified or when the save location is invalid.
  116. </constant>
  117. <constant name="BAKE_ERROR_NO_MESHES" value="2" enum="BakeError">
  118. Currently unused.
  119. </constant>
  120. <constant name="BAKE_ERROR_CANT_CREATE_IMAGE" value="3" enum="BakeError">
  121. Returns when the baker cannot save per-mesh textures to file.
  122. </constant>
  123. <constant name="BAKE_ERROR_LIGHTMAP_SIZE" value="4" enum="BakeError">
  124. The size of the generated lightmaps is too large.
  125. </constant>
  126. <constant name="BAKE_ERROR_INVALID_MESH" value="5" enum="BakeError">
  127. Some mesh contains UV2 values outside the [code][0,1][/code] range.
  128. </constant>
  129. <constant name="BAKE_ERROR_USER_ABORTED" value="6" enum="BakeError">
  130. Returns if user cancels baking.
  131. </constant>
  132. <constant name="BAKE_ERROR_NO_LIGHTMAPPER" value="7" enum="BakeError">
  133. Returns if lightmapper can't be created. Unless you are using a custom lightmapper, please report this as bug.
  134. </constant>
  135. <constant name="BAKE_ERROR_NO_ROOT" value="8" enum="BakeError">
  136. There is no root node to start baking from. Either provide [code]from_node[/code] argument or attach this node to a parent that should be used as root.
  137. </constant>
  138. <constant name="ENVIRONMENT_MODE_DISABLED" value="0" enum="EnvironmentMode">
  139. No environment is used during baking.
  140. </constant>
  141. <constant name="ENVIRONMENT_MODE_SCENE" value="1" enum="EnvironmentMode">
  142. The baked environment is automatically picked from the current scene.
  143. </constant>
  144. <constant name="ENVIRONMENT_MODE_CUSTOM_SKY" value="2" enum="EnvironmentMode">
  145. A custom sky is used as environment during baking.
  146. </constant>
  147. <constant name="ENVIRONMENT_MODE_CUSTOM_COLOR" value="3" enum="EnvironmentMode">
  148. A custom solid color is used as environment during baking.
  149. </constant>
  150. </constants>
  151. </class>