|
@@ -6,7 +6,7 @@ Baked Lightmaps
|
|
|
Introduction
|
|
|
------------
|
|
|
|
|
|
-Baked lightmaps are an alternative workflow for adding indirect (or baked) lighting to a scene. Unlike the :ref:`gi_probes` approach,
|
|
|
+Baked lightmaps are an alternative workflow for adding indirect (or baked) lighting to a scene. Unlike the :ref:`doc_gi_probes` approach,
|
|
|
baked lightmaps work fine on very low end PCs and mobile as they consume almost no resources in run-time.
|
|
|
|
|
|
Unlike GIProbes, Baked Lightmaps are completely static, one baked they can't be modified at all. They also don't provide the scene with
|
|
@@ -14,7 +14,7 @@ reflections, so using :ref:`doc_reflection_probes` together with it on interiors
|
|
|
get good quality.
|
|
|
|
|
|
As they are baked, they have less problems regarding to light bleeding than GIProbe and indirect light can look better if using Raytrace
|
|
|
-mode on high quality (but baking can take a while).
|
|
|
+mode on high quality setting (but baking can take a while to bake).
|
|
|
|
|
|
In the end, deciding whith indirect lighting approach is better depends on your use case. In general GIProbe looks better and is much
|
|
|
easier to set upt. For low end compatibility or mobile, though, Baked Lightmaps are your only choice.
|
|
@@ -36,11 +36,12 @@ that ensures any face in the object has it's own place in the UV map. Faces must
|
|
|
|
|
|
There are a few ways to ensure your object has a unique UV2 layer and texture size
|
|
|
|
|
|
-Unwrap from your 3D DCC, set manually
|
|
|
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
+Unwrap from your 3D DCC
|
|
|
+~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
One option is to do it from your favorite 3D app. This approach is generally not recommended but it's explained first so you know it exists.
|
|
|
-The main advantage is that, on very complex objects that you may want to re-import a lot, the texture generation process can be quite costly within Godot.
|
|
|
+The main advantage is that, on very complex objects that you may want to re-import a lot, the texture generation process can be quite costly within Godot,
|
|
|
+so having it unwrapped before import can be faster.
|
|
|
|
|
|
Simply do an unwrap on the second UV2 layer.
|
|
|
|
|
@@ -51,7 +52,7 @@ And import normally. Remember you will need to set the texture size on the mesh
|
|
|
.. image:: img/baked_light_lmsize.png
|
|
|
|
|
|
If you use external meshes on import, the size will be kept.
|
|
|
-Be wary that most unwrappers in 3D DCCs are not very quality oriented, as they are meant to work quick. You will mostly need to set seams to create better unwrapping.
|
|
|
+Be wary that most unwrappers in 3D DCCs are not very quality oriented, as they are meant to work quick. You will mostly need to use seams or other techniques to create better unwrapping.
|
|
|
|
|
|
Unwrap from within Godot
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
@@ -60,37 +61,41 @@ Godot has an option to unwrap meshes and visualize the UV channels. It can be fo
|
|
|
|
|
|
.. image:: img/baked_light_mesh_menu.png
|
|
|
|
|
|
+This will generate a second set of UV2 coordinates, which can be used for baking and it will set the texture size automatically.
|
|
|
+
|
|
|
Unwrap on Scene import
|
|
|
~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
This is probably the best approach overall. The only downside is that, on large models, unwrap can take a while on import.
|
|
|
-Just go to the Import tab of the selected source scene in the filesystem dock:
|
|
|
+Just select the imported scene in the filesystem dock, then go to the Import tab. There, the following option can be modified:
|
|
|
|
|
|
.. image:: img/baked_light_import.png
|
|
|
|
|
|
-The lightmap mode needs to be set to "Gen Lightmaps". A texel size in world units must also be set, as this will determine the
|
|
|
+The **Light Baking** mode needs to be set to **"Gen Lightmaps"**. A texel size in world units must also be provided, as this will determine the
|
|
|
final size of the lightmap texture (and, in consequence, the UV padding in the map).
|
|
|
|
|
|
-The result is that all meshes within the scene will have their UV2 maps properly unwrapped.
|
|
|
+The effect of setting this option is that all meshes within the scene will have their UV2 maps properly generated.
|
|
|
|
|
|
As a word of warning: When reusing a mesh within a scene, keep in mind that UVs will be generated for the first instance found. If the mesh is re-used with different scales (and the scales
|
|
|
-are wildly different, more than half or twice), this will result in very inefficient lightmaps. Just don't reuse a source mesh at different scales if you are planning to use lightmapping.
|
|
|
+are wildly different, more than half or twice), this will result in inefficient lightmaps. Just don't reuse a source mesh at very different scales if you are planning to use lightmapping.
|
|
|
|
|
|
Checking UV2
|
|
|
~~~~~~~~~~~~
|
|
|
|
|
|
-In the mesh menu mentioned before, the UV2 texture coordinates can be visualized. Make sure, if something is failing, to check that the meshes do in fact have this data:
|
|
|
+In the mesh menu mentioned before, the UV2 texture coordinates can be visualized. Make sure, if something is failing, to check that the meshes have theese UV2 coordinates:
|
|
|
|
|
|
.. image:: img/baked_light_uvchannel.png
|
|
|
|
|
|
Setting up the Scene
|
|
|
----------------
|
|
|
|
|
|
-Before anything is done, a BakedLight needs to be added to a scene. This will enable light baking on all nodes (and sub-nodes) in that scene, even on instanced scenes.
|
|
|
-A scene can be instanced several times and the bake will also be unique (just make sure to respect the rule about scaling mentioned before):
|
|
|
+Before anything is done, a **BakedLight** Node needs to be added to a scene. This will enable light baking on all nodes (and sub-nodes) in that scene, even on instanced scenes.
|
|
|
|
|
|
.. image:: img/baked_light_scene.png
|
|
|
|
|
|
+A sub-scene can be instanced several times, as this is supported by the baker and each will be assigned a lightmap of it's own (just make sure to respect the rule about scaling mentioned before):
|
|
|
+
|
|
|
+
|
|
|
Configure Bounds
|
|
|
~~~~~~~~~~~~~~~~~
|
|
|
|
|
@@ -102,10 +107,12 @@ cover the scene with the volume, as you do with GIProbe:
|
|
|
Setting Up Meshes
|
|
|
~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
-To be baked, MeshInstance nodes need to have the "Use in Baked Light" property toggled on. When auto-generating lightmaps on scene import, this is toggled on automatically.
|
|
|
+For a **MeshInstance** node to take part in the baking process, it needs to have the "Use in Baked Light" property enabled.
|
|
|
|
|
|
.. image:: img/baked_light_use.png
|
|
|
|
|
|
+When auto-generating lightmaps on scene import, this is enabled automatically.
|
|
|
+
|
|
|
Setting up Lights
|
|
|
~~~~~~~~~~~~~~~~~
|
|
|
|
|
@@ -125,16 +132,20 @@ The modes are :
|
|
|
Baking Quality
|
|
|
~~~~~~~~~~~~~~
|
|
|
|
|
|
-BakedLightmap uses, for simplicity, a voxelized version of the scene to compute lighting. More subdvision results in more detail, but also is slower.
|
|
|
-In general, the defaults are good enough. There is also a capture subdivision (that must always be equal or less to the main subdivision), which is used
|
|
|
+BakedLightmap uses, for simplicity, a voxelized version of the scene to compute lighting. Voxel size can be adjusted with the **Bake Subdiv** parameter.
|
|
|
+More subdvision results in more detail, but also takes more time to bake.
|
|
|
+
|
|
|
+In general, the defaults are good enough. There is also a **Capture Subdivision** (that must always be equal or less to the main subdivision), which is used
|
|
|
for capturing light in dynamic objects (more on that later). It's default value is also good enough for more cases.
|
|
|
|
|
|
-Two modes of capturing indirect are provided:
|
|
|
+.. image:: img/baked_light_capture.png
|
|
|
+
|
|
|
+Besides the capture size, quality can be modified by setting the **Bake Mode**. Two modes of capturing indirect are provided:
|
|
|
|
|
|
.. image:: img/baked_light_mode.png
|
|
|
|
|
|
-* Voxel Cone Trace: Is the default one, it's less precise but very fast. Look similar (but slightly better) to GIProbe.
|
|
|
-* Ray Tracing: This method is more precise, but can take considerably longer to bake. If used in low or medium quality, some scenes may produce grain.
|
|
|
+- **Voxel Cone**: Trace: Is the default one, it's less precise but very fast. Look similar (but slightly better) to GIProbe.
|
|
|
+- **Ray Tracing**: This method is more precise, but can take considerably longer to bake. If used in low or medium quality, some scenes may produce grain.
|
|
|
|
|
|
|
|
|
Baking
|
|
@@ -169,6 +180,6 @@ In other engines or lightmapper implementations, you are required to manually pl
|
|
|
|
|
|
This implementation of lightmapping uses a different method, so this process is automatic and you don't have to do anything. Just move your objects around and they will be lit accordingly. Of course, you have to make sure you set up your scene bounds accordingly or it won't work.
|
|
|
|
|
|
-.. image:: img/baked_light_indirect.png
|
|
|
+.. image:: img/baked_light_indirect.gif
|
|
|
|
|
|
|