Lightmapping quickstart

Lightmapping is the process of baking or precalculating the lighting on a texture of static objects to make the game run faster and allow us to get the most out of our projects.

This generally isn't done as an optimization until you have finished building your entire level, but I think this is probably the best place to talk about it. If you prefer to wait, come back to this section when you are done with your level, as doing a lightmapping pass can take a long time:

  1. Go into Window | Lighting. From there, select the Scene tab and then change Ambient Intensity to 0 as we want to have all of the light in the level to be from our lighting. Also select the Skybox property and select our Nightsky and you should note the world get a lot darker. To also do this, go to the House and Props materials and change the Metallic property to 0 .75 and Smoothness to 0.
    Lightmapping quickstart
  2. Next, we will need to select all of our model files in the Models/Props and Models/Modular Pieces folders (not the prefabs). From there, check Generate Lightmap UVs from the Model tab and then click on the Apply button.
  3. Lightmapping is most efficient when dealing with static objects, that is, objects that will not be moving. That's our level stuff for sure, so select our Level 01 parent object, and click on the Static option. It will ask if you want the change for the children as well, and you should click on Yes, change children. Take a look at the following screenshot:
    Lightmapping quickstart
  4. Next, go to Window | Lighting. Then, select the Lightmap tab. This opens Lightmapping Editor, which we can use to bake our object, and more. By default, this should be set to Auto, which means that it will automatically do it but if not click on the Bake option. This may take a while on your larger projects. Once the process is completed, your scene will be lit correctly. Take a look at the following screenshot:
    Lightmapping quickstart

Looking great and it's starting to look like a spooky haunted house!

Note

For more information on lightmapping with Unity's new Global Illumination system, check out:

http://docs.unity3d.com/Manual/GIIntro.html.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset