{"id":6034,"date":"2022-08-18T12:41:01","date_gmt":"2022-08-18T11:41:01","guid":{"rendered":"https:\/\/www.katsbits.com\/codex\/?p=6034"},"modified":"2023-09-07T15:49:44","modified_gmt":"2023-09-07T14:49:44","slug":"bake-lightmaps","status":"publish","type":"post","link":"https:\/\/www.katsbits.com\/codex\/bake-lightmaps\/","title":{"rendered":"Bake Lightmaps (Light Maps)"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_83 counter-hierarchy ez-toc-counter ez-toc-light-blue ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a06dd932d220\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a06dd932d220\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.katsbits.com\/codex\/bake-lightmaps\/#object-scene-setup\" >Object &#038; Scene Setup<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.katsbits.com\/codex\/bake-lightmaps\/#lightmap-material-setup\" >Lightmap Material Setup<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.katsbits.com\/codex\/bake-lightmaps\/#lightmap-uv-map\" >Lightmap UV Map<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.katsbits.com\/codex\/bake-lightmaps\/#single-object-lightmap-uv\" >Single Object Lightmap UV<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.katsbits.com\/codex\/bake-lightmaps\/#single-object-lightmap-bake\" >Single Object Lightmap Bake<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.katsbits.com\/codex\/bake-lightmaps\/#save-use-lightmap\" >Save &#038; Use Lightmap<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.katsbits.com\/codex\/bake-lightmaps\/#bake-colour-tinted-lightmaps\" >Bake Colour Tinted Lightmaps<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.katsbits.com\/codex\/bake-lightmaps\/#multiple-object-lightmap-uv\" >Multiple Object Lightmap UV<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.katsbits.com\/codex\/bake-lightmaps\/#multiple-object-lightmap-bake\" >Multiple Object Lightmap Bake<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.katsbits.com\/codex\/bake-lightmaps\/#lightmap-optimisation\" >Lightmap Optimisation<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/www.katsbits.com\/codex\/bake-lightmaps\/#exporting-lightmaps\" >Exporting Lightmaps<\/a><\/li><\/ul><\/nav><\/div>\n<div style=\"background-color: black; position: relative; padding-bottom: 56.25%; padding-top: 25px; height: 0; overflow: hidden; max-width: 100%;\"><center><iframe style=\"position: absolute; top: 0; left: 0; width: 100%; height: 100%;\" src=\"https:\/\/www.youtube.com\/embed\/Q4Ajd06eTak?rel=0\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/center><\/div>\n<p>Using <b>Texture Bake<\/b> to generate <b>Light maps<\/b> in Blender is roughly the same as it is for other types of <a href=\"https:\/\/www.katsbits.com\/codex\/texture-bake\/\">image baking<\/a>. However, because lightmaps generally serve a particular purpose, only typically including shadows or shading, they are often assigned to their own material or image data and rendered to their own UV, an additional &#8216;layer&#8217; belonging to the object or objects being rendered. To be effective then, some prep and set up is needed before baking.<\/p>\n<blockquote style=\"background-color: #fc0; color: #000;\"><p><b>Important<\/b>: Blender is by no means a &#8216;lightmapper&#8217;. Whilst it can bake shadows and shading sufficiently to be considered a &#8216;lightmap&#8217;, mileage from doing so may vary significantly depending on the intended use of the resultant texture bakes. See also <a href=\"https:\/\/www.katsbits.com\/codex\/?p=6034&#038;preview=true#exporting-lightmaps\" target=\"_self\" rel=\"noopener\">Exporting Lightmaps<\/a><\/p><\/blockquote>\n<h3><span class=\"ez-toc-section\" id=\"object-scene-setup\"><\/span>Object &#038; Scene Setup<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Before baking a lightmap with Blender make sure the objects to be processed are appropriately lit. Dynamic lights [1], that is Spot, Sun, Area and Point, and static illumination, emissive materials, Ambient Occlusion (<b><i>Render Properties \u00bb Ambient Occlusion<\/i><\/b>) or background colour [2] (<b><i>World Properties \u00bb Color<\/i><\/b>), should be set relative to visual expectations as previewed using <b>Rendered<\/b> display mode for Eevee or Cycles [3].  <\/p>\n<blockquote><p><b>Important<\/b>: when lighting an object or scene in Blender a great deal depends on how the final assets are to be used. Exported for import and assembly in third-party tools and editors, objects and scenes will typically need to replicate or at least approximate different types of lighting and their placement which may not always be possible. For example some forms of static lighting do not cast or emit light in Blender but do in other sources so temporarily light placement may be necessary in Blender to capture an object or scenes general illumination relative to those third-party uses.<\/p><\/blockquote>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-scene-setup.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"width: 100%; height: auto;\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-scene-setup.jpg\" alt=\"Lighting prep for lightmap baking\" width=\"900px\" height=\"500px\" border=\"0\" \/><\/a><br \/>\n<i>To bake lightmaps the scene or objects to be baked need to be lit using light entities [1] or scene properties [2], previewed using Render display mode [3] for either Cycles or Eevee renderers.<\/i><\/p>\n<p>Similarly objects should be correctly marked Sharp (<b><i>Edge \u00bb Mark Sharp<\/i><\/b>) [4] and <a href=\"https:\/\/www.katsbits.com\/codex\/smoothing\/\">Smoothed<\/a> (<b><i>Object \u00bb Shade Smooth<\/i><\/b>), be fully <a href=\"https:\/\/www.katsbits.com\/codex\/uv-maps\/\">UV unwrapped<\/a> and <a href=\"https:\/\/www.katsbits.com\/codex\/uv-editing\/\">mapped<\/a> [5], as well as being textured appropriately because these aspects of asset prep, smoothing, images, materials and their properties potentially influence lightmap baking.<\/p>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-mesh-prep.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"width: 100%; height: auto;\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-mesh-prep.jpg\" alt=\"Mesh prep for lightmap baking\" width=\"900px\" height=\"500px\" border=\"0\" \/><\/a><br \/>\n<i>Objects themselves need to be prepped, Sharp edges and smoothing [4] as well as being fully UV unwrapped and mapped [5], with materials and images appropriately assigned as these all potentially influence the bake process.<\/i><\/p>\n<h3><span class=\"ez-toc-section\" id=\"lightmap-material-setup\"><\/span>Lightmap Material Setup<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>For Bake to work correctly a dedicated texture slot is needed that in-turn, hosts the image actually rendered to. This additional material node can be added to, or included within, <a href=\"https:\/\/www.katsbits.com\/codex\/material-basics\/\">existing materials<\/a>. To do this, ensure the object to be baked has an <a href=\"#object-scene-setup\">existing material assignment<\/a> [6] then in <b>Shading Workspace<\/b> drop an additional <b>Image Texture<\/b> [7] node into the Node Editor &#8211; <b><i>Add \u00bb Texture \u00bb Image Texture<\/i><\/b> and to this new node add an <b>Image<\/b> clicking the <b>New +<\/b> button. In the <b>New Image<\/b> [8] pop-up create an image, set the; <b>Name<\/b>, e.g. &#8220;lightmap&#8221;; <b>Width<\/b> and <b>Height<\/b>, e.g. Width 2048, Height 2048; and <b>Generated Type<\/b> e.g. <b>Blank<\/b>, <b>UV Grid<\/b> or <b>Color Grid<\/b>.<\/p>\n<blockquote><p><b>Design note<\/b>: the image added here is temporary and only serves as the substrate to which lightmap data is rendered. Size may vary depending on where the image is to be used so some width and height limitations may apply. Similarly, larger images will take longer to render lightmaps to (also relative to <a href=\"#lightmap-uv-map\">UV complexity<\/a>).<\/p><\/blockquote>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-image-texture.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"width: 100%; height: auto;\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-image-texture.jpg\" alt=\"Adding an Image Texture node\" width=\"900px\" height=\"500px\" border=\"0\" \/><\/a><br \/>\n<i>Materials to be baked [6] need an additional Image Texture [7] and Image [8] association as this is what the rendered bakes lightmap data to.<\/i><\/p>\n<p>Next, as lightmaps should be set up to use a dedicated UV map channel, Blender needs to be able to distinguish between the standard images associated with the material as seen on the mesh, and the lightmap. To facilitate this two <b>UV Map<\/b> nodes need to be included and linked to other nodes appropriately. To do this click <b>Add<\/b>, then in <b>Input<\/b> select <b>UV Map<\/b> [9] &#8211; <b><i>Add \u00bb Input \u00bb UV Map<\/i><\/b>. A UV Map node will appear. Click to drop into the editor [10].<\/p>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmap-uv-map-node.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"width: 100%; height: auto;\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmap-uv-map-node.jpg\" alt=\"Adding a UV Map material node\" width=\"900px\" height=\"500px\" border=\"0\" \/><\/a><br \/>\n<i>To ensure lightmaps remain separate elements of existing materials they need the own <b>UV Map<\/b> nodes. From the Add menu select the <b>UV Map<\/b> entry from the <b>Input<\/b> options [9]. Repeat so two nodes are available [10] for linking.<\/i><\/p>\n<p>Repeat or select the new node and copy\/paste a duplicate into the editor. There should be two UV Map nodes. Link the <b>UV<\/b> output from one of the UV Map nodes to the <b>Vector<\/b> input of each <b>Image Texture<\/b> associated with the standard <b>Principle BSDF<\/b> or other base material, then click the <b>UV coordinates to be used for mapping<\/b> input field and select the existing map from the list (typically <b>UVMap<\/b>) [11]. Link the second node to the lightmap Image Texture; UV output to Vector input [12]. Leave the UV map blank for now. Selecting the lightmap Image node [13] should then display the generated image created earlier [14].<\/p>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-material-tree.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"width: 100%; height: auto;\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-material-tree.jpg\" alt=\"Setting up UV Maps nodes\" width=\"900px\" height=\"500px\" border=\"0\" \/><\/a><br \/>\n<i>Blender needs to distinguish between UV maps so UV Map nodes are added and linked to the Image Texture nodes of the base material [11] and the lightmap section [12].<\/i><\/p>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-material-setup.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"width: 100%; height: auto;\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-material-setup.jpg\" alt=\"Lightmap material segment\" width=\"900px\" height=\"500px\" border=\"0\" \/><\/a><br \/>\n<i>One the material nodes are set up, selecting the lightmaps Image Texture node [13] will display the generated image [14] ready for the bake process.<\/i><\/p>\n<p>Finally, where objects have several materials assigned, each needs to reference the same image and UV data. For example, if &#8216;trim&#8217; was set up as described above, the additional nodes should be duplicated to &#8216;brick&#8217; so it too has an extra Image Texture referencing the same generated &#8216;lightmap&#8217; Image. Similarly for the UV Map nodes. To do this select each unmodified material in-turn and rebuild the additional nodes as described or copy\/paste the lightmaps Image Texture node and the two UV Map nodes &#8211; shift + click select the nodes then use <span class=\"shortcutkey\">Ctrl<\/span> + <span class=\"shortcutkey\">C<\/span> to copy, <span class=\"shortcutkey\">Ctrl<\/span> + <span class=\"shortcutkey\">V<\/span> to paste into the node editor as each unadjusted material in selected. Link the nodes as described above, <b>UV<\/b> outputs to <b>Vector<\/b> inputs.<\/p>\n<blockquote><p><b>Design note<\/b>: to wrangle several materials more easily, in <b>Shading Workspace<\/b> mouse over the <b>Node Editor<\/b> (bottom half) and press <span class=\"shortcutkey\">Ctrl<\/span> + <span class=\"shortcutkey\">Spacebar<\/span> to toggle the editor full screen (<i>Ctrl + Space again returns to previous layout<\/i>). Individual Materials can then be edited after selection from the <b>Browse Material to be linked<\/b> list [i], which displays all materials available in project, or from the <b>Active Material Index<\/b> list [ii], which shows materials assigned to active (selected) object in the 3D Viewport. Once a Material is selected the <b>Node<\/b> menu provides a number of options for basic node editing, including copy and paste &#8211; <span class=\"shortcutkey\">Ctrl<\/span> + <span class=\"shortcutkey\">C<\/span> and <span class=\"shortcutkey\">Ctrl<\/span> + <span class=\"shortcutkey\">V<\/span> [iii] &#8211; select the nodes to be copied, copy, switch materials and then paste.<\/p>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-node-editor.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"width: 98.5%; height: auto;\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-node-editor.jpg\" alt=\"Material editing in Node Editor\" width=\"900px\" height=\"500px\" border=\"0\" \/><\/a><br \/>\n<i>Using the Node Editor to wrangle multiple materials but selecting them using the <b>Browse Material to be linked<\/b> [i] list or the <b>Active Material Index<\/b> [ii] where nodes can be copied between trees [iii].<\/i><\/p><\/blockquote>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-multiple-materials.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"width: 100%; height: auto;\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-multiple-materials.jpg\" alt=\"Multiple materials set up\" width=\"900px\" height=\"500px\" border=\"0\" \/><\/a><br \/>\n<i>If the objects to be baked are assigned more than one material they all need to be prepped in the same way to include a separate Image Texture node and two UV Map nodes, each linked to their respective material sub-tree. Shown above for example two materials, &#8216;trim&#8217; and &#8216;brick&#8217; assigned to the same object, include identical lightmap node set-up and linkage.<\/i><\/p>\n<h3><span class=\"ez-toc-section\" id=\"lightmap-uv-map\"><\/span>Lightmap UV Map<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>For Bake to work correctly when rendering lightmaps, objects included in the process need an additional UV Map channel to accommodate the way UVs have to be unwrapped for lightmapping, in essence each face is mapped as a separate UV element rather than part of a larger &#8216;island&#8217; or group of UVs as would normally done. This can be done several ways; adding another <b>UV Maps<\/b> channel in <b>Object Data Properties<\/b> and then unwrapping the mesh while that&#8217;s active, or having the lightmap UV channel added during the UV Unwrapping process using the <b>New UV Map<\/b> checkbox.<\/p>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-uv-types.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"width: 100%; height: auto;\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-uv-types.jpg\" alt=\"Standard vs Lightmaps UVs\" width=\"900px\" height=\"500px\" border=\"0\" \/><\/a><br \/>\n<i>Generally speaking the UVs needed for lightmaps are organised in ways that don&#8217;t make necessarily sense under normal circumstances. On the left is a typical (but simple) UV map and layout that represents how the object is textured and seen in use, whereas on the right is a &#8216;lightmap&#8217; UV layout that breaks UVs into individual units so the can be laid out more effectively to use as much Texture Space as is available.<\/i><\/p>\n<h3><span class=\"ez-toc-section\" id=\"single-object-lightmap-uv\"><\/span>Single Object Lightmap UV<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>UV unwrapping a single object for lightmap baking is relatively straightforward, with object selected, in <b>Object Data Properties<\/b> [15] click the <b>UV Maps<\/b> heading to access the sub-sections options then click the <b>+<\/b> button [16] to the right of the <b>Active UV Map Index<\/b> aperture. A new entry, <b>UVMap.001<\/b>, appears, double-click this and type &#8220;<b><i>lightmap<\/i><\/b>&#8221; or similar identifier to rename for clarity. To the right of the new listing click the camera icon [17] to make this channel the active UV map.<\/p>\n<blockquote><p><b>Design note<\/b>: this initial step can be done wherever the <b>Object Data Properties<\/b> and <b>UV Maps<\/b> data is accessible, typically <b>Layout<\/b> (default UI), <b>UV Editing<\/b> or other Workspace, editor or area.<\/p><\/blockquote>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-uvmap-channel.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"width: 100%; height: auto;\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-uvmap-channel.jpg\" alt=\"Adding an extra UV Map\" width=\"900px\" height=\"500px\" border=\"0\" \/><\/a><br \/>\n<i>Before lightmapping an object it needs a dedicated UV Map channel. In <b>Object Data Properties<\/b> [15] this can be done in <b>UV Maps<\/b>; click <b>+<\/b> to add [16] then rename and enable clicking the camera icon [17] making this new entry the active UV map.<\/i><\/p>\n<p>Once the channel is available, ensure the entire mesh is selected in Edit Mode then from the <b>UV<\/b> menu in either <b>Layout<\/b> or <b>UV Editing<\/b> Workspace, click <b>Unwrap<\/b>, then <b>Lightmap Pack<\/b> [18] &#8211; <b><i>UV \u00bb Unwrap \u00bb Lightmap Pack<\/i><\/b>. In the <b>Lightmap Pack<\/b> [19] overlay popup that appears set <b>Image Size<\/b>, <b>Pack Quality<\/b> and <b>Margin<\/b>, based on the size of the image set, for example <i>1024<\/i>, <i>1<\/i> and <i>0.16<\/i>. Click <b>OK<\/b> to unwrap the mesh generating the lightmap UVs [20], then finally assign the previously created lightmap image using the <b>Browse Image to be linked<\/b> dropdown [21].<\/p>\n<blockquote><p><b>Design note<\/b>: when setting Lightmap Pack properties; <b>Image Size<\/b> sets the overall dimensions of the map, 2048 for example defines both width and height and so on; <b>Pack Quality<\/b> changes the dimensions and distribution of individual UVs within the square bounds set by Image Size, set to &#8220;1&#8221; UVs typically retain their original dimensions, &#8220;48&#8221; and squarer UVs will be forced square dimensionally to fit; Margin increases or decreases the distance between individual UVs &#8211; higher values may be needed for clearance on smaller images to allow for pixel bleed and anti-aliasing.<\/p>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-pack-quality.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"width: 98.5%; height: auto;\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-pack-quality.jpg\" alt=\"Forcing square UVs\" width=\"900px\" height=\"500px\" border=\"0\" \/><\/a><br \/>\n<i>Pack Quality changes the UVs so larger elements are more uniformly square and better able to fit within the bounds of the available texture that&#8217;s mapped to the UV layout &#8211; image-left, UVs reflect their original shape more or less, image-right, UVs are reshaped for a better fit.<\/i><\/p><\/blockquote>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-unwrap-lightmap-pack.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"width: 100%; height: auto;\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-unwrap-lightmap-pack.jpg\" alt=\"Unwrap UVs using Lightmap Pack\" width=\"900px\" height=\"500px\" border=\"0\" \/><\/a><br \/>\n<i>Once the UV Map is available and selected as the active object in Object Data Properties the mesh can be unwrapped from the <b>UV<\/b> menu using <b>Lightmap Pack<\/b> [18] where <b>Image Size<\/b>, <b>Pack Quality<\/b> and <b>Margin<\/b> [19] can be set based on how large the lightmap UV layout should be&#8230;<\/i><\/p>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-unwrap-uvs.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"width: 100%; height: auto;\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-unwrap-uvs.jpg\" alt=\"Assigning Lightmap image\" width=\"900px\" height=\"500px\" border=\"0\" \/><\/a><br \/>\n<i>&#8230; click OK in to finish Lightmap Pack and generate the UVs relative to the settings used [20], then assign the image previously created using Browse Image to be linked [21] (the image won&#8217;t appear on the mesh in the 3D Viewport as it&#8217;s not linked to the materials Base Color input).<\/i><\/p>\n<h3><span class=\"ez-toc-section\" id=\"single-object-lightmap-bake\"><\/span>Single Object Lightmap Bake<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Before Bake can proceed switch back to <b>Shading<\/b> Workspace. Here, in the <b>UV Map<\/b> node previously linked to the lightmap&#8217;s <b>Image Texture<\/b> node, set &#8220;lightmap&#8221;, the newly created UVMap data, as the <b>UV coordinates to be used for mapping<\/b> [22], then select the lightmaps Image Texture node [23] to ensure the resulting image is baked using the correct UV map and image data. Repeat for each material assigned to the object being baked.<\/p>\n<blockquote style=\"background-color: #fc0; color: #000;\"><p><b>Important<\/b>: this step <b>MUST<\/b> be done for all materials assigned to the object being baked to ensure the correct image is used and to avoid the <a href=\"https:\/\/www.katsbits.com\/codex\/texture-bake\/#bake-standard\">circular dependency error (see yellow boxout here)<\/a>.<\/p><\/blockquote>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-uv-coordinates.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"width: 100%; height: auto;\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-uv-coordinates.jpg\" alt=\"Setting the UV coordinates for Bake\" width=\"900px\" height=\"500px\" border=\"0\" \/><\/a><br \/>\n<i>Before Bake can proceed the Material needs to be tweaked so the new UVMap datablock is associated with the lightmaps Image Texture node. In Shading Workspace set the <b>UV coordinates to be used for mapping<\/b> to reference the new UV.<\/i><\/p>\n<p>To then bake the lightmap, in <b>Render Properties<\/b> [24] switch the <b>Render Engine<\/b> to <b>Cycles<\/b> [25] to gain access to <b>Bake<\/b> [26] settings towards the bottom of the area. Here, set the <b>Bake Type<\/b> to <b>Shadow<\/b> [27] then click the <b>Bake<\/b> button [28]. Blender will render the object relative to the scenes lighting, baking the data as an image visible in UV Editing Workspace.<\/p>\n<blockquote style=\"background-color: #fc0; color: #000;\"><p><b>Important<\/b>: so long as Materials are correctly set up the final baked image <i>should not appear<\/i> on the mesh. If it does the material likely hasn&#8217;t been properly structured for baking lightmaps or the lightmaps Image Texture node is connected to the main material tree.<\/p>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-material-misconfiguration.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"width: 98.5%; height: auto;\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-material-misconfiguration.jpg\" alt=\"Material misconfiguration\" width=\"900px\" height=\"500px\" border=\"0\" \/><\/a><br \/>\n<i>If materials are not configured correctly the resulting baked image will appear on the mesh &#8211; image-left: final lightmap, image-right: mapping or image assignment issue displays lightmap on mesh.<\/i><\/p><\/blockquote>\n<blockquote><p><b>Design note<\/b>: the 3D Viewport itself does not need to in Rendered display mode for Bake to process the scene, simply ensure the objects to be baked, and those influencing the process, are active [iv] for rendering in the Outliner else they can be disabled [v] and essentially hidden from the process while still being visible.<\/p>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-outliner-active.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"width: 98.5%; height: auto;\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-outliner-active.jpg\" alt=\"Render available objects in Outliner\" width=\"900px\" height=\"500px\" border=\"0\" \/><\/a><br \/>\n<i>Depending on the objects placement in a scene it can be set as the only item to be available for rendering [iv] by clicking the <b>Disable to Renders<\/b> camera icon in the <b>Outliner<\/b> [v] as this hides disabled objects from being rendered and\/or influencing the scene, objects within or lighting.<\/i><\/p><\/blockquote>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-cycles.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"width: 100%; height: auto;\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-cycles.jpg\" alt=\"Switching Render Engine to Cycles\" width=\"900px\" height=\"500px\" border=\"0\" \/><\/a><br \/>\n<i>Bake is not available to Eevee so in <b>Render Properties<\/b> [24] the <b>Render Engine<\/b> needs to be switched to <b>Cycles<\/b> [25] to gain access to Bake and its tools and options.<\/i><\/p>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-bake-shadow.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"width: 100%; height: auto;\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-bake-shadow.jpg\" alt=\"Baking a Shadow map\" width=\"900px\" height=\"500px\" border=\"0\" \/><\/a><br \/>\n<i>In Bake options [26], for a simple lightmap, set the Bake Types to Shadow [27] and click the Bake button [28]. Blender will then process the scene and generate the greyscale lightmap image &#8211; image-left (note the corrected UV map displayed on the mesh after checking the setup of each material assigned to the object).<\/i><\/p>\n<h3><span class=\"ez-toc-section\" id=\"save-use-lightmap\"><\/span>Save &#038; Use Lightmap<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Once baked the lightmap can be saved externally from any Workspace, editor or area about to display it directly, typically <b>UV Editing<\/b> Workspace. Here, from the <b>Image<\/b> menu [29], click <b>Save<\/b>, <b>Save As&#8230;<\/b> or <b>Save a Copy&#8230;<\/b> as required &#8211; <b><i>Image* \u00bb Save As&#8230;<\/i><\/b>. In the <b>Blender File View<\/b> (file browser) instance that opens , browse to save location, set the filename and select the <b>File Format<\/b> [30], preferably lossless e.g. <b>BMP<\/b>, <b>Targa Raw<\/b>, <b>TIFF<\/b>, then finally on the <b>Save <i>[option]<\/i><\/b> button.<\/p>\n<blockquote><p><b>Design note<\/b>: where image data needs to be saved the <b>Image<\/b> menu label is appended an asterix (star), i.e. <b>*<\/b>, to become <b>Image*<\/b>.<\/p><\/blockquote>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-save-image.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"width: 100%; height: auto;\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-save-image.jpg\" alt=\"Saving the lightmap image\" width=\"900px\" height=\"500px\" border=\"0\" \/><\/a><br \/>\n<i>Once the lightmap is baked it can be saved using UV Editing Workspace. Click <b>Image*<\/b> [29] then the preferable option, <b>Save<\/b>, <b>Save As&#8230;<\/b> or <b>Save a Copy&#8230;<\/b>. In the file browser set the <b>File Format<\/b> [30] the image will be saved to.<\/i><\/p>\n<p>Depending on the save option used the temporary generated image data will be &#8216;made real&#8217; such that the Image Texture node set up to facilitate baking the lightmap now references an external image asset that can be previewed in-situ. A simple way to do this is to switch back to <b>Shading<\/b> Workspace and link the <b>Color<\/b> output [31] of the <i>lightmaps Image Texture<\/i> node to <b>Base Color<\/b> input [32] of <i>Principled BSDF<\/i>. This uses the lightmap as the Materials diffuse and makes it visible on the mesh in the 3D Viewport [33].<\/p>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-simple-preview.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"width: 100%; height: auto;\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-simple-preview.jpg\" alt=\"Simple lightmap preview\" width=\"900px\" height=\"500px\" border=\"0\" \/><\/a><br \/>\n<i>A simple way to preview the lightmap after saving is to link the Image Texture node output [31] to the input or Principled BSDF [32], which will then display the image on the mesh in the 3D Viewport<\/i><\/p>\n<p>A more complex and representative way to view the lightmap is to modify the material so the lightmap is essentially mixed with the Materials underlaying diffuse (Base Color) images. To do this, in <b>Shading<\/b> Workspace, from the <b>Add<\/b> menu select <b>Color<\/b> then <b>MixRGB<\/b> [34] &#8211; <b><i>Add \u00bb Color \u00bb MixRGB<\/i><\/b>. This drops a new <b>Mix<\/b> node into the editor [35]. With this in place link the <b>Color<\/b> output of the <i>lightmap Image Texture<\/i> to <b>Color1<\/b> input of MixRGB, and <b>Color<\/b> output of the <i>diffuse Image Texture<\/i> node to <b>Color2<\/b> of this same MixRGB node [36]. In other words, both the available Image Texture nodes, for the lightmap and existing diffuse image, should be connected to the MixRGB node.<\/p>\n<blockquote><p><b>Design note<\/b>: there are other ways to do this depending on the complexity of the Material, direct linking between the two node types being the most straightforward.<\/p><\/blockquote>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-mixrgb.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"width: 100%; height: auto;\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-mixrgb.jpg\" alt=\"MixRGB node\" width=\"900px\" height=\"500px\" border=\"0\" \/><\/a><br \/>\n<i>Adding [34] a MixRGB node [35] to the material so the baked lightmap can be better displayed on the mesh as it might be in-game.<\/i><\/p>\n<p>Next link <b>Color<\/b> output of <b>MixRGB<\/b> to <b>Base Color<\/b> input of <b>Principled BSDF<\/b> [37]; if the Material was previously displaying an image in the 3D Viewport the two sources will be mixed and rendered on the mesh. However, the default &#8216;mix mode&#8217; might not render correctly, which can be addressed using the <b>Blending Mode<\/b> [38] drop-down to select a suitable type of blending, e.g. <b>Overlay<\/b> or <b>Multiply<\/b>. Finally adjust the <b>Fac<\/b> or blend so the lightmap mixes properly with the diffuse image. Repeat these steps for all materials included during the bake operation.<\/p>\n<blockquote><p><b>Design note<\/b>: the &#8216;mix mode&#8217; used may yield different results depending on the colours captured in the lightmap.<\/p><\/blockquote>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-mixrgb-node-links.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"width: 100%; height: auto;\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-mixrgb-node-links.jpg\" alt=\"Linking Image Texture node to MixRGB\" width=\"900px\" height=\"500px\" border=\"0\" \/><\/a><br \/>\n<i>Link the Image Texture nodes to MixRGB using the <b>Color<\/b> outputs from each image to the <b>Color1<\/b> &#038; <b>Color2<\/b> inputs of MixRGB [36], then link MixRGB to Principled BSDF [37], Color output to Base Color input.<\/i><\/p>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-mixrgb-material-tree.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"width: 100%; height: auto;\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-mixrgb-material-tree.jpg\" alt=\"Full MixRGB material tree\" width=\"900px\" height=\"500px\" border=\"0\" \/><\/a><br \/>\n<i>Full material tree showing links and connections between the Image Texture nodes and MixRGB, and MixRGB to Principled BSDF.<\/i><\/p>\n<h3><span class=\"ez-toc-section\" id=\"bake-colour-tinted-lightmaps\"><\/span>Bake Colour Tinted Lightmaps<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Using <b>Shadow<\/b> as the Bake Type to render lightmaps only captures object illumination in terms of a black and white or greyscale tonal palette. To capture colour <b>Bake Type<\/b> should be changed to <b>Diffuse<\/b> as this provides the options to capture light as it appears in a scene. To do this, in <b>Render Properties<\/b> access <b>Bake<\/b> and set <b>Diffuse<\/b> [39] as the <b>Bake Type<\/b> by selecting that option from the list. Expand the <b>Influence<\/b> subsection and for <b>Contributions<\/b> make sure <b>Direct<\/b> and <b>Indirect<\/b> options are set. Disable <b>Color<\/b> [40] and then click the <b>Bake<\/b> button.<\/p>\n<blockquote style=\"background-color: #fc0; color: #000;\"><p><b>Important<\/b>: if <b>Color<\/b> [vi] is enabled the diffuse image associated with each material will be baked along with lighting. This will also include other active material effects like <i>Specular<\/i> and <i>Normal<\/i> [vii], which essentially bakes their effect on the scene into the lightmap image. To negate this influence disconnect the main material nodes, i.e. Specular, Normal etc., from Principled BSDF [viii] while making sure the lightmaps Image Texture node remain selected [ix]. Meshes will display white in the 3D Viewport confirming the change.<\/p>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-diffuse-color.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"width: 98.5%; height: auto;\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-diffuse-color.jpg\" alt=\"Diffuse \" width=\"900px\" height=\"500px\" border=\"0\" \/><\/a><br \/>\n<i>Including Color [vi] in a <b>Diffuse<\/b> bake will render other images [vii] and active image effects like Specular and Normal.<\/i><\/p>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-node-disconnect.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"width: 98.5%; height: auto;\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-node-disconnect.jpg\" alt=\"Disconnecting material nodes\" width=\"900px\" height=\"500px\" border=\"0\" \/><\/a><br \/>\n<a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-node-disconnection.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"width: 98.5%; height: auto;\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-node-disconnection.jpg\" alt=\"Material node tree disconnections\" width=\"900px\" height=\"500px\" border=\"0\" \/><\/a><br \/>\n<i>To disable the influence of other material effects they need to be disconnected from Principled BSDF [viii]. Ensure the lightmaps Image Texture [ix] node remains active selected for baking.<\/i>\n<\/p><\/blockquote>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-diffuse-no-color.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"width: 100%; height: auto;\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-diffuse-no-color.jpg\" alt=\"Lightmap baked with colour\" width=\"900px\" height=\"500px\" border=\"0\" \/><\/a><br \/>\n<a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-mixrgb-color.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"width: 100%; height: auto;\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-mixrgb-color.jpg\" alt=\"Baked color lightmap\" width=\"900px\" height=\"500px\" border=\"0\" \/><\/a><br \/>\n<i>Setting <b>Diffuse<\/b> as the <b>Bake Type<\/b>, [39] and disabling <b>Color<\/b> [40], the resulting render is colour tinted relative to the scenes lighting and general illumination (note the lightmap is correctly applied only to the single object baked but does appears on other objects carrying the same Material assignments). Image-bottom: <a href=\"#save-use-lightmap\">colour tinted lightmap connected using MixRGB<\/a> to the material for proper preview in Blender.<\/i><\/p>\n<h3><span class=\"ez-toc-section\" id=\"multiple-object-lightmap-uv\"><\/span>Multiple Object Lightmap UV<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Ordinarily it would be necessary to <a href=\"https:\/\/www.katsbits.com\/codex\/join-meshes\/\">Join<\/a> objects together into a larger mesh for baking but with <a href=\"https:\/\/www.katsbits.com\/codex\/multi-object-editing\/\">multi-object editing<\/a> several can be <i>UV Unwrapped<\/i> and <i>UV Mapped<\/i> for lightmap baking at the same time. To do this first make sure all objects within the larger group are set up so their respective Materials [41] have the extra <a href=\"#lightmap-material-setup\"><b>UV Map<\/b> and <b>Image Texture<\/b> nodes [42] as outlined above<\/a>, and that each has an <a href=\"#lightmap-uv-map\">additional <b>UV Map<\/b> channel<\/a>, all set as the active map, and referencing the same UV map, i.e. &#8220;lightmap&#8221;, in <b>Object Data Properties<\/b>.<\/p>\n<blockquote><p><b>Design note<\/b>: for a clean lightmap decouple other material effects like Normal, Specular etc., so they don&#8217;t unduly influence the result. This should leave objects displayed white (textureless) in the 3D Viewport.<\/p>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-group-textureless.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"width: 98.5%; height: auto;\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-group-textureless.jpg\" alt=\"Disconnected other Material effects\" width=\"900px\" height=\"500px\" border=\"0\" \/><\/a><br \/>\n<i>A groups of objects ready for lightmap baking with Materials disconnected so other texture effects don&#8217;t influence the bake and get fixed in place (rendered to image). Objects appear white in the 3D Viewport when doing this.<\/i><\/p><\/blockquote>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-group-materials.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"width: 100%; height: auto;\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-group-materials.jpg\" alt=\"All objects should be set up the same way\" width=\"900px\" height=\"500px\" border=\"0\" \/><\/a><br \/>\n<i>Object that are part of a larger group to be baked must be set up the same way; Materials [41] should include extra <b>UV Map<\/b> and <b>Image Texture<\/b> nodes [42] referencing the same <b>UV Map<\/b> data and image to be used during the Bake process.<\/i><\/p>\n<p>Once all the objects to be baked are prepped, make sure the secondary UV Map channel added to each is set as the active element then in <b>UV Editing<\/b> Workspace select all the UVs and <b>Unwrap<\/b> using <b>Lightmap Pack<\/b> [43] &#8211; <b><i>UV \u00bb Unwrap \u00bb Lightmap Pack<\/i><\/b>. Set <b>Image Size<\/b> to be the same as that mapped to the each objects material <b>Pack Quality<\/b> and <b>Margin<\/b> [44], e.g. <i>2048<\/i>, <i>8<\/i>, <i>0.10<\/i>. Click <b>OK<\/b>. Blender will unwrap\/remap the UVs [45] based on the settings, ready for lightmap baking.<\/p>\n<blockquote><p><b>Design note<\/b>: double-check pinned [x] or otherwise restricted or limited UVs. These should be cleared or reset (<span class=\"shortcutkey\">Alt<\/span> + <span class=\"shortcutkey\">P<\/span> to Unpin).<\/p>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-group-pinned-uvs.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"width: 98.5%; height: auto;\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-group-pinned-uvs.jpg\" alt=\"Clear Pinned UVs\" width=\"900px\" height=\"500px\" border=\"0\" \/><\/a><br \/>\n<i>Unpin [x] or clear UVs that are otherwise locked in place.<\/i><\/p><\/blockquote>\n<blockquote style=\"background-color: #fc0; color: #000;\"><p><b>Important<\/b>: UVs are unwrapped, mapped and organised based on dimensional similarity rather than belonging to the same object so individual UVs may be dispersed across the lightmap instead of being collated together.<\/p>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-group-similarity.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"width: 98.5%; height: auto;\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-group-similarity.jpg\" alt=\"UV grouping\" width=\"900px\" height=\"500px\" border=\"0\" \/><\/a><br \/>\n<i>When unwrapping a group of individual objects UVs will be organised based on similarity of shape not what object they belong to.<\/i><\/p><\/blockquote>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-group-unwrap.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"width: 100%; height: auto;\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-group-unwrap.jpg\" alt=\"Use Lightmap Pack\" width=\"900px\" height=\"500px\" border=\"0\" \/><\/a><br \/>\n<i>Make sure all the objects to be included Bake are selected then Unwrap using <b>Lightmap Pack<\/b> [43]. Set <b>Image Size<\/b> to match the that linked to the materials (and optionally set Pack Quality and Margin) [44], then <b>OK<\/b>.<\/i><\/p>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-group-unwrapped.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"width: 100%; height: auto;\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-group-unwrapped.jpg\" alt=\"Unwrapping\/remapping UVs\" width=\"900px\" height=\"500px\" border=\"0\" \/><\/a><br \/>\n<i>Once the lightmap UV properties are set Blender will unwrap the collection of objects as though a single larger object to the same image [45], UVs dispersed relative to similarity rather than parent status.<\/i><\/p>\n<h3><span class=\"ez-toc-section\" id=\"multiple-object-lightmap-bake\"><\/span>Multiple Object Lightmap Bake<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>As with single object baking so too for multiple objects; in <b>Shading<\/b> Workspace make sure the lightmap <b>Image Texture<\/b> node is set as the active node within each material, and that they all reference the same image, e.g. &#8220;lightmap&#8221;. Switch to <b>Render Properties<\/b> [46] and, make sure <b>Cycles<\/b> is the active <b>Render Engine<\/b> then in <b>Bake<\/b> properties set the <b>Bake Type<\/b> [47] to either <b>Shadow<\/b> for black and white bakes, or <b>Diffuse<\/b> for colour tinted renders (disable Color), and click <b>Bake<\/b>. Blender will parse the scene or selected objects producing the lightmap based on the rendered options set. Once done, in the <b>UV Editor<\/b> click <b>Image*<\/b> then <b>Save<\/b>, <b>Save As&#8230;<\/b>, or <b>Save a Copy&#8230;<\/b> &#8211; <b><i>Image \u00bb [save option]<\/i><\/b>. In the file browser set the name, location and <b>File Format<\/b> [49] then click the <b>Save<\/b> button.<\/p>\n<blockquote style=\"background-color: #fc0; color: #000;\"><p><b>Important<\/b>: some experimentation may be necessary to achieve a useful lightmap due to the way various settings interact between Lightmap Pack and Bake. For example, setting Lightmap Pack options to 2048, 8, 0.10 during UV unwrapping may result in an image that has excessive colour bleed between UVs\/areas that is not expressly fixed (re)adjusting those initial settings. In this situation it may better to alter the default <b>Margin<\/b> [xiii] in <b>Bake<\/b> settings, typically lower, to alleviate the degree to which Bake overflows across UVs as it bakes.<\/p>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-group-bleed.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"width: 100%; height: auto;\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-group-bleed.jpg\" alt=\"Texture bleed after Bake\" width=\"900px\" height=\"500px\" border=\"0\" \/><\/a><br \/>\n<a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-group-margin.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"width: 100%; height: auto;\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-group-margin.jpg\" alt=\"Margin adjusts bleed threshold\" width=\"900px\" height=\"500px\" border=\"0\" \/><\/a><br \/>\n<i>Image-top: the default settings established during Lightmap Pack may cause colour bleed between UVs due ostensibly to a relatively high <b>Margin<\/b> [xiii] threshold. Image-bottom: lowering this value helps mitigate disparities, resulting in clean(er) lightmaps.<\/i><\/p><\/blockquote>\n<blockquote><p><b>Design note<\/b>: the time taken to bake a group of objects varies depending on the number of objects being processed and their structural complexity or density.<\/p><\/blockquote>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-group-bake.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"width: 100%; height: auto;\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-group-bake.jpg\" alt=\"Group lightmap bake\" width=\"900px\" height=\"500px\" border=\"0\" \/><\/a><br \/>\n<i>To render the lightmap for multiple objects ensure they are all selected in the 3D Viewport then in <b>Render Properties<\/b> [46] set the <b>Bake Type<\/b> [47] (disable Color when using Diffuse [48]) and click <b>Bake<\/b>. Blender will parse the scene and render the data to the image associated with the Materials lightmap image node.<\/i><\/p>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-group-save.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"width: 100%; height: auto;\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-group-save.jpg\" alt=\"Save group object image bake\" width=\"900px\" height=\"500px\" border=\"0\" \/><\/a><br \/>\n<i>Once Bake is complete the resulting lightmap image can be saved. Click <b>Image*<\/b> then a save option. In the file browser that appears set the name, location and importantly the format saved to [49], this should be lossless &#8211; Targa Raw, Tiff, BMP etc.<\/i><\/p>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-group-final.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"width: 100%; height: auto;\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-group-final.jpg\" alt=\"Final colour-tinted lightmap\" width=\"900px\" height=\"500px\" border=\"0\" \/><\/a><br \/>\n<i>Image-left: the final lightmap colour-tinted from a Diffuse bake shown on a group of objects each using their own respective part of the lightmap. Image-right: once saved image then replaces the temporary render data and can be referenced and mixed using a <a href=\"#save-use-lightmap\">MixRGB<\/a> node for proper preview in the 3D Viewport (additional material effects also re-enabled).<\/i><\/p>\n<h3><span class=\"ez-toc-section\" id=\"lightmap-optimisation\"><\/span>Lightmap Optimisation<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Optimising lightmaps depends heavily on what&#8217;s being baked and where those objects and any lightmaps are to be used. With that said, if a number or series of complex objects are being baked, it might be possible to organise lightmaps in various ways to reduce the likelihood of captured aberrations &#8211; texture bleed, pixilation etc. &#8211; and\/or excess resource usage, for example lightmap bakes can be separated into individual images based upon;<\/p>\n<ul>\n<li><i>material assignment<\/i> &#8211; surfaces assigned the same material baked to the same map<\/li>\n<li><i>mesh complexity<\/i> &#8211; complex parts on one map, less complex on another<\/li>\n<li><i>element size<\/i> &#8211; small parts on one (smaller) map, larger on another<\/li>\n<li><i>sections<\/i> &#8211; different parts of a larger scene on separate maps<\/li>\n<li><i>light colour<\/i> &#8211; specific colours mapped to individual lightmaps<\/li>\n<li>and so on&#8230;<\/li>\n<\/ul>\n<p>Similarly it might be possible to use lightmaps of differing size, larger UVs mapped to a larger image, smaller UVs to smaller lightmaps; this may also address issues where smaller UVs have a greater pixel density for their size compared to larger UVs.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"exporting-lightmaps\"><\/span>Exporting Lightmaps<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Lightmaps are not exported for external use so much as they are <a href=\"#save-use-lightmap\">simply saved after baking<\/a> from within the <b>UV Editor<\/b> (UV Editing Workspace) or other area that can access the <b>Image<\/b> menu options. Similarly models should be exported to a third-party supported mesh format, typically *.FBX or *.DAE (Collada), that also accommodates multiple UV map channels or layers. In this context objects may be subject to general engine-specific limitations on image size\/dimensions, naming conventions and so on.<\/p>\n<blockquote><p><b>Design note<\/b>: generally speaking game development suites dissuade use of externally generated lightmaps preferentially favouring those generated internally by their own systems, <a href=\"https:\/\/docs.unity3d.com\/Manual\/Lightmapping.html\">Unity 3D<\/a>, <a href=\"https:\/\/docs.unrealengine.com\/5.0\/en-US\/generating-lightmap-uvs-in-unreal-engine\/\">Unreal Engine<\/a> and <a href=\"https:\/\/docs.godotengine.org\/en\/stable\/tutorials\/3d\/baked_lightmaps.html\">Godot<\/a> for example provide their own optimised lightmapping tools.<\/p><\/blockquote>\n<p><a href=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-godot-tools.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" style=\"width: 100%; height: auto;\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/bake\/lightmaps-godot-tools.jpg\" alt=\"Godot lightmapping tools\" width=\"900px\" height=\"500px\" border=\"0\" \/><\/a><br \/>\n<i>Godot, like many game development toolkits, prefers lightmaps be generated internally using their own proprietary tools that cater to the specifics of their editing environments which makes externally generated lightmaps difficult to employ.<\/i><\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":6327,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34,32,230],"tags":[697,905,904,903,775,327,519,741,696,668,655,651,705,734,648],"class_list":["post-6034","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blender","category-texturing","category-tutorials","tag-bake","tag-direct","tag-indirect","tag-lightmaps","tag-lights","tag-node-editor","tag-shading-workspace","tag-shadows","tag-texture-bake","tag-texture-maps","tag-uv-editing","tag-uv-editing-workspace","tag-uv-map-node","tag-uv-mapping","tag-uv-maps"],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/www.katsbits.com\/codex\/wp-json\/wp\/v2\/posts\/6034","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.katsbits.com\/codex\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.katsbits.com\/codex\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.katsbits.com\/codex\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.katsbits.com\/codex\/wp-json\/wp\/v2\/comments?post=6034"}],"version-history":[{"count":101,"href":"https:\/\/www.katsbits.com\/codex\/wp-json\/wp\/v2\/posts\/6034\/revisions"}],"predecessor-version":[{"id":6425,"href":"https:\/\/www.katsbits.com\/codex\/wp-json\/wp\/v2\/posts\/6034\/revisions\/6425"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.katsbits.com\/codex\/wp-json\/wp\/v2\/media\/6327"}],"wp:attachment":[{"href":"https:\/\/www.katsbits.com\/codex\/wp-json\/wp\/v2\/media?parent=6034"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.katsbits.com\/codex\/wp-json\/wp\/v2\/categories?post=6034"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.katsbits.com\/codex\/wp-json\/wp\/v2\/tags?post=6034"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}