{"id":817,"date":"2013-08-11T15:10:07","date_gmt":"2013-08-11T13:10:07","guid":{"rendered":"http:\/\/www.edy.es\/dev\/?page_id=817"},"modified":"2024-02-12T16:16:32","modified_gmt":"2024-02-12T15:16:32","slug":"unity-3d-lightmapping-reference-guide","status":"publish","type":"page","link":"https:\/\/www.edy.es\/dev\/docs\/unity-3d-lightmapping-reference-guide\/","title":{"rendered":"Unity 3D Lightmapping Reference Guide"},"content":{"rendered":"<p>&nbsp;<\/p>\n<table>\n<tbody>\n<tr>\n<td><span style=\"text-decoration: underline; background-color: #ffff99;\">UPDATE<\/span>:\u00a0This document applies to Unity 4. For Unity 5 lighting take a look at the\u00a0<a href=\"https:\/\/www.edy.es\/dev\/docs\/unity-5-lighting-cookbook\/\">Unity 5 Lighting Cookbook<\/a>.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<h4>How can I make dynamic objects to cast realtime shadows on lightmapped (static) objects?<\/h4>\n<ul>\n<li><strong>Forward Rendering<\/strong> (Single Lightmap or Directional Lightmap only):<strong><br class=\"none\" \/><\/strong>Dynamic objects cast realtime shadows on lightmapped objects for<strong> a single directional light<\/strong>\u00a0configured as <strong>Lightmapping = Auto or Realtime-only<\/strong>.<strong><br \/>\n<\/strong><\/li>\n<li><strong>Deferred Lighting:<\/strong>\n<ul>\n<li><em>Single Lightmap or Directional Lightmap<\/em>:<br class=\"none\" \/>Dynamic objects cast realtime shadows on lightmapped objects for the lights configured as <strong>Lightmapping =\u00a0Realtime-only<\/strong>.<\/li>\n<li><em>Dual Lightmaps<\/em>:<br class=\"none\" \/>Full realtime lighting and shadows are applied on all objects below <em>Shadow Distance<\/em> (Quality settings).<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\t\t<style>\n\t\t\t#gallery-1 {\n\t\t\t\tmargin: auto;\n\t\t\t}\n\t\t\t#gallery-1 .gallery-item {\n\t\t\t\tfloat: left;\n\t\t\t\tmargin-top: 10px;\n\t\t\t\ttext-align: center;\n\t\t\t\twidth: 33%;\n\t\t\t}\n\t\t\t#gallery-1 img {\n\t\t\t\tborder: 2px solid #cfcfcf;\n\t\t\t}\n\t\t\t#gallery-1 .gallery-caption {\n\t\t\t\tmargin-left: 0;\n\t\t\t}\n\t\t\t\/* see gallery_shortcode() in wp-includes\/media.php *\/\n\t\t<\/style>\n\t\t<div id='gallery-1' class='gallery galleryid-817 gallery-columns-3 gallery-size-thumbnail'><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Single-Lightmaps-Forward-Auto.png'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Single-Lightmaps-Forward-Auto-150x150.png\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" aria-describedby=\"gallery-1-943\" srcset=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Single-Lightmaps-Forward-Auto-150x150.png 150w, https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Single-Lightmaps-Forward-Auto-36x36.png 36w, https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Single-Lightmaps-Forward-Auto-115x115.png 115w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/a>\n\t\t\t<\/dt>\n\t\t\t\t<dd class='wp-caption-text gallery-caption' id='gallery-1-943'>\n\t\t\t\tForward Rendering + Single Lightmap + Directional light in Auto mode\n\t\t\t\t<\/dd><\/dl><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Single-Lightmaps-Deferred-Auto-+-Realtime.png'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Single-Lightmaps-Deferred-Auto-+-Realtime-150x150.png\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" aria-describedby=\"gallery-1-942\" srcset=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Single-Lightmaps-Deferred-Auto-+-Realtime-150x150.png 150w, https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Single-Lightmaps-Deferred-Auto-+-Realtime-36x36.png 36w, https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Single-Lightmaps-Deferred-Auto-+-Realtime-115x115.png 115w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/a>\n\t\t\t<\/dt>\n\t\t\t\t<dd class='wp-caption-text gallery-caption' id='gallery-1-942'>\n\t\t\t\tDeferred Lighting + Directional light in Auto mode + Point light in Realtime-only mode \n\t\t\t\t<\/dd><\/dl><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Dual-Lightmaps-Near-+-Far.png'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Dual-Lightmaps-Near-+-Far-150x150.png\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" aria-describedby=\"gallery-1-944\" srcset=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Dual-Lightmaps-Near-+-Far-150x150.png 150w, https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Dual-Lightmaps-Near-+-Far-36x36.png 36w, https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Dual-Lightmaps-Near-+-Far-115x115.png 115w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/a>\n\t\t\t<\/dt>\n\t\t\t\t<dd class='wp-caption-text gallery-caption' id='gallery-1-944'>\n\t\t\t\tDeferred Lighting + Dual Ligthtmaps\n\t\t\t\t<\/dd><\/dl><br style=\"clear: both\" \/>\n\t\t<\/div>\n\n<h4>How can I make lightmapped objects to also cast realtime shadows?<\/h4>\n<ul>\n<li><strong>Forward Rendering:<\/strong><br class=\"none\" \/>It&#8217;s not possible to make lightmapped objects to also cast realtime shadows in Forward Rendering.<br class=\"none\" \/>The intermediate solution is to use <strong>Light Probes<\/strong> to adjust the lighting of the dynamic objects in the lightmapped scene.<\/li>\n<li><strong>Deferred Lighting<\/strong>:\n<ul>\n<li><em>Single Lightmap or Directional Lightmap:<br class=\"none\" \/><\/em>&#8211; Lightmapped (static) objects cast realtime shadows on dynamic objects for the lights marked as <strong>Lightmapping =\u00a0Auto<\/strong>.<br class=\"none\" \/>&#8211; All objects cast and receive full realtime shadows for lights configured as <strong>Lightmapping = Realtime-only<\/strong>.<\/li>\n<li><em>Dual Lightmaps:<br class=\"none\" \/><\/em>Full realtime lighting and shadows are applied on all objects below\u00a0<em>Shadow Distance<\/em>\u00a0(Quality settings).<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\t\t<style>\n\t\t\t#gallery-2 {\n\t\t\t\tmargin: auto;\n\t\t\t}\n\t\t\t#gallery-2 .gallery-item {\n\t\t\t\tfloat: left;\n\t\t\t\tmargin-top: 10px;\n\t\t\t\ttext-align: center;\n\t\t\t\twidth: 33%;\n\t\t\t}\n\t\t\t#gallery-2 img {\n\t\t\t\tborder: 2px solid #cfcfcf;\n\t\t\t}\n\t\t\t#gallery-2 .gallery-caption {\n\t\t\t\tmargin-left: 0;\n\t\t\t}\n\t\t\t\/* see gallery_shortcode() in wp-includes\/media.php *\/\n\t\t<\/style>\n\t\t<div id='gallery-2' class='gallery galleryid-817 gallery-columns-3 gallery-size-thumbnail'><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Single-Lightmaps-Deferred-Auto-+-Realtime.png'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Single-Lightmaps-Deferred-Auto-+-Realtime-150x150.png\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" aria-describedby=\"gallery-2-942\" srcset=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Single-Lightmaps-Deferred-Auto-+-Realtime-150x150.png 150w, https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Single-Lightmaps-Deferred-Auto-+-Realtime-36x36.png 36w, https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Single-Lightmaps-Deferred-Auto-+-Realtime-115x115.png 115w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/a>\n\t\t\t<\/dt>\n\t\t\t\t<dd class='wp-caption-text gallery-caption' id='gallery-2-942'>\n\t\t\t\tDeferred Lighting + Directional light in Auto mode + Point light in Realtime-only mode \n\t\t\t\t<\/dd><\/dl><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Dual-Lightmaps-Near-+-Far.png'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Dual-Lightmaps-Near-+-Far-150x150.png\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" aria-describedby=\"gallery-2-944\" srcset=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Dual-Lightmaps-Near-+-Far-150x150.png 150w, https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Dual-Lightmaps-Near-+-Far-36x36.png 36w, https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Dual-Lightmaps-Near-+-Far-115x115.png 115w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/a>\n\t\t\t<\/dt>\n\t\t\t\t<dd class='wp-caption-text gallery-caption' id='gallery-2-944'>\n\t\t\t\tDeferred Lighting + Dual Ligthtmaps\n\t\t\t\t<\/dd><\/dl>\n\t\t\t<br style='clear: both' \/>\n\t\t<\/div>\n\n<h4>How can I make lightmapped objects to cast AND receive realtime shadows from themselves (self-shadow) and from other static and dynamic objects?<\/h4>\n<ul>\n<li><strong>Forward Rendering:<\/strong><br \/>\nIt&#8217;s not possible to make lightmapped objects to also cast realtime shadows in Forward Rendering.<\/li>\n<li><strong>Deferred Lighting<\/strong>:\n<ul>\n<li><em>Single Lightmap or Directional Lightmap:<\/em><br \/>\nAll objects cast and receive full realtime shadows for lights configured as\u00a0<strong>Lightmapping = Realtime-only<\/strong>.<\/li>\n<li><em>Dual Lightmaps:<br \/>\n<\/em>Full realtime lighting and shadows are applied on all objects below\u00a0<em>Shadow Distance<\/em>\u00a0(Quality settings).<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\t\t<style>\n\t\t\t#gallery-3 {\n\t\t\t\tmargin: auto;\n\t\t\t}\n\t\t\t#gallery-3 .gallery-item {\n\t\t\t\tfloat: left;\n\t\t\t\tmargin-top: 10px;\n\t\t\t\ttext-align: center;\n\t\t\t\twidth: 33%;\n\t\t\t}\n\t\t\t#gallery-3 img {\n\t\t\t\tborder: 2px solid #cfcfcf;\n\t\t\t}\n\t\t\t#gallery-3 .gallery-caption {\n\t\t\t\tmargin-left: 0;\n\t\t\t}\n\t\t\t\/* see gallery_shortcode() in wp-includes\/media.php *\/\n\t\t<\/style>\n\t\t<div id='gallery-3' class='gallery galleryid-817 gallery-columns-3 gallery-size-thumbnail'><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Single-Lightmaps-Deferred-Auto-+-Realtime.png'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Single-Lightmaps-Deferred-Auto-+-Realtime-150x150.png\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" aria-describedby=\"gallery-3-942\" srcset=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Single-Lightmaps-Deferred-Auto-+-Realtime-150x150.png 150w, https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Single-Lightmaps-Deferred-Auto-+-Realtime-36x36.png 36w, https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Single-Lightmaps-Deferred-Auto-+-Realtime-115x115.png 115w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/a>\n\t\t\t<\/dt>\n\t\t\t\t<dd class='wp-caption-text gallery-caption' id='gallery-3-942'>\n\t\t\t\tDeferred Lighting + Directional light in Auto mode + Point light in Realtime-only mode \n\t\t\t\t<\/dd><\/dl><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Dual-Lightmaps-Near-+-Far.png'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Dual-Lightmaps-Near-+-Far-150x150.png\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" aria-describedby=\"gallery-3-944\" srcset=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Dual-Lightmaps-Near-+-Far-150x150.png 150w, https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Dual-Lightmaps-Near-+-Far-36x36.png 36w, https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Dual-Lightmaps-Near-+-Far-115x115.png 115w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/a>\n\t\t\t<\/dt>\n\t\t\t\t<dd class='wp-caption-text gallery-caption' id='gallery-3-944'>\n\t\t\t\tDeferred Lighting + Dual Ligthtmaps\n\t\t\t\t<\/dd><\/dl>\n\t\t\t<br style='clear: both' \/>\n\t\t<\/div>\n\n<h4>Can&#8217;t get the realtime shadows I expect<\/h4>\n<p>Ensure you&#8217;re using the correct Rendering Path (Forward Rendering or Deferred Lighting).<\/p>\n<p>If you have changed lightmap-related settings (lightmapping mode, lightmap static, light mode) then re-bake the lightmaps for the scene.<\/p>\n<h4>Shadow intensity is different in the lightmap than in runtime<\/h4>\n<p>The <em>Shadow Strength<\/em> setting in the light objects is a realtime-only setting. Shadows in the lightmap are calculated using the actual illumination: ambient light, sky, indirect lighting (bounces)&#8230;<\/p>\n<p>You must manually adjust Shadow Strength for matching the lightmapped shadows when the scene is casting realtime shadows (i.e. in Dual Lightmaps mode).<\/p>\n<p>&nbsp;<\/p>\n<hr style=\"width: 100%;\" width=\"100%\" \/>\n<h1>Lightmapping in detail<\/h1>\n<p>The Lightmapping effects can be previewed in the Unity 3D editor when the <strong>Lightmapping<\/strong> window is selected. The <strong>Lightmap Display<\/strong> options are revealed then in the Scene view. The option <strong>Lightmapping &gt; Bake &gt; Mode<\/strong>\u00a0configures the type of lightmaps that will be generated with the <strong>Bake<\/strong> button. Also, the Bake button captures the actual <strong>Static<\/strong> flag for each object and the <strong>Lightmapping<\/strong> mode for the lights (changing these later requires a new Bake for the new settings to have effect).<\/p>\n\n\t\t<style>\n\t\t\t#gallery-4 {\n\t\t\t\tmargin: auto;\n\t\t\t}\n\t\t\t#gallery-4 .gallery-item {\n\t\t\t\tfloat: left;\n\t\t\t\tmargin-top: 10px;\n\t\t\t\ttext-align: center;\n\t\t\t\twidth: 25%;\n\t\t\t}\n\t\t\t#gallery-4 img {\n\t\t\t\tborder: 2px solid #cfcfcf;\n\t\t\t}\n\t\t\t#gallery-4 .gallery-caption {\n\t\t\t\tmargin-left: 0;\n\t\t\t}\n\t\t\t\/* see gallery_shortcode() in wp-includes\/media.php *\/\n\t\t<\/style>\n\t\t<div id='gallery-4' class='gallery galleryid-817 gallery-columns-4 gallery-size-thumbnail'><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon portrait'>\n\t\t\t\t<a href='https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Lightmapping-Settings2.png'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Lightmapping-Settings2-e1376739614225-150x150.png\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" aria-describedby=\"gallery-4-921\" \/><\/a>\n\t\t\t<\/dt>\n\t\t\t\t<dd class='wp-caption-text gallery-caption' id='gallery-4-921'>\n\t\t\t\tLightmapping settings\n\t\t\t\t<\/dd><\/dl><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Lightmapping-Settings-Lightmap-Display.png'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Lightmapping-Settings-Lightmap-Display-150x150.png\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" aria-describedby=\"gallery-4-914\" srcset=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Lightmapping-Settings-Lightmap-Display-150x150.png 150w, https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Lightmapping-Settings-Lightmap-Display-36x36.png 36w, https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Lightmapping-Settings-Lightmap-Display-115x115.png 115w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/a>\n\t\t\t<\/dt>\n\t\t\t\t<dd class='wp-caption-text gallery-caption' id='gallery-4-914'>\n\t\t\t\tDisplay options in Scene view\n\t\t\t\t<\/dd><\/dl><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Lightmapping-Settings-Static.png'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Lightmapping-Settings-Static-150x150.png\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" aria-describedby=\"gallery-4-916\" srcset=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Lightmapping-Settings-Static-150x150.png 150w, https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Lightmapping-Settings-Static-36x36.png 36w, https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Lightmapping-Settings-Static-115x115.png 115w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/a>\n\t\t\t<\/dt>\n\t\t\t\t<dd class='wp-caption-text gallery-caption' id='gallery-4-916'>\n\t\t\t\tStatic setting in lightmapped objects\n\t\t\t\t<\/dd><\/dl><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon portrait'>\n\t\t\t\t<a href='https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Lightmapping-Settings-Light.png'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Lightmapping-Settings-Light-150x150.png\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" aria-describedby=\"gallery-4-913\" srcset=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Lightmapping-Settings-Light-150x150.png 150w, https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Lightmapping-Settings-Light-36x36.png 36w, https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Lightmapping-Settings-Light-115x115.png 115w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/a>\n\t\t\t<\/dt>\n\t\t\t\t<dd class='wp-caption-text gallery-caption' id='gallery-4-913'>\n\t\t\t\tLightmapping setting in lights\n\t\t\t\t<\/dd><\/dl><br style=\"clear: both\" \/>\n\t\t<\/div>\n\n<p>Lightmapping results in Unity strongly depend on the actual\u00a0<strong>Rendering Path<\/strong>. This is configured either globally (at the\u00a0<strong>Player Settings<\/strong>) or per-camera (<em>Rendering Path<\/em>\u00a0option). The Rendering Path can be changed anytime and it does not require a new Bake.<\/p>\n\n\t\t<style>\n\t\t\t#gallery-5 {\n\t\t\t\tmargin: auto;\n\t\t\t}\n\t\t\t#gallery-5 .gallery-item {\n\t\t\t\tfloat: left;\n\t\t\t\tmargin-top: 10px;\n\t\t\t\ttext-align: center;\n\t\t\t\twidth: 25%;\n\t\t\t}\n\t\t\t#gallery-5 img {\n\t\t\t\tborder: 2px solid #cfcfcf;\n\t\t\t}\n\t\t\t#gallery-5 .gallery-caption {\n\t\t\t\tmargin-left: 0;\n\t\t\t}\n\t\t\t\/* see gallery_shortcode() in wp-includes\/media.php *\/\n\t\t<\/style>\n\t\t<div id='gallery-5' class='gallery galleryid-817 gallery-columns-4 gallery-size-thumbnail'><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Lightmapping-Settings-Player.png'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Lightmapping-Settings-Player-150x150.png\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" aria-describedby=\"gallery-5-915\" srcset=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Lightmapping-Settings-Player-150x150.png 150w, https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Lightmapping-Settings-Player-36x36.png 36w, https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Lightmapping-Settings-Player-115x115.png 115w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/a>\n\t\t\t<\/dt>\n\t\t\t\t<dd class='wp-caption-text gallery-caption' id='gallery-5-915'>\n\t\t\t\tRendering Path in Player settings\n\t\t\t\t<\/dd><\/dl><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon portrait'>\n\t\t\t\t<a href='https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Lightmapping-Settings-Camera.png'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Lightmapping-Settings-Camera-150x150.png\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" aria-describedby=\"gallery-5-918\" srcset=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Lightmapping-Settings-Camera-150x150.png 150w, https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Lightmapping-Settings-Camera-36x36.png 36w, https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Lightmapping-Settings-Camera-115x115.png 115w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/a>\n\t\t\t<\/dt>\n\t\t\t\t<dd class='wp-caption-text gallery-caption' id='gallery-5-918'>\n\t\t\t\tRendering Path in Camera settings\n\t\t\t\t<\/dd><\/dl>\n\t\t\t<br style='clear: both' \/>\n\t\t<\/div>\n\n<h3>Lightmapping UVs<\/h3>\n<ul>\n<li><strong>Provided by the 3D model:<\/strong> Lightmapping will use the second UV channel (uv2) if available. If not, lightmapping will use the main UV channel. If no valid UV channels are available for an object, its lightmap will be completely dark.<\/li>\n<li><strong>Generated by Unity 3D:<\/strong> Enabling <a href=\"http:\/\/docs.unity3d.com\/Documentation\/Components\/FBXImporter-Model.html\"><em>Generate Lightmap UVs<\/em><\/a> at the Import Settings. All objects will receive a proper UV map for lightmapping upon import.<\/li>\n<\/ul>\n<p style=\"text-align: center;\"><a href=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Lightmapping-Settings-Import.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-919\" src=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Lightmapping-Settings-Import-281x300.png\" alt=\"Lightmapping Settings - Import\" width=\"225\" height=\"240\" srcset=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Lightmapping-Settings-Import-281x300.png 281w, https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Lightmapping-Settings-Import.png 325w\" sizes=\"auto, (max-width: 225px) 100vw, 225px\" \/><\/a><\/p>\n<p>Lightmapping UVs must conform the <a href=\"http:\/\/docs.unity3d.com\/Documentation\/Manual\/LightmappingUV.html\">specific requirements of lightmaps<\/a> in order to avoid visual distortions and artifacts. \u00a0The <em>Generate Lightmap UVs<\/em> option of Unity 3D already follows all these requirements.<\/p>\n<blockquote><p><strong>Best practice:<\/strong> Separately import the objects that will make use of lightmaps, then use the <em>Generate Lightmap UVs<\/em> import setting on them. This will save unnecessary UV data on objects that won&#8217;t make use of lightmapping.<\/p><\/blockquote>\n<p>In this picture the UVs at the left side have been provided by <a href=\"http:\/\/wiki.blender.org\/index.php\/Doc:2.6\/Manual\/Textures\/Mapping\/UV\/Unwrapping#Lightmap\">Blender&#8217;s <em>Lightmap Pack<\/em> UV unwrap option<\/a> with default settings. The UVs at the right side have been calculated by Unity 3D, option <em>Generate Lightmap UVs<\/em> with default settings:<\/p>\n<div id=\"attachment_912\" style=\"width: 630px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Lightmapping-UVs-comparison-exported1.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-912\" class=\"size-large wp-image-912\" src=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Lightmapping-UVs-comparison-exported1-1024x606.png\" alt=\"click to enlarge\" width=\"620\" height=\"366\" srcset=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Lightmapping-UVs-comparison-exported1-1024x606.png 1024w, https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Lightmapping-UVs-comparison-exported1-300x177.png 300w, https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Lightmapping-UVs-comparison-exported1.png 1478w\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" \/><\/a><p id=\"caption-attachment-912\" class=\"wp-caption-text\">click to enlarge<\/p><\/div>\n<p>&nbsp;<\/p>\n<hr style=\"width: 100%;\" width=\"100%\" \/>\n<h1>Dual lightmaps<\/h1>\n<ul>\n<li>Work with Deferred Lighting only<\/li>\n<li>Two sets of lightmaps: far, near<\/li>\n<li><strong>Far:<\/strong> full illumination<\/li>\n<li><strong>Near:<\/strong> indirect lighting form Auto sources, full lighting from Bake-only sources, emissive materials and sky lights<\/li>\n<li>The <strong>Shadow Distance<\/strong> quality setting defines the transition point between the Near and Far regions<\/li>\n<\/ul>\n<div id=\"attachment_868\" style=\"width: 630px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Dual-Lightmaps-Light-Modes-exported.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-868\" class=\"size-large wp-image-868\" src=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Dual-Lightmaps-Light-Modes-exported-1024x643.png\" alt=\"click to enlarge\" width=\"620\" height=\"389\" srcset=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Dual-Lightmaps-Light-Modes-exported-1024x643.png 1024w, https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Dual-Lightmaps-Light-Modes-exported-300x188.png 300w, https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Dual-Lightmaps-Light-Modes-exported.png 1562w\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" \/><\/a><p id=\"caption-attachment-868\" class=\"wp-caption-text\">click to enlarge<\/p><\/div>\n<table border=\"0\" align=\"center\">\n<caption><em>Lighting effects in Dual Lightmaps mode<\/em><\/caption>\n<thead>\n<tr>\n<th><\/th>\n<th style=\"width: 40%;\" align=\"center\">Near<\/th>\n<th style=\"width: 40%;\" align=\"center\">Far<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<th>Static objects<\/th>\n<td align=\"center\">Real-time lighting and shadows, Specular \/ Bump effects<\/td>\n<td align=\"center\"><strong>Auto lights:<\/strong> Lightmap only\u00a0&#8211; Major bump details are captured in lightmap as allowed by the lightmap resolution <sup>(1)<br class=\"none\" \/><br class=\"none\" \/><\/sup><strong>Realtime-only lights:<\/strong>\u00a0Real-time lighting combined with the lightmap, specular \/ bump effects, no shadows (2)<\/td>\n<\/tr>\n<tr>\n<th>Dynamic objects<\/th>\n<td align=\"center\">Real-time lighting and shadows, Specular \/ Bump effects<\/td>\n<td align=\"center\">Real-time lighting, specular \/ bump effects,\u00a0no shadows <sup>(2)<\/sup><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"padding-left: 30px;\"><sup>(1)<\/sup>\u00a0Many draw calls are saved as no lighting, bump\/spec effects, nor real-time shadows are being applied<br class=\"none\" \/><sup>(2)<\/sup>\u00a0Some draw calls are saved as no shadows are being calculated<\/p>\n<p><strong>Baked-only lights<\/strong> are baked in the lightmap only, casting the shadows of the Static objects. They have no effect in runtime.<\/p>\n<p>&nbsp;<\/p>\n<hr style=\"width: 100%;\" width=\"100%\" \/>\n<h1>Single lightmap<\/h1>\n<ul>\n<li><span style=\"line-height: 13px;\">Works with any rendering path (Forward Rendering, Deferred Lighting, Vertex Lit)<\/span><\/li>\n<li>Single set of lightmaps (half memory used)<\/li>\n<li>Only one directional light can cast realtime shadows in Forward Rendering<\/li>\n<\/ul>\n<p>Realtime shadows strongly vary depending on the rendering path used for the lights marked as Auto:<\/p>\n<ul>\n<li><span style=\"line-height: 16px;\"><strong>Forward Rendering:<\/strong> Dynamic objects cast shadows on Static objects, but do NOT receive shadows from them.<\/span><\/li>\n<li><strong>Deferred Lighting:<\/strong> Dynamic objects receive shadows from Static objects, but do NOT cast shadows on them.<\/li>\n<\/ul>\n<div id=\"attachment_879\" style=\"width: 630px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Single-Lightmaps-Light-Modes-exported.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-879\" class=\"size-large wp-image-879\" src=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Single-Lightmaps-Light-Modes-exported-1024x643.png\" alt=\"click to enlarge\" width=\"620\" height=\"389\" srcset=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Single-Lightmaps-Light-Modes-exported-1024x643.png 1024w, https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Single-Lightmaps-Light-Modes-exported-300x188.png 300w, https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Single-Lightmaps-Light-Modes-exported.png 1562w\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" \/><\/a><p id=\"caption-attachment-879\" class=\"wp-caption-text\">click to enlarge<\/p><\/div>\n<h5>\u00a0Forward Rendering<\/h5>\n<table border=\"0\" align=\"center\">\n<thead>\n<tr>\n<th><\/th>\n<th style=\"width: 26%;\" align=\"center\">Lighting source<\/th>\n<th style=\"width: 26%;\" align=\"center\">Realtime shadows (single directional light)<\/th>\n<th style=\"width: 26%;\" align=\"center\">Specular \/ Bump<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<th>Static objects<\/th>\n<td align=\"center\">Lightmap + Realtime-only lights<\/td>\n<td align=\"center\">Static objects receive shadows from Dynamic objects<\/td>\n<td align=\"center\"><strong>Auto lights:<\/strong> No &#8211; Only major bump details are captured in lightmap as allowed by the lightmap resolution.<br class=\"none\" \/><br \/>\n<strong>Realtime-only lights:<\/strong>\u00a0Full Specular \/ Bump effects combined with lightmap details.<\/td>\n<\/tr>\n<tr>\n<th>Dynamic objects<\/th>\n<td align=\"center\">Realtime from all lights except Bake-only lights<\/td>\n<td align=\"center\">Dynamic objects cast shadows over Static and Dynamic objects, but do NOT receive shadows from Static objects.<\/td>\n<td align=\"center\">Full Specular \/ Bump effects.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h5>Deferred Lighting with &#8220;Auto&#8221; lights<\/h5>\n<table border=\"0\" align=\"center\">\n<thead>\n<tr>\n<th><\/th>\n<th style=\"width: 26%;\" align=\"center\">Lighting source<\/th>\n<th style=\"width: 26%;\" align=\"center\">Realtime shadows<\/th>\n<th style=\"width: 26%;\" align=\"center\">Specular \/ Bump<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<th>Static objects<\/th>\n<td align=\"center\">Lightmap only<\/td>\n<td align=\"center\">Static objects cast shadows over Dynamic objects.<\/td>\n<td align=\"center\">No &#8211; Only major bump details are captured in lightmap as allowed by the lightmap resolution.<\/td>\n<\/tr>\n<tr>\n<th>Dynamic objects<\/th>\n<td align=\"center\">Realtime from all Auto lights<\/td>\n<td align=\"center\">Dynamic objects cast shadows over other Dynamic objects, but NOT over Static objects.<\/td>\n<td align=\"center\">Full Specular \/ Bump effects.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h5>Deferred Lighting with &#8220;Realtime-only&#8221; lights<\/h5>\n<table border=\"0\" align=\"center\">\n<thead>\n<tr>\n<th><\/th>\n<th style=\"width: 26%;\" align=\"center\">Lighting source<\/th>\n<th style=\"width: 26%;\" align=\"center\">Realtime shadows<\/th>\n<th style=\"width: 26%;\" align=\"center\">Specular \/ Bump<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<th>Static objects<\/th>\n<td align=\"center\">Lightmap + Realtime-only lights<\/td>\n<td align=\"center\">Full realtime shadows combined with lightmap shadows<\/td>\n<td align=\"center\">Full Specular \/ Bump effects combined with lightmap details<\/td>\n<\/tr>\n<tr>\n<th>Dynamic objects<\/th>\n<td align=\"center\">Realtime from all Realtime-only lights<\/td>\n<td align=\"center\">Full realtime shadows over both Static and Dynamic objects<\/td>\n<td align=\"center\">Full Specular \/ Bump effects<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<hr style=\"width: 100%;\" width=\"100%\" \/>\n<p><span style=\"font-size: 2em;\">Directional Lightmaps<\/span><\/p>\n<ul>\n<li>Work exactly like Single Lightmap with one addition: Static objects exhibit <strong>full lighting and specular \/ bump effects from *all* the light sources<\/strong>\u00a0(Auto \/ Realtime-only \/ Bake-only). Note that this includes <strong>Ambient light<\/strong> as well!<\/li>\n<li>Two sets of lightmaps: Color + Scale (directional information). Uses the same memory as Dual Lightmaps.<\/li>\n<li>Works with Forward Rendering and Deferred Lighting (not with Vertex Lit).<\/li>\n<\/ul>\n<p>The scene below contains Static objects and &#8220;Auto&#8221; lights only:<\/p>\n<div id=\"attachment_892\" style=\"width: 630px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Directional-Lightmap-vs.-Single-Lightmap-exported.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-892\" class=\"size-large wp-image-892\" src=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Directional-Lightmap-vs.-Single-Lightmap-exported-1024x635.png\" alt=\"click to enlarge\" width=\"620\" height=\"384\" srcset=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Directional-Lightmap-vs.-Single-Lightmap-exported-1024x635.png 1024w, https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Directional-Lightmap-vs.-Single-Lightmap-exported-300x186.png 300w, https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Directional-Lightmap-vs.-Single-Lightmap-exported.png 1554w\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" \/><\/a><p id=\"caption-attachment-892\" class=\"wp-caption-text\">click to enlarge<\/p><\/div>\n<p>In terms of performance, the bump \/ specular effects in Directional Lightmap are provided for free! (no additional draw calls):<\/p>\n<p><a href=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Directional-Lightmap-vs-Single-Lightmap-Performance.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-901\" src=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Directional-Lightmap-vs-Single-Lightmap-Performance.png\" alt=\"Directional Lightmap vs Single Lightmap Performance\" width=\"640\" height=\"300\" srcset=\"https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Directional-Lightmap-vs-Single-Lightmap-Performance.png 640w, https:\/\/www.edy.es\/dev\/wp-content\/uploads\/2013\/08\/Directional-Lightmap-vs-Single-Lightmap-Performance-300x140.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; UPDATE:\u00a0This document applies to Unity 4. For Unity 5 lighting take a look at the\u00a0Unity 5 Lighting Cookbook. &nbsp; How can I make dynamic objects to cast realtime shadows on lightmapped (static) objects? Forward Rendering (Single Lightmap or Directional Lightmap only):Dynamic objects cast realtime shadows on lightmapped objects for a single directional light\u00a0configured as [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":951,"parent":228,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"page-c.php","meta":{"footnotes":""},"class_list":["post-817","page","type-page","status-publish","has-post-thumbnail","hentry"],"jetpack_shortlink":"https:\/\/wp.me\/P1PjRF-db","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.edy.es\/dev\/wp-json\/wp\/v2\/pages\/817","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.edy.es\/dev\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.edy.es\/dev\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.edy.es\/dev\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.edy.es\/dev\/wp-json\/wp\/v2\/comments?post=817"}],"version-history":[{"count":106,"href":"https:\/\/www.edy.es\/dev\/wp-json\/wp\/v2\/pages\/817\/revisions"}],"predecessor-version":[{"id":1323,"href":"https:\/\/www.edy.es\/dev\/wp-json\/wp\/v2\/pages\/817\/revisions\/1323"}],"up":[{"embeddable":true,"href":"https:\/\/www.edy.es\/dev\/wp-json\/wp\/v2\/pages\/228"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.edy.es\/dev\/wp-json\/wp\/v2\/media\/951"}],"wp:attachment":[{"href":"https:\/\/www.edy.es\/dev\/wp-json\/wp\/v2\/media?parent=817"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}