Forums » Custom Maps

Baking Lightmaps

    • Moderator
    • 998 posts
    July 27, 2021 12:22 PM PDT

    Lightmapping is a way to store light data into a texture.

    When making a map, sometimes there may be a need to add additional light sources. However, adding too many lights can cause flickering due to the optimization process, which limits the number of real-time lights that can render at once.

    One of the ways to fix the light flickering is by reducing the number of the lights, another, is by baking the light data into a lightmap.

    Below are the steps on how to bake the lightmaps in your map in Unity:

    1. Select every active Light in the Scene and in the Inspector view set the "Mode" to "Baked".
    2. Select every map object that you do not plan to animate and in the top right corner of the Inspector view check the "Static" checkbox (Note: If you use the Water circle in your map, do not mark it as Static, since it covers a large area and it would take a long time to process the lightmaps.).
    3. Make sure that the 3D models you're using have Lightmap UVs generated, for this, select the model in the project view and in the Inspector view under the Model tab check the "Generate Lightmap UVs" checkbox, and click Apply. 
    4. Go to Window -> Rendering -> Lighting and in the Window click "New Lighting Settings" or assign the existing Lighting settings preset (The Lightmap value presets are now included in the export package starting from version 1.0.4).
    5. Finally, in the Lighting window click "Generate Lighting" and wait for it to finish (The progress will appear in the bottom right corner), after it finishes and you're happy with the result, save the Scene.

    If you download the lightmap value presets, import them by right-clicking on the Assets folder -> Import Package -> Custom Package...

    The folder contains two presets that are used in the official maps: "LightmapSharpShadows" and "LightmapSoftShadows".

    Pros of using Lightmaps:

    - Improved performance

    - More realistic lighting

    - Elimination of light flickering

    Cons of using Lightmaps:

    - Increase in map size

    - Normal maps will not be visible

    - Baking process can take a considerable time to finish (anywhere from 1 min to 1 hour depending on the complexity of the map and the lightmap resolution)

    - Every time you move or add an object, the lightmap needs to be rebaked, so only bake the lightmaps when the map is finished


    This post was edited by Admin at October 17, 2022 4:26 PM PDT
    • 108 posts
    July 27, 2021 3:24 PM PDT
    Damn nice, I am going to do it when I have done the map
    • 108 posts
    August 9, 2021 4:22 AM PDT

    I am so confused when baking lights, so I have a few questions to ask you

    1. Whole the map becomes dark when baking, is it normal?

     

    2. What should the lightmapping setting be as recommended for fitting map size?

    ( Before baking, the map has already had 6.9MB, if that's too much then I will compress the texture size)

     

    • 524 posts
    August 12, 2021 12:26 AM PDT
    I missed this post when it was new, but this is a great way to add lots of interesting visuals to your maps. I highly recommend mapmakers play with this feature :)
    • 108 posts
    August 12, 2021 1:46 AM PDT

    I have just tried it 

    • Moderator
    • 998 posts
    August 12, 2021 6:29 AM PDT

    @BennyChow The tutorial had one step missing, which is the 3D models need to have Lightmap UVs generated.

    I have updated the front post with the missing step.

    Edit: In the first screenshot the map was dark because the lightmap was still running, it will fill the dark areas gradually.

    Also, older versions of Unity do not have support for lightmap value presets so you need to set the values manually, on your screenshot the Lightmap Resolution is 40 which is a bit too high, 10 - 15 would be enough to reduce the bake time.


    This post was edited by Admin at August 12, 2021 6:50 AM PDT
    • 108 posts
    August 12, 2021 6:57 AM PDT

    Can I use 5 if there is not enough storage? The screenshot is using 5 and it looks fine though

    • Moderator
    • 998 posts
    August 12, 2021 7:00 AM PDT
    BennyChow said:

    Can I use 5 if there is not enough storage? The screenshot is using 5 and it looks fine though

    Sure, there is no issue with setting it lower.
    • 108 posts
    August 12, 2021 7:02 AM PDT

    AH ok, thank you for your response 

    • 359 posts
    August 12, 2021 7:03 AM PDT

    just remove custom maps, so people play the higher quality og maps

    • 657 posts
    August 12, 2021 7:40 AM PDT

    BennyChow said:

    I have just tried it 

    WOW man that looks so awesome :D

    y'know this reminds me of a game called "lost outpost" and "outpost"

  • iZu
    • 2118 posts
    August 12, 2021 7:48 AM PDT

    xChapo said:

    just remove custom maps, so people play the higher quality og maps

    agreed

    • 377 posts
    August 12, 2021 8:47 AM PDT

    ya agreed

    • 95 posts
    September 6, 2021 3:10 PM PDT

    Max, does the Bakery Lightmapper work for this aswell? While Unity's own Lightmappers are good, Bakery in general is considered far more superior in giving higher quality lightmaps.

     

    Edit: Seems to work pretty nicely, actually. I still have to figure out how to use Bakery more efficiently, but yeah... it works! Just make sure to set the "Max resolution" under "Auto-atlasing" to 1024.



    This post was edited by DeadArt at September 6, 2021 9:26 PM PDT
    • 108 posts
    September 8, 2021 2:44 AM PDT

    lt looks better than the default one in unity so much ( totally ),l am going to try it too!

    • Moderator
    • 998 posts
    September 8, 2021 9:08 AM PDT

    Default lightmapping can look just as good, you just need to know what values to tweak.

    In step 4 of the tutorial, I have included lightmap value presets, but they only work in Unity 2020+, basically, you just drag & drop any of them into the Lighting Setting variable in the Lighting window and it's ready.

    • 956 posts
    September 24, 2022 2:58 PM PDT

    um, should Maya help me make maps? i really want to make my own maps.

    • 524 posts
    September 24, 2022 4:12 PM PDT
    Maya is a program for creating 3D models. Having those skills are helpful but not required for warmerise maps. If you're interested in learning about 3D modeling, I would actually recommend Blender. It's completely free, and the community is much larger so finding tutorials is easier
    • 956 posts
    September 24, 2022 5:29 PM PDT

    so how does the importing maps work? i have many scenes in Maya but idk how to make them maps

    • 524 posts
    September 24, 2022 6:02 PM PDT

    Maps are made in Unity, which can be installed here: https://unity.com/download

     

    You should be able to export your scenes from Maya as an FBX or OBJ file and import them into the unity editor.

     

    From there, follow the instructions at this forum thread to install the Warmerise Custom Maps Unity Addon, then you can Export it using the tools at the top of the unity editor. If you encounter any issues with this processs, I'd make a new forum thread since it's off topic from this one :)