Search Unity

Unity 5 - How to light large scenes.

Discussion in 'General Graphics' started by Hjeldnes, Mar 5, 2015.

  1. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    653
    This also work for static object if use light probes checkbox is ticked, right ?
    I often use this to lit small props that I keep outside of lightmap static to save bake time, and the result is quite correct.
     
  2. Tinovdk

    Tinovdk

    Joined:
    Nov 28, 2013
    Posts:
    81
    Yes. As far as I have seen, an object will be affected by lightprobes if 'Lightmap static' is disabled and 'Use Light Probes' is enabled. I use a similar approach by baking lightmaps of large surfaces and objects, and letting light probes affect the smaller objects. Here's a tip: If you set an object to lightmap static, but you set the lightmap scale to 0, it will bake its shadows and bounce light from its surface onto other static geometry without taking up space on the baked lightmap. :)
     
    lermy3d and jimmikaelkael like this.
  3. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    653
    Thank you so much for sharing this tip!
     
    Tinovdk likes this.
  4. carlosrovira

    carlosrovira

    Joined:
    Dec 23, 2014
    Posts:
    58
    Hi. I'm using baked lightmaps. And for my Player and dynamic objects, I set the lights to MIXED in order to get shadows for player, and moving objects. It works ok in Unity (OS X IDE), but as I deploy on iPhone, the shadows are gone.

    I think is the same think discussed in this thread. If this is the same, it seems something open several months ago and still not solved. So, since there's no clear ETA of this problem, could someone point to some workaround?

    Thanks for any insight on this. It seems a great issue to address.
     
  5. chrismarch

    chrismarch

    Joined:
    Jul 24, 2013
    Posts:
    435
    Don't use Mixed. Duplicate your lights with one group set to Baked and one to Realtime. Set the culling mask of the baked group to just your static object layers. Set the culling mask of the realtime group to your dynamic objects.
     
    Steviebops likes this.
  6. carlosrovira

    carlosrovira

    Joined:
    Dec 23, 2014
    Posts:
    58
    Thanks for your help Chris,

    I tried what you said using a duplicated set of lights and adjusting the groups with culling mask, but with no luck.
    Maybe there's something missing?

    With Mixed, the shadow shows in editor but not in iPhone. With the proposed method the shadow is not shown even in Unity.

    Thanks for your help
     
  7. chrismarch

    chrismarch

    Joined:
    Jul 24, 2013
    Posts:
    435
    Hmm, I'm not working with iOS at the moment, so I am not sure, but I would double check your quality settings.
     
  8. carlosrovira

    carlosrovira

    Joined:
    Dec 23, 2014
    Posts:
    58
    Hi Chris,

    I tried on "Good" and "Beautiful" modes. Shadows are activated :?

    Thanks
     
    chrismarch likes this.
  9. Matthew-Schell

    Matthew-Schell

    Unity Technologies

    Joined:
    Oct 1, 2014
    Posts:
    238
    FYI it was announced at the roadmap talk at Unite that mixed lighting will be fixed soon, check the youtube of the roadmap session for more info.

     
  10. carlosrovira

    carlosrovira

    Joined:
    Dec 23, 2014
    Posts:
    58
    Thanks Matthew,

    I watch the entire video, but can't see an specific mentions to mixed lights. Could you please let me know about the minute when this issue is mentioned?


    Thanks in advance, I think this issue is almost critical since is very visual and means to have all dynamic objects in scene (included player) with no shadows and with a real sense of no integration within the surrounding environment
     
  11. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,320
    Yeah, as mentioned at Unite we are working on fixing mixed mode. We have a branch with the changes almost ready to go into 5.3, so please bear with us a little longer.
     
  12. carlosrovira

    carlosrovira

    Joined:
    Dec 23, 2014
    Posts:
    58
    Thanks for sharing. I'll be waiting for 5.3 anxiously since this is important.
     
  13. moco2k

    moco2k

    Joined:
    Apr 29, 2015
    Posts:
    294
    Do the planned fixes also enable mixed mode for point lights?
     
  14. Hjeldnes

    Hjeldnes

    Joined:
    Jul 22, 2012
    Posts:
    113
    Also wondered about that, point light shadows are extra costly, and would benefit a lot from being baked into static geo.
     
  15. a_princess

    a_princess

    Joined:
    Oct 7, 2015
    Posts:
    2
    I have a question for KEngelstoft. Will Unity 5.3 fix this issue, too? Thanx!
    "Hmm, I actually managed to have dynamic objects casting realtime shadows along with static objects casting baked shadows (using "Mixed" option on the directional light). It does work for non-directional and directional baked lightmap, but not for directional-specular (seems like a bug)." from Kubold
     
  16. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,670
    @a_princess you need to add an "@" symbol to a name if you want to tag someone for their attention.

    So, you should use @KEngelstoft not just KEngelsoft. When you've partially typed the name after the @, you should get a menu of users to pick from.
     
  17. a_princess

    a_princess

    Joined:
    Oct 7, 2015
    Posts:
    2
    I see. it's good to know! Thanx!
     
  18. chrismarch

    chrismarch

    Joined:
    Jul 24, 2013
    Posts:
    435
    Until 5.3, what is the optimal way to combine baked lighting for our static environment, and get realtime shadows cast on it from our skinned meshes, without lighting the static environment with the dynamic light, (forward rendering on DX9)?

    We cannot successfully combine these to get baked lighting on terrain and realtime shadows from only the nonstatic objects: a custom light cookie, General GI>Directional Mode: Directional, forward rendering, DX9, 5.1.1f1. For example, one mixed Directional light with a Culling Mask set for static and dynamic objects does not cause any shadows to be cast by the dynamic objects. Alternatively, one baked (Culling Mask set to static objects only) and another realtime Directional light with the realtime Culling Mask only set to the dynamic object layers has the same problem. I just found that removing our light cookie solves the issue, so perhaps that is a new bug to enter, but my question at the end of the previous paragraph remains, and I believe is on topic.

    We like the performance and appearance of the baked lighting on the static environment on older PCs, but we don't want to pay the performance penalty of lighting the entire static environment with a realtime light just to see our skinned character shadows.
     
  19. seansteezy

    seansteezy

    Joined:
    Nov 28, 2013
    Posts:
    115
    Omg I was busting my hump trying to figure out what I was doing wrong and it turns out it is a bug? I am relieved to know I was doing things correctly, but yeah, thanks for fixing soon, can't wait for 5.3!
     
  20. Hjeldnes

    Hjeldnes

    Joined:
    Jul 22, 2012
    Posts:
    113
    I believe mixed lights are postponed till 5.4 :/
    Check this post on the beta forum.
    http://forum.unity3d.com/threads/any-hope-to-have-the-deferred-lighting-fixed.365160/#post-2368529
    "Will confirm that mixed mode fixing will be delayed to 5.4, as the pull request was big enough to be concerning for stability for 5.3. (Note, beta for 5.4 will start in Dec"

    The bug soon has a one year anniversary, pretty amazing considering the seriousness of this bug. There was also a mention that mixed lights would only be supported by directional lights?

    Maybe @KEngelstoft could confirm?
     
  21. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,670
    If you see it on the roadmap, I'm sure that this is official. Not opening a can of worms, or trying to split hairs, but I feel that this is being treated as a new feature, as opposed to fixing an existing bug - but either way, it would be nice to have an elegant solution as soon as possible.

    If you have pro, you can jump on the Beta.
     
  22. Hjeldnes

    Hjeldnes

    Joined:
    Jul 22, 2012
    Posts:
    113
    I couldn't find the mixed lighting on the feature roadmap, and mixed lights are not yet working in beta (tested a week ago or so).
     
  23. seansteezy

    seansteezy

    Joined:
    Nov 28, 2013
    Posts:
    115
    I found a workaround that isn't optimal, but maintains some decent performance on mobile. Using a realtime directional light pointing straight down (since I am using an interior scene, all the ceiling lights point down) it will yield shadows on dynamic objects, while following the normal baking procedure for everything else, and then turning on precomputed realtime GI, you will get your dynamic objects to be lit and have shadows :)

    This to me is a huge oversight by Unity, I understand everyone there is busy and working as fast as they can (and a ton of other great things about Unity, I ain't mad atcha), but not having a working lighting solution for mobile when you claim to be able to publish to mobile, is a big error. You just can't do that. It wouldn't fly if I made an asset like that, that only worked sorta. But either way, I was able to get what I needed using realtime directional light to kinda fake my top down lighting.

    It was seriously driving me crazy and right before the submission deadline for the Leap Motion 3D Jam! Ugh!
     
    lermy3d and ilmario like this.
  24. carlosrovira

    carlosrovira

    Joined:
    Dec 23, 2014
    Posts:
    58
    uffff! very bad to make that kind of changes on a Roadmap. This is not a tiny problem, and make it happen in March 2016 is very long time! And solution can't be buy pro to get the beta...

    I don't know why is the problem with this, but this kind of management is not what I expect as a user.
     
  25. Boris-S

    Boris-S

    Joined:
    Jan 23, 2013
    Posts:
    23
    So, currently there is no correct way to get baked lighting on static objects along with dynamic lighting and shadows for non-static objects, right? I am not sure I know everything about the problem and is in touch with latest updates, so please confirm that or correct me if needed.
     
  26. Hjeldnes

    Hjeldnes

    Joined:
    Jul 22, 2012
    Posts:
    113
    That is correct, but I read somewhere that mixed lights should arrive with 5.4 beta 1. Which is very soon I guess. So at least it can be tested and verified.
     
  27. frankrs

    frankrs

    Joined:
    Aug 29, 2009
    Posts:
    298
    when will be 5.4? I read somewhere March? Is that info correct?
     
  28. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    27,966
  29. frankrs

    frankrs

    Joined:
    Aug 29, 2009
    Posts:
    298
    "GI: Fallback from Deferred to Forward when rendering lightmapped objects with mixed-mode lights. Will be fixed later by introduction of baked shadow mask for lightmapped objects."

    So does this mean the lighting of mixed lights was fixed in 5.4 beta or are there still issues with it?
     
  30. sgtkoolaid

    sgtkoolaid

    Joined:
    May 11, 2010
    Posts:
    882
    I am getting this error over and over whenever I run my game in the editor.

    light.insideShadowRange
    UnityEditor.DockArea:OnGUI()

    thoughts?
     
  31. Tinovdk

    Tinovdk

    Joined:
    Nov 28, 2013
    Posts:
    81
    From what it says it seems to be a problem with the Unity Editor when it's drawn. Try resetting your Unity editor layout or close windows until the problem disappears. Perhaps then you will know which window is throwing this error. If you can replicate this issue in a new project then you can send it in using the Bug Reporter so that Unity can fix it for you.
     
  32. seansteezy

    seansteezy

    Joined:
    Nov 28, 2013
    Posts:
    115
    Use a buttload of light probes too!
     
  33. Boris-S

    Boris-S

    Joined:
    Jan 23, 2013
    Posts:
    23
    Any changes about mixed lights? I have tried Unity 5.3 and mixed lighting is still not work as expected. Is fix of this delayed to 5.4? Please clarify.
     
  34. moco2k

    moco2k

    Joined:
    Apr 29, 2015
    Posts:
    294
    Has anyone already downloaded Unity 5.4 BETA and tested if mixed mode works as expected here?

    At least the official roadmap does not include any information if mixed mode is planned to be fixed for 5.4. So, is this something we can expect for June 2016, or not?

    And, what about games that cannot make use of directional lights and thus need to use point lights and area lights, like FPS games in dungeons with many torches? Can we expect to have working mixed mode for point lights as well? At least, it should be clearly documented and communicated what is actually planned here.

    At this time, the official docs still seem to be wrong and misleading about mixed mode:

    "Selecting the ‘Mixed’ baking mode, GameObjects marked as static will still include this light in their Baked GI lightmaps. However, unlike lights marked as ‘Baked’, Mixed lights will still contribute realtime, direct light to non-static GameObjects within your scene. This can be useful in cases where you are using lightmaps in your static environment, but you still want a character to use these same lights to cast realtime shadows onto lightmapped geometry."

    Of course, this is exactly how we would like it to work, but currently this functionality is not fully there. Thus, I suggest to correct the docs until mixed mode is actually working as intended.
     
    Last edited: Mar 23, 2016
    ArachnidAnimal likes this.
  35. Boris-S

    Boris-S

    Joined:
    Jan 23, 2013
    Posts:
    23
    It works, but not as expected :D Shadows is almost transparent and I can not find a way to make it stronger, when in Directional lightmapping mode it works fine. Looks like a bug...
     
  36. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,670
    If you feel that you've discovered a bug, please please report it. And please include a good reproduction on the issue!
     
    lermy3d likes this.
  37. Hjeldnes

    Hjeldnes

    Joined:
    Jul 22, 2012
    Posts:
    113
    @Adam Buckner @KEngelstoft
    Don't you guys already have tons of bugs on mixed lighting? There are lots of long threads about it on this forum. It has not worked at all in 5.x, and surely you must know this? I've been hearing "fixed soon" since early 2015.

    This is one of the responses we got in March 11 2015:
    "

    Hi! We are aware of the current issues with mixed mode lighting and will be working on fixing it soon. It is not a trivial thing to get working across the full deferred, the (Legacy) light pre-pass deferred and the forward renderer, but we will fix it for sure. It was deemed to risky to include in the newly released final 5.0 version because touching a lot of code late in the beta is not a good thing for stability.
    Several bugs have been logged on it already, so you don't have to file more."


    So yeah...It's not necessarily the fault of the coders. They don't decide when things are to be fixed, but this is ridiculous. Had it been a minor bug, ok..but this is a game breaker.
    I would really like to hear what the status is. Do you guys know what the problem is and do you have a clear idea of how mixed lights should work?
    To be able to combine baked lighting with real time lighting, it's such an important feature and I would really like to hear what the plan is. Or if you are thinking of an alternative. Don't say it's going to be fixed soon if it won't.

    Making games is much easier if you know a feature you depended on will not be there anymore.
    Then you can at least decide to invest time develop a replacement for it, instead of waiting for the next 5.x version and hoping it's fixed.

    Please respond to this unity guys. Do some checkup on this task, and give us some info.

    Thanks

    Kjetil
     
    Tinovdk and Arganth like this.
  38. vkidd

    vkidd

    Joined:
    Aug 18, 2012
    Posts:
    4
    Agreed, this is essentially a regression for any game upgrading from 4.x to 5.x. For now it seems my only option is to rethink my scene lighting solution in 5.
     
  39. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,713
    The only solution I can do right now is to completely elliminate baked GI from areas of the scene which I would like realtime shadows from dynamic objects. Its unfourtunate because baked shadows can look better than realtime shadows in certain situations.
    I mean Unreal/Lightmass have got this working, so it is definately possible for Unity/Elighten to implement this.
    Personally I think what is going to happen in the future is the need for baked GI will be elliminated all together, and the focus will be only on realtime GI. I could be wrong, but this is the suspicion I get. And from what I can gather the mixed will only be supported for directional lights, which is useless for lighting indoor scenes. Someon let me know if i''m wrong here.
     
  40. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,320
    We will keep supporting fully baked lights, we don't see them going away anytime soon.
    As for the mixed mode lighting, we kept fixing bugs and new ones popped up so we went back to the drawing board and now we have a small strike team focusing on getting all the different lighting modes to work together consistently. It is coming along nicely but no ETA on when it is ready.
     
    Gekigengar, Martin_H, Tinovdk and 2 others like this.
  41. Hjeldnes

    Hjeldnes

    Joined:
    Jul 22, 2012
    Posts:
    113
    @KEngelstoft Okay, it's very nice to get an update.Thanks! And good to hear you will support baked lights. Do you plan to only support directional, or will there be mixed mode on point&spots as well? How do you see this working in practice? What are the limitations?
     
    ArachnidAnimal likes this.
  42. Tinovdk

    Tinovdk

    Joined:
    Nov 28, 2013
    Posts:
    81
    Thank you for the update @KEngelstoft! It's sad that light baking in Unity 5 has been so rocky and I appreciate the renewed commitment towards quality and stability. It would be nice to have a version of Unity with features that are reliable again. :)
     
  43. reset

    reset

    Joined:
    May 22, 2009
    Posts:
    393
    Hi

    On the topic of lighting large scenes ...

    I have one directional light (sun) over a moderately large suburb.

    I want to have mountains in the background - meshes - and when they are enabled my shadow map becomes unstable on my main character at the center of the scene.

    I have tried everything to exclude them from being lit by/cast shadows from the sun - using a culling mask - and tried an unlit color shader etc - nothing works.

    Their presence - even if not affected by the sunlight - screws with the quality of my shadow map.

    Any hits?

    thanks
     
  44. amiel_ace

    amiel_ace

    Joined:
    Oct 25, 2014
    Posts:
    10
    and after one year...
     
    gregroberts likes this.
  45. djweinbaum

    djweinbaum

    Joined:
    Nov 3, 2013
    Posts:
    530
    As someone who has been working on what is essentially one large scene for the last 2.5 years, my solution was to give up on Unity's light baking entirely. I bake my own light in the vertices of each mesh in my 3d package.
     
  46. jjejj87

    jjejj87

    Joined:
    Feb 2, 2013
    Posts:
    656
    This is unbelievable...still not fixed...

    Please fix the Mixed Mode Lighting...

    What's the point of having all this GI stuff if it doens't work out of the box.
     
  47. Nevermind

    Nevermind

    Joined:
    Jun 10, 2010
    Posts:
    66
    So I've just checked with latest beta (5.4.0b22) and mixed directional light DOES cast realtime shadows on static geometry, yay! For some reason I can't see realtime shadows in scene view (even with realtime lights), but in-game shadows work as expected.
     
  48. rubiez64

    rubiez64

    Joined:
    Jul 25, 2016
    Posts:
    25
    any news on the mixed mode of point light and spot light?

    I've been following this thread for some time and its pretty quiet lately.
     
  49. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,677
unityunity