Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Survival Shooter project baked lighting/shadow issue

Discussion in 'Editor & General Support' started by rustbyte, Mar 22, 2015.

  1. rustbyte

    rustbyte

    Joined:
    Aug 14, 2013
    Posts:
    5
    Hi there,

    I've recently started learning Unity3d (using version 5) and currently going through the Survival Shooter tutorial.

    The first part of setting up the environment yields some very strange lighting/shadow glitches.
    When adding the environment prefab, and then the light-prefab, everything looks as it should at first.
    Light and shadows look perfect...until the baking process completes.
    Then the scene is rendered with weired shadows all over the scene.

    Searching the forums i found one thread referencing the same issue:

    http://forum.unity3d.com/threads/su...al-environment-texture-shader-problem.311681/

    And my scene has the exact same problems:

    (link is from the post above)
    http://gyazo.com/8d4a2164547e1da193c734b92ccaa868

    My first thought was that i had messed up a setting somewhere. So i went back and created a brand new
    project, following the tutorial video to the letter up and untill adding the environment and lights, with the same
    result.

    The only thing i could do to "fix" the issue was to change the two directional lights from mixed/backed into
    realtime. However this kills the performance of the game.

    Being new to Unity im at a loss as to how to fix this. I tried looking at some of the import settings for the models
    in the project, such as Generate Lightmap UV's, but does not improve anything that i can see.

    My guess is that could have something to do with the project assets being initially made for Unity 4.6 and then
    converted to 5 when i import them.

    Any ideas as to what im missing/doing wrong?

    Thanks!
     
  2. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    (650578) - Terrain: Standard terrain shaders now correctly support spot light / point light shadows.
    p2..... is that your issue fixed?

    Also - try replacing the Ambient light type to "Color" or "Gradient", there was an issue with the default ambient doing mangled blackness on terrains.

    cheers
     
  3. rustbyte

    rustbyte

    Joined:
    Aug 14, 2013
    Posts:
    5
    Thanks for the reply twobob.

    However the issue in the link you provided is not the problem im having.

    Tried changing the Ambient to Color/Gradient from Skybox as you suggested, but same result.

    I was able to find a resolution, although im not sure if this is recommended practice.
    I selected all the child-models of the Environment model in the project, and enabled "Generate Lightmap UV's",with
    the advanced options at default, and the scene now behaves correctly in this regard.

    However, now there is another issue with the scene going darker upon player death, and then the scene going
    black in the editor scene/game view once play-test has stopped.
    Exactly as described in this post:

    http://forum.unity3d.com/threads/su...al-environment-texture-shader-problem.311681/

    Im able to "fix" this using the same method as described in the above post, by disableing/enabling the Environment gameobject.

    Here is my system spec ( forgot it in the original post):
    Unity version: 5.0.0f4 (64 bit)
    OS: Windows 8.1 (64 bit)
    CPU: AMD Phenom II X4 965 3.4ghz
    RAM: 16gig
    GPU: Geforce GTX 760 (driver version 347.88)
    DX runtime: 11.0
     
  4. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Yeah. That second one is the one I was toying with before.

    I would install a VERSION of patch2 - alongside your other f4 install - and retest in that.
    I suspect some of these are now fixed.
     
  5. rustbyte

    rustbyte

    Joined:
    Aug 14, 2013
    Posts:
    5
    Been playing around with this for a bit now, trying to find the exact spot that reproduces the editor scene-view/game-view going dark when playing.

    It seems to only happen following a call to Application.LoadLevel(Application.loadedLevel)
     
  6. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
  7. rustbyte

    rustbyte

    Joined:
    Aug 14, 2013
    Posts:
    5
    Bingo thats the one ;)

    I tried some of the stuff in the thread you linked, for player settings.
    Changing rendering path from Forward to Legacy Vertex lit works "better", but is still crap.
    The scene gets darker overall, but never goes pitch black. However shadows stop working, for both static
    and dynamic objects.

    Also tried switching on/off some of the other stuff, like Dx11, static batching etc, to no avail.

    Ill try creating a brand new project with a box and simple light to see if i can reproduce it.
    The problem only seem to appear with baked directional lights, atleast that i can see thus far.
     
  8. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
  9. rustbyte

    rustbyte

    Joined:
    Aug 14, 2013
    Posts:
    5
    Tried the project in a version _p2 side install, and the results are the same.
    Even has another problem with a linerenderer not behaving as it should, but thats another case.
    Im gona drop this for now and just wait until its fixed ( or add a bugreport if needed ).

    Thanks for your help twobob, really appreciate it :)
     
  10. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    okay mate. p3 should drop pretty soonly now anyway. Maybe they caught it.
    You can always over-mangle your side-bar and give it another bash while waiting for the kettle to boil when that time comes. I do all my best testing then ;)

    And you are very welcome
     
  11. parrotsnest

    parrotsnest

    Joined:
    Mar 15, 2015
    Posts:
    1
    I am having this exact same issue, everything is fine, until I use the Lights prefab in the project. It appears to be the Moonlight light specifically. As soon as the baking is finished, it gets wonky looking:



    This does not occur when I change the lighting baking option to "real time." It appears to occur based on setting it to mixed (default in this project) or baked..

    I'm glad I've stumbled across this thread, because I've reinstalled Unity SO many times and have been driving myself insane with the issue. Any help is appreciated!
     
  12. talk2nadji

    talk2nadji

    Joined:
    Mar 25, 2015
    Posts:
    2
    Hi, im also new to unity and following the survival shooter. I also got the exact same problems with lighting/shadows and after compiling getting darker. I hope this problem is fixed soon. Im not gonna be of any use to you guys, but just wanted to share the pain..

    grtz from the Netherlands!
     
  13. peteorstrike

    peteorstrike

    Unity Technologies

    Joined:
    Oct 4, 2013
    Posts:
    116
    I just posted about this in the main Q&A thread, but I'm guessing this is an issue with invalid lightmap UVs.

    To copy and paste from the other thread;

    In Unity 5, Enlighten will try and automatically bake anything marked static, like our environment here. Currently these meshes don't all have valid Lightmap UVs for Enlighten to bake to as the project wasn't initially intended for baking, so you get these weird black areas of overlaps and repeats.

    If you go to the project's models folder, select each environment and prop mesh and tick Generate Lightmap UV's in the asset's Inpsector Model tab, wait for Unity to create some valid UV's, then let Enlighten rebake, then you shouldn't see these weird errors anymore (hopefully!)
     
    twobob, JackDarius and simke-nys like this.
  14. talk2nadji

    talk2nadji

    Joined:
    Mar 25, 2015
    Posts:
    2
    nevermind. It worked few times and now it doenst anymore. I have no idea what went wrong. Sorry about the false alarm.
     
    Last edited: Mar 29, 2015
  15. jyanisko

    jyanisko

    Joined:
    Mar 23, 2015
    Posts:
    2
    Mine still does it.... every time the game reloads it switches back and forth between the lights working and the lights not...
     
  16. prot0_j

    prot0_j

    Joined:
    Mar 30, 2015
    Posts:
    1
    I haven't tested long enough to tell this works 100% for sure or not.
    1. Generate Lightmap UV's as suggested above helped the poorly baked GI.
    2. I encountered that the scene would turn pitch black after playing, so turning the Baked GI and Precomputed Realtime GI on and off to retrigger the GI build fixed it only to break again after a play or two. It seems to be behaving nicely after turning off Continuous Baking in the Lighting panel.
     
  17. felipe76

    felipe76

    Joined:
    Apr 2, 2015
    Posts:
    1
    Hi,
    I had the same problem, but I made an important discovery!

    In my case, this BUG only happens if the format of the objects are set to ".fbx" or ".max"

    Could you tell me if you used any of these formats?

    I'm investigating all I can about it.
     
  18. AK123

    AK123

    Joined:
    Apr 9, 2015
    Posts:
    2
    looks like mine are fbx - that's the way it was imported
     
  19. simke-nys

    simke-nys

    Joined:
    Jan 8, 2014
    Posts:
    4
    Exactly the same issue for me

    UPDATE:
    Peteorstrike his answer solved it for me:

    If you go to the project's models folder, select each environment and prop mesh and tick Generate Lightmap UV's in the asset's Inpsector Model tab, wait for Unity to create some valid UV's, then let Enlighten rebake, then you shouldn't see these weird errors anymore (hopefully!)
     
    Last edited: Apr 15, 2015
    peteorstrike likes this.
  20. JackDarius

    JackDarius

    Joined:
    Apr 16, 2015
    Posts:
    1
    peteorstrike likes this.
  21. AM_Media

    AM_Media

    Joined:
    May 14, 2015
    Posts:
    1
    peteorstrikes solution worked for me.
    I just wanna say thanks to all of the people who contribute to these problems and help other people out. You guys are great! thanks again for all the help.
    I wish you well.
     
    peteorstrike likes this.
  22. moobchunks

    moobchunks

    Joined:
    Mar 31, 2014
    Posts:
    1
    @peteorstrikes solution did the trick, really glad I came across this question, thanks guys!
     
  23. Chiaro22

    Chiaro22

    Joined:
    May 26, 2014
    Posts:
    5
    After playtesting part 6 "Player health" of the Survival Shooter tutporial I got this issue with the whole level turing white in the scene view and very dark in game view.

    What fixed it for me was prot0's suggestion. I went to Windows-Lighting-Scene-Other settings and pressed Build, then unchecked the auto box. Now it seems to work fine.
     
  24. PshychoRZR

    PshychoRZR

    Joined:
    Oct 6, 2015
    Posts:
    1
    Hey guys I see you have lighting troubles..
    I was working on survival shooter series when I encountered this lighting problem after reloading the level ie (after game over) the lights become suddenly dim and the scene looked like a trash after reloading.
    But after a long time I found a solution
    Solution : Find menu bar and
    Window -> Lighting and there you get a dialog box you will observe auto written write next to the check box on down right, uncheck that checkbox you will also notice a drop down menu ( combobox) on its right on which build is written click on it and you will notice that it will extract all the lighting data on your scene now
    When you play your game it works as it is intended. hope this helps to someone.
     
  25. jhiramis

    jhiramis

    Joined:
    Feb 11, 2018
    Posts:
    4
    On the Menu tab on the top click on the "Window" > Lightning > scroll down on the Lightning Options and look for "BAKED GI" > Unchecked it. (check the screenshot)

    Hope it works for you.
     

    Attached Files:

unityunity