using_lightmap_gi.rst 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  1. .. _doc_using_lightmap_gi:
  2. Using Lightmap global illumination
  3. ==================================
  4. Baked lightmaps are a workflow for adding indirect (or fully baked)
  5. lighting to a scene. Unlike the :ref:`VoxelGI <doc_using_voxel_gi>` and
  6. :ref:`SDFGI <doc_using_sdfgi>` approaches, baked lightmaps work fine on low-end PCs
  7. and mobile devices, as they consume almost no resources at runtime. Also unlike
  8. VoxelGI and SDFGI, baked lightmaps can optionally be used to store direct
  9. lighting, which provides even further performance gains.
  10. Unlike VoxelGI and SDFGI, baked lightmaps are completely static. Once baked, they
  11. can't be modified at all. They also don't provide the scene with reflections, so
  12. using :ref:`doc_reflection_probes` together with it on interiors (or using a Sky
  13. on exteriors) is a requirement to get good quality.
  14. As they are baked, they have fewer problems than VoxelGI and SDFGI regarding
  15. light bleeding, and indirect light will often look better. The downside is that
  16. baking lightmaps takes longer compared to baking VoxelGI. While baking VoxelGI
  17. can be done in a matter of seconds, baking lightmaps can take several minutes if
  18. not more. This can slow down iteration speed significantly, so it is recommended
  19. to bake lightmaps only when you actually need to see changes in lighting. Since
  20. Godot 4.0, lightmaps are baked on the GPU, making light baking faster if you
  21. have a mid-range or high-end dedicated GPU.
  22. Baking lightmaps will also reserve baked materials' UV2 slot, which means you can
  23. no longer use it for other purposes in materials (either in the built-in
  24. :ref:`doc_standard_material_3d` or in custom shaders).
  25. Despite their lack of flexibility, baked lightmaps typically offer both the best
  26. quality *and* performance at the same time in (mostly) static scenes. This makes
  27. lightmaps still popular in game development, despite lightmaps being the
  28. oldest technique for global illumination in video games.
  29. .. seealso::
  30. Not sure if LightmapGI is suited to your needs?
  31. See :ref:`doc_introduction_to_global_illumination_comparison`
  32. for a comparison of GI techniques available in Godot 4.
  33. Visual comparison
  34. -----------------
  35. .. figure:: img/gi_none.webp
  36. :alt: LightmapGI disabled.
  37. LightmapGI disabled.
  38. .. figure:: img/gi_lightmap_gi_indirect_only.webp
  39. :alt: LightmapGI enabled (with indirect light baked only).
  40. LightmapGI enabled (with indirect light baked only). Direct light is still
  41. real-time, allowing for subtle changes during gameplay.
  42. .. figure:: img/gi_lightmap_gi_direct_and_indirect.webp
  43. :alt: LightmapGI enabled (with direct and indirect light baked).
  44. LightmapGI enabled (with direct and indirect light baked). Best performance,
  45. but lower quality visuals. Notice the blurrier sun shadow in the top-right
  46. corner.
  47. Here are some comparisons of how LightmapGI vs. VoxelGI look. Notice that
  48. lightmaps are more accurate, but also suffer from the fact
  49. that lighting is on an unwrapped texture, so transitions and resolution may not
  50. be that good. VoxelGI looks less accurate (as it's an approximation), but
  51. smoother overall.
  52. .. image:: img/lightmap_gi_comparison.png
  53. SDFGI is also less accurate compared to LightmapGI. However, SDFGI can support
  54. large open worlds without any need for baking.
  55. Setting up
  56. ----------
  57. .. warning::
  58. Baking lightmaps in the Android and web editors is not supported due to
  59. graphics API limitations on those devices. On Android and web platforms,
  60. only *rendering* lightmaps that were baked on a desktop PC is supported.
  61. .. note::
  62. The LightmapGI node only bakes nodes that are on the same level as the
  63. LightmapGI node (siblings), or nodes that are children of the
  64. LightmapGI node. This allows you to use several LightmapGI nodes to bake
  65. different parts of the scene, independently from each other.
  66. First of all, before the lightmapper can do anything, the objects to be baked need
  67. a UV2 layer and a texture size. A UV2 layer is a set of secondary texture coordinates
  68. that ensures any face in the object has its own place in the UV map. Faces must
  69. not share pixels in the texture.
  70. There are a few ways to ensure your object has a unique UV2 layer and texture size:
  71. Unwrap on scene import (recommended)
  72. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  73. In most scenarios, this is the best approach to use. The only downside is that,
  74. on large models, unwrapping can take a while on import. Nonetheless, Godot will
  75. cache the UV2 across reimports, so it will only be regenerated when needed.
  76. Select the imported scene in the filesystem dock, then go to the **Import** dock.
  77. There, the following option can be modified:
  78. .. image:: img/lightmap_gi_import.webp
  79. The **Meshes > Light Baking** option must be set to **Static Lightmaps (VoxelGI/SDFGI/LightmapGI)**:
  80. .. image:: img/lightmap_gi_mesh_import_meshes.webp
  81. When unwrapping on import, you can adjust the texture size using the **Meshes > Lightmap
  82. Texel Size** option. *Lower* values will result in more detailed lightmaps,
  83. possibly resulting in higher visual quality at the cost of longer bake times and
  84. larger lightmap file sizes. The default value of ``0.2`` is suited for
  85. small/medium-sized scenes, but you may want to increase it to ``0.5`` or even
  86. more for larger scenes. This is especially the case if you're baking indirect
  87. lighting only, as indirect light is low-frequency data (which means it doesn't
  88. need high-resolution textures to be accurately represented).
  89. The effect of setting this option is that all meshes within the scene will have
  90. their UV2 maps properly generated.
  91. .. warning::
  92. When reusing a mesh within a scene, keep in mind that UVs will be generated
  93. for the first instance found. If the mesh is re-used with different scales
  94. (and the scales are wildly different, more than half or twice), this will
  95. result in inefficient lightmaps. To avoid this, adjust the **Lightmap
  96. Scale** property in the GeometryInstance3D section of a MeshInstance3D node.
  97. This lets you *increase* the level of lightmap detail for specific
  98. MeshInstance3D nodes (but not decrease it).
  99. Also, the ``*.unwrap_cache`` files should *not* be ignored in version control
  100. as these files guarantee that UV2 reimports are consistent across platforms
  101. and engine versions.
  102. Unwrap from within Godot
  103. ^^^^^^^^^^^^^^^^^^^^^^^^
  104. .. warning::
  105. If this Mesh menu operation is used on an imported 3D scene, the generated
  106. UV2 will be lost when the scene is reloaded.
  107. Godot has an option to unwrap meshes and visualize the UV channels. After
  108. selecting a MeshInstance3D node, it can be found in the **Mesh** menu at the top
  109. of the 3D editor viewport:
  110. .. image:: img/lightmap_gi_mesh_menu.webp
  111. This will generate a second set of UV2 coordinates which can be used for baking.
  112. It will also set the texture size automatically.
  113. Unwrap from your 3D modeling software
  114. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  115. The last option is to do it from your favorite 3D app. This approach is
  116. generally **not recommended**, but it's explained so that you know it exists.
  117. The main advantage is that, on complex objects that you may want to re-import a
  118. lot, the texture generation process can be quite costly within Godot, so having
  119. it unwrapped before import can be faster.
  120. Simply do an unwrap on the second UV2 layer.
  121. .. image:: img/lightmap_gi_blender.webp
  122. Then import the 3D scene normally. Remember you will need to set the texture
  123. size on the mesh after import.
  124. .. image:: img/lightmap_gi_lmsize.webp
  125. If you use external meshes on import, the size will be kept. Be wary that most
  126. unwrappers in 3D modeling software are not quality-oriented, as they are meant
  127. to work quickly. You will mostly need to use seams or other techniques to create
  128. better unwrapping.
  129. Generating UV2 for primitive meshes
  130. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  131. .. note::
  132. This option is only available for primitive meshes such as :ref:`class_BoxMesh`,
  133. :ref:`class_CylinderMesh`, :ref:`class_PlaneMesh`, etc.
  134. Enabling UV2 on primitive meshes allows you to make them receive and contribute
  135. to baked lighting. This can be used in certain lighting setups. For instance,
  136. you could hide a torus that has an emissive material after baking lightmaps to
  137. create an area light that follows the shape of a torus.
  138. By default, primitive meshes do not have UV2 generated to save resources (as
  139. these meshes may be created during gameplay). You can edit a primitive mesh in
  140. the inspector and enable **Add UV2** to make the engine procedurally generate
  141. UV2 for a primitive mesh. The default **UV2 Padding** value is tuned to avoid
  142. most lightmap bleeding, without wasting too much space on the edges. If you
  143. notice lightmap bleeding on a specific primitive mesh only, you may have to
  144. increase **UV2 Padding**.
  145. **Lightmap Size Hint** represents the size taken by a single mesh on the
  146. lightmap texture, which varies depending on the mesh's size properties and the
  147. **UV2 Padding** value. **Lightmap Size Hint** should not be manually changed, as
  148. any modifications will be lost when the scene is reloaded.
  149. Generating UV2 for CSG nodes
  150. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  151. Since Godot 4.4, you can
  152. :ref:`convert a CSG node and its children to a MeshInstance3D <doc_csg_tools_converting_to_mesh_instance_3d>`.
  153. This can be used to bake lightmaps on a CSG node by following these steps:
  154. - Select the root CSG node and choose **CSG > Bake Mesh Instance** at the top of the 3D editor viewport.
  155. - Hide the root CSG node that was just baked (it is not hidden automatically).
  156. - Select the newly created MeshInstance3D node and choose **Mesh > Unwrap UV2 for Lightmap/AO**.
  157. - Bake lightmaps.
  158. .. tip::
  159. Remember to keep the original CSG node in the scene tree, so that you can
  160. perform changes to the geometry later if needed. To make changes to the
  161. geometry, remove the MeshInstance3D node and make the root CSG node visible
  162. again.
  163. Checking UV2
  164. ^^^^^^^^^^^^
  165. In the **Mesh** menu mentioned before, the UV2 texture coordinates can be visualized.
  166. If something is failing, double-check that the meshes have these UV2 coordinates:
  167. .. image:: img/lightmap_gi_uvchannel.webp
  168. Setting up the scene
  169. --------------------
  170. Before anything is done, a **LightmapGI** node needs to be added to a scene.
  171. This will enable light baking on all nodes (and sub-nodes) in that scene, even
  172. on instanced scenes.
  173. .. image:: img/lightmap_gi_scene.webp
  174. A sub-scene can be instanced several times, as this is supported by the baker.
  175. Each instance will be assigned a lightmap of its own. To avoid issues with
  176. inconsistent lightmap texel scaling, make sure to respect the rule about mesh
  177. scaling mentioned before.
  178. Setting up meshes
  179. ^^^^^^^^^^^^^^^^^
  180. For a **MeshInstance3D** node to take part in the baking process, it needs to have
  181. its bake mode set to **Static**. Meshes that have their bake mode set to **Disabled**
  182. or **Dynamic** will be ignored by the lightmapper.
  183. .. image:: img/lightmap_gi_use.webp
  184. When auto-generating lightmaps on scene import, this is enabled automatically.
  185. Setting up lights
  186. ^^^^^^^^^^^^^^^^^
  187. Lights are baked with indirect light only by default. This means that shadowmapping
  188. and lighting are still dynamic and affect moving objects, but light bounces from
  189. that light will be baked.
  190. Lights can be disabled (no bake) or be fully baked (direct and indirect). This
  191. can be controlled from the **Bake Mode** menu in lights:
  192. .. image:: img/lightmap_gi_bake_mode.webp
  193. The modes are:
  194. Disabled
  195. ^^^^^^^^
  196. The light is ignored when baking lightmaps. This is the mode to use for dynamic
  197. lighting effects such as explosions and weapon effects.
  198. .. warning::
  199. Hiding a light has no effect on the resulting lightmap bake. This means
  200. you must use the Disabled bake mode instead of hiding the Light node by
  201. disabling its **Visible** property.
  202. Dynamic
  203. ^^^^^^^
  204. This is the default mode, and is a compromise between performance and real-time
  205. friendliness. Only indirect lighting will be baked. Direct light and shadows are
  206. still real-time, as they would be without LightmapGI.
  207. This mode allows performing *subtle* changes to a light's color, energy and
  208. position while still looking fairly correct. For example, you can use this
  209. to create flickering static torches that have their indirect light baked.
  210. Static
  211. ^^^^^^
  212. Both indirect and direct lighting will be baked. Since static surfaces can skip
  213. lighting and shadow computations entirely, this mode provides the best
  214. performance along with smooth shadows that never fade based on distance. The
  215. real-time light will not affect baked surfaces anymore, but it will still affect
  216. dynamic objects. When using the **All** bake mode on a light, dynamic objects
  217. will not cast real-time shadows onto baked surfaces, so you need to use a
  218. different approach such as blob shadows instead. Blob shadows can be implemented
  219. with a Decal node.
  220. The light will not be adjustable at all during gameplay. Moving the light or
  221. changing its color (or energy) will not have any effect on static surfaces.
  222. Since bake modes can be adjusted on a per-light basis, it is possible to create
  223. hybrid baked light setups. One popular option is to use a real-time
  224. DirectionalLight with its bake mode set to **Dynamic**, and use the **Static**
  225. bake mode for OmniLights and SpotLights. This provides good performance while
  226. still allowing dynamic objects to cast real-time shadows in outdoor areas.
  227. Fully baked lights can also make use of light nodes' **Size** (omni/spot) or
  228. **Angular Distance** (directional) properties. This allows for shadows with
  229. realistic penumbra that increases in size as the distance between the caster and
  230. the shadow increases. This also has a lower performance cost compared to
  231. real-time PCSS shadows, as only dynamic objects have real-time shadows rendered
  232. on them.
  233. .. image:: img/lightmap_gi_omnilight_size.png
  234. Baking
  235. ------
  236. To begin the bake process, click the **Bake Lightmaps** button at the top of the
  237. 3D editor viewport when selecting the LightmapGI node:
  238. .. image:: img/lightmap_gi_bake.webp
  239. This can take from seconds to minutes (or hours) depending on scene size, bake
  240. method and quality selected.
  241. .. warning::
  242. Baking lightmaps is a process that can require a lot of video memory,
  243. especially if the resulting texture is large. Due to internal limitations,
  244. the engine may also crash if the generated texture size is too large (even
  245. on systems with a lot of video memory).
  246. To avoid crashes, make sure the lightmap texel size in the Import dock is
  247. set to a high enough value.
  248. Tweaks
  249. ^^^^^^
  250. - **Quality:** Four bake quality modes are provided: Low, Medium, High, and
  251. Ultra. Higher quality takes more time, but result in a better-looking lightmap
  252. with less noise. The difference is especially noticeable with emissive
  253. materials or areas that get little to no direct lighting. Each bake quality
  254. mode can be further adjusted in the Project Settings.
  255. - **Bounces:** The number of bounces to use for indirect lighting. The default
  256. value (``3``) is a good compromise between bake times and quality. Higher
  257. values will make light bounce around more times before it stops, which makes
  258. indirect lighting look smoother (but also possibly brighter depending on
  259. materials and geometry).
  260. - **Bounce Indirect Energy:** The global multiplier to use when baking lights'
  261. indirect energy. This multiplies each light's own **Indirect Energy** value.
  262. Values different from ``1.0`` are not physically accurate, but can be used for
  263. artistic effect.
  264. - **Directional:** If enabled, stores directional information for lightmaps.
  265. This improves normal mapped materials' appearance for baked surfaces,
  266. especially with fully baked lights (since they also have direct light baked).
  267. The downside is that directional lightmaps are slightly more expensive to render.
  268. They also require more time to bake and result in larger file sizes.
  269. - **Interior:** If enabled, environment lighting will not be sourced. Use this
  270. for purely indoor scenes to avoid light leaks.
  271. - **Use Texture for Bounces:** If enabled, a texture with the lighting
  272. information will be generated to speed up the generation of indirect lighting
  273. at the cost of some accuracy. The geometry might exhibit extra light leak
  274. artifacts when using low resolution lightmaps or UVs that stretch the lightmap
  275. significantly across surfaces. Leave this enabled if unsure.
  276. - **Use Denoiser:** If enabled, uses a denoising algorithm to make the lightmap
  277. significantly less noisy. This increases bake times and can occasionally
  278. introduce artifacts, but the result is often worth it. See
  279. :ref:`doc_using_lightmap_gi_denoising` for more information.
  280. - **Denoiser Strength:** The strength of denoising step applied to the generated
  281. lightmaps. Higher values are more effective at removing noise, but can reduce
  282. shadow detail for static shadows. Only effective if denoising is enabled and
  283. the denoising method is :abbr:`JNLM (Non-Local Means with Joint Filtering)`
  284. (:abbr:`OIDN (Open Image Denoise)` does not have a denoiser strength setting).
  285. - **Bias:** The offset value to use for shadows in 3D units. You generally don't
  286. need to change this value, except if you run into issues with light bleeding or
  287. dark spots in your lightmap after baking. This setting does not affect real-time
  288. shadows casted on baked surfaces (for lights with **Dynamic** bake mode).
  289. - **Max Texture Size:** The maximum texture size for the generated texture
  290. atlas. Higher values will result in fewer slices being generated, but may not
  291. work on all hardware as a result of hardware limitations on texture sizes.
  292. Leave this at its default value of ``16384`` if unsure.
  293. - **Environment > Mode:** Controls how environment lighting is sourced when
  294. baking lightmaps. The default value of **Scene** is suited for levels with
  295. visible exterior parts. For purely indoor scenes, set this to **Disabled** to
  296. avoid light leaks and speed up baking. This can also be set to **Custom Sky**
  297. or **Custom Color** to use environment lighting that differs from the actual
  298. scene's environment sky.
  299. - **Gen Probes > Subdiv:** See :ref:`doc_using_lightmap_gi_dynamic_objects`.
  300. - **Data > Light Data:** See :ref:`doc_using_lightmap_gi_data`.
  301. Balancing bake times with quality
  302. ---------------------------------
  303. Since high-quality bakes can take very long (up to dozens of minutes for large
  304. complex scenes), it is recommended to use lower quality settings at first. Then,
  305. once you are confident with your scene's lighting setup, raise the quality
  306. settings and perform a "final" bake before exporting your project.
  307. Reducing the lightmap resolution by increasing **Lightmap Texel Size** on the
  308. imported 3D scenes will also speed up baking significantly. However, this will
  309. require you to reimport all lightmapped 3D scenes before you can bake lightmaps
  310. again.
  311. .. _doc_using_lightmap_gi_denoising:
  312. Denoising
  313. ---------
  314. Since baking lightmaps relies on raytracing, there will always be visible noise
  315. in the "raw" baked lightmap. Noise is especially visible in areas that are
  316. difficult to reach by bounced light, such as indoor areas with small openings
  317. where the sunlight can enter. Noise can be reduced by increasing bake quality,
  318. but doing so will increase bake times significantly.
  319. .. figure:: img/lightmap_gi_denoiser_comparison.webp
  320. :align: center
  321. :alt: Comparison between denoising disabled and enabled
  322. Comparison between denoising disabled and enabled (with the default JNLM denoiser).
  323. To combat noise without increasing bake times too much, a denoiser can be used.
  324. A denoiser is an algorithm that runs on the final baked lightmap, detects patterns of
  325. noise and softens them while attempting to best preserve detail.
  326. Godot offers two denoising algorithms:
  327. JNLM (Non-Local Means with Joint Filtering)
  328. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  329. JNLM is the default denoising method and is included in Godot. It uses a simple
  330. but efficient denoising algorithm known as *non-local means*. JNLM runs on the
  331. GPU using a compute shader, and is compatible with any GPU that can run Godot
  332. 4's Vulkan-based rendering methods. No additional setup is required.
  333. JNLM's denoising can be adjusted using the **Denoiser Strength** property that
  334. is visible when **Use Denoiser** enabled. Higher values can be more effective at
  335. removing noise, at the cost of suppressing shadow detail for static shadows.
  336. .. figure:: img/lightmap_gi_denoiser_jnlm_strength.webp
  337. :align: center
  338. :alt: Comparison between JNLM denoiser strength values
  339. Comparison between JNLM denoiser strength values. Higher values can reduce detail.
  340. OIDN (Open Image Denoise)
  341. ^^^^^^^^^^^^^^^^^^^^^^^^^
  342. Unlike JNLM, OIDN uses a machine learning approach to denoising lightmaps. It
  343. features a model specifically trained to remove noise from lightmaps while
  344. preserving more shadow detail in most scenes compared to JNLM.
  345. OIDN can run on the GPU if hardware acceleration is configured. With a modern
  346. high-end GPU, this can provide a speedup of over 50× over CPU-based denoising:
  347. - On AMD GPUs, HIP must be installed and configured.
  348. - On NVIDIA GPUs, CUDA must be installed and configured. This may automatically
  349. be done by the NVIDIA installer, but on Linux, CUDA libraries may not be
  350. installed by default. Double-check that the CUDA packages from your Linux
  351. distribution are installed.
  352. - On Intel GPUs, SYCL must be installed and configured.
  353. If hardware acceleration is not available, OIDN will fall back to multithreaded
  354. CPU-based denoising. To confirm whether GPU-based denoising is working, use a
  355. GPU utilization monitor while baking lightmaps and look at the GPU utilization
  356. percentage and VRAM utilization while the denoising step is shown in the Godot
  357. editor. The ``nvidia-smi`` command line tool can be useful for this.
  358. OIDN is not included with Godot due to its relatively large download size. You
  359. can download precompiled OIDN binary packages from its
  360. `website <https://www.openimagedenoise.org/downloads.html>`__.
  361. Extract the package to a location on your PC, then specify the path to the
  362. ``oidnDenoise`` executable in the Editor Settings (**FileSystem > Tools > OIDN >
  363. OIDN Denoise Path**). This executable is located within the ``bin`` folder of
  364. the binary package you extracted.
  365. After specifying the path to the OIDN denoising executable, change the denoising
  366. method in the project settings by setting **Rendering > Lightmapping >
  367. Denoiser** to **OIDN**. This will affect all lightmap bakes on this project
  368. after the setting is changed.
  369. .. note::
  370. The denoising method is configured in the project settings instead of the
  371. editor settings. This is done so that different team members working on the
  372. same project are assured to be using the same denoising method for
  373. consistent results.
  374. .. figure:: img/lightmap_gi_denoiser_jnlm_vs_oidn.webp
  375. :align: center
  376. :alt: Comparison between JNLM and OIDN denoisers
  377. Comparison between JNLM and OIDN denoisers.
  378. Notice how OIDN better preserves detail and reduces seams across different objects.
  379. .. _doc_using_lightmap_gi_dynamic_objects:
  380. Dynamic objects
  381. ---------------
  382. Unlike VoxelGI and SDFGI, dynamic objects receive indirect lighting differently
  383. compared to static objects. This is because lightmapping is only performed on
  384. static objects.
  385. To display indirect lighting on dynamic objects, a 3D probe system is used, with
  386. light probes being spread throughout the scene. When baking lightmaps, the
  387. lightmapper will calculate the amount of *indirect* light received by the probe.
  388. Direct light is not stored within light probes, even for lights that have their
  389. bake mode set to **Static** (as dynamic objects continue to be lit in
  390. real-time).
  391. There are 2 ways to add light probes to a scene:
  392. - **Automatic:** Set **Gen Probes > Subdiv** to a value other than **Disabled**,
  393. then bake lightmaps. The default is ``8``, but you can choose a greater value
  394. to improve precision at the cost of longer bake times and larger output file
  395. size.
  396. - **Manual:** In addition or as an alternative to generating probes
  397. automatically, you can add light probes manually by adding :ref:`class_LightmapProbe`
  398. nodes to the scene. This can be used to improve lighting detail in areas frequently
  399. travelled by dynamic objects. After placing LightmapProbe nodes in the scene,
  400. you must bake lightmaps again for them to be effective.
  401. .. note::
  402. After baking lightmaps, you will notice white spheres in the 3D scene that
  403. represent how baked lighting will affect dynamic objects. These spheres do
  404. **not** appear in the running project.
  405. If you want to hide these spheres in the editor, toggle **View > Gizmos >
  406. LightmapGI** at the top of the 3D editor (a "closed eye" icon indicates the
  407. gizmo is hidden).
  408. .. _doc_using_lightmap_gi_data:
  409. Lightmap data
  410. -------------
  411. The **Data > Light Data** property in the LightmapGI node contains the lightmap
  412. data after baking. Textures are saved to disk, but this also contains the
  413. capture data for dynamic objects, which can be heavy. If you are using a scene
  414. in ``.tscn`` format, you should save this resource to an external binary
  415. ``.lmbake`` file to avoid bloating the ``.tscn`` scene with binary data encoded
  416. in Base64.
  417. .. tip::
  418. The generated EXR file can be viewed and even edited using an image editor
  419. to perform post-processing if needed. However, keep in mind that changes to
  420. the EXR file will be lost when baking lightmaps again.
  421. Reducing LightmapGI artifacts
  422. -----------------------------
  423. If you notice LightmapGI nodes popping in and out of existence as the camera
  424. moves, this is most likely because the engine is rendering too many LightmapGI
  425. instances at once. Godot is limited to rendering 8 LightmapGI nodes at once,
  426. which means up to 8 instances can be in the camera view before some of them will
  427. start flickering.