Search Unity

[SOLVED] Lightmapping not working with Lights

Discussion in 'General Graphics' started by dragriff, Feb 10, 2016.

  1. dragriff

    dragriff

    Joined:
    Oct 22, 2015
    Posts:
    30
    Hello. I have been looking around quite hard, watching Youtube videos and even trying to find the answer in Forums, but I just can't seem to find an answer to my issue.

    Basically, as far as I understand, by using Unity Lightmaps, you can have the objects look like they have lights shining on them, without actual lights being in the scene, correct?

    Well, when I try to bake my own lightmaps, stuff like meshes with Emission on them and such things seem to work fine, but whenever I try to add a Light into the scene (like, let's say, there's a lamp on a person's desk) it never works for me. Unity seems to bake something, but as soon as it's done, the scene becomes dark again, as if the Light wasn't there.

    Yes, I've set everything as Static, I've tried checking the "Preserve UVs", and yes, I tried setting the Lights as "Baked" or "Mixed". Nothing seems to work.

    Here are some screenshots of what I mean:

    I made a quick New Scene and put a bunch of meshes into a box form, to simulate a closed-off room and I put a single Point Light in it.

    This is how it looks when the light is set to "Realtime":



    And this is what happens when I bake the Lightmap:



    I have NO idea what I'm doing wrong, so if someone could help me out here, that would be great.
    Thank you.
     
    RickshawDerpyDerp likes this.
  2. PeteUnity3D

    PeteUnity3D

    Unity Technologies

    Joined:
    Jan 4, 2016
    Posts:
    68
    Sorry to ask something that you've already stated you've done but I can only go off the shots. Are you sure you have the lighting culling masks and baking type correct in your scene? Do you have this unity scene I can look over?
     
  3. dragriff

    dragriff

    Joined:
    Oct 22, 2015
    Posts:
    30
    Thank you for the response.

    I'm really new at this (which might be the problem to begin with), so I'm not entirely sure what Lighting Culling Masks are, OR how I would check baking type. Where would I check that?
    Also, if I were to share my scene, how would I go about doing it? By sharing the Project Folder?
     
  4. PeteUnity3D

    PeteUnity3D

    Unity Technologies

    Joined:
    Jan 4, 2016
    Posts:
    68
    No Problem Dragriff.

    To create a small version of your project, duplicate it to somewhere and remove the Libary folder (leaving Assets and Project settings) along with any files in the assets folder you don't feel to be relevant. Zip up the project folder and then send it through to my inbox if you don't want to publically share it.

    This is a good resource to explain the different settings available in the light component: http://docs.unity3d.com/Manual/class-Light.html

    Lighting culling masks are a way to exclude some geometry from being affected by the light. based on what I can see happening in your first shot, I'd say this probably isn't your problem.

    Are you using normal primitive boxes included with Unity or is this some geometry you have created in a modelling package?
     
  5. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,429
    It should be simple.
    • Set geometry/meshes to Static.
    • Set lights to Baked.
    • Make sure imported meshes have Generate Lightmap UV's checked.
    • Turn off Precomputed Realtime GI in the Lighting panel.
    • Bake.
     
    jniac and GameEverything like this.
  6. dragriff

    dragriff

    Joined:
    Oct 22, 2015
    Posts:
    30
    Okay, apparently the one thing that I was missing was to Turn off Precomputed Realtime GI.
    I did everything else BUT that, and as soon as I checked it, I can bake lightmaps from Lights now.

    There are other issues now, like strange artifacts on some parts of my meshes, but I guess that's a completely other issue now.
     
  7. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,429
    Try unchecking Compressed in the lighting window.
     
  8. BamBamAlicious

    BamBamAlicious

    Joined:
    Jan 29, 2017
    Posts:
    58
    So, just came across this myself and combined with the tips above, one last thing got my Lightmap working. I changed my shaders from Specular, to Diffuse... and lo and behold! My lightmap works!!
     
    Last edited: Mar 24, 2017
    KaletheQuick likes this.
  9. KaletheQuick

    KaletheQuick

    Joined:
    Feb 12, 2016
    Posts:
    41
    Same here.
     
    BamBamAlicious likes this.
  10. GameEverything

    GameEverything

    Joined:
    Feb 22, 2016
    Posts:
    8
    I'm glad I read that because I probably would've never figured it out. Greetings from 2018, lol.
     
    CGCowboy and BamBamAlicious like this.
  11. Ruuubick

    Ruuubick

    Joined:
    Apr 20, 2014
    Posts:
    15
    I am having the issue described by the OP, but none of the solutions provided fixed it for me, is there anything else in the settings that I could look at ? (I'm on 5.6.3p1)
     
unityunity