Search Unity

Need help setting up lighting

Discussion in 'General Graphics' started by The_Unknown_Dev, Sep 18, 2016.

  1. The_Unknown_Dev

    The_Unknown_Dev

    Joined:
    Sep 18, 2016
    Posts:
    23
    Hello.
    Made an account to try and get some help from the community when it comes to setting up proper lighting.
    I'm bad at level designing so i'm very confused about what i should do to achieve this.
    What i need is day/night cycle, I already made a code to handle this. However, even though the directional light is set to realtime lighting, and Lighting settings don't have Baked Lighting checked, the scene still does not become dark after the directional light is rotated under the world. The skybox does become dark though. I have to press "Build" every time so the scene actually applies, but why? Isn't it supposed to be realtime ?
    I also have no idea how to make certain places dark, like example if I enter, i don't know, a shack for example. I want it to be pitch black inside, but the directional light seems to light it inside even if it's supposed to be completely isloated from sun's light. So can anyone direct me in what i need, and what i need to do?
    Thanks in advance.
     
  2. DroidifyDevs

    DroidifyDevs

    Joined:
    Jun 24, 2015
    Posts:
    1,724
    First, make sure your light is casting shadows. Rotating the directional light is only going to change your shadow directions, and will NOT simulate the earth going around the sun. I recommend lowering the intensity of the light to achieve a night-time effect.

    Also, screenshots would be helpful :)
     
  3. The_Unknown_Dev

    The_Unknown_Dev

    Joined:
    Sep 18, 2016
    Posts:
    23
    There was something wrong in my main scene that i developed my game in. It was just overfilled with all kinds of things, months and months of development, and i gave up on it(gave up on that scene). Made a new scene, but it seems that reflections are ruining everything. I will need reflections of course, but why do they ruin the scene so much?
    Here i'll show the screenshots, but this however is with baked GI, and i don't think that will work in my case since i'll have day/night cycle? I have no idea haha, I just honestly have no idea. This is why i came here, I need to exactly know what settings i need to use, and what i need to do in my day/night cycling process in order to do this the correct way. I really want to get the best out of it, I need beautiful lighting, it's part of the whole idea of the game i'm creating. So here, i built this prototype scene, and these are the differences:

    https://s16.postimg.org/lv7r80kid/diff.png

    Also, rotating directional light/sun's light source under the world (simulating night) seems to give the correct night effect even with baked GI but without reflections only, but i still have to ask if that's a good idea to have baked GI for day/night cycles?

    Note: all that was changed on these screenshots is the Reflection Intensity in the lighting settings only.

    Edit: Strange. Disabling baked GI and rebuilding makes no difference (or maybe there is but i just didn't see it in this scene).

    Edit 2: Okay changing my directional light Baking setting to Mixed with Baked GI enabled seemed to "make a difference". The scene took some time to rebuild. But I do not see any difference at all, I don't think it's even worth it for most games. So alright, i figured out it's not for me and my case, i'll disable it (the baked GI).
     
    Last edited: Sep 18, 2016
  4. The_Unknown_Dev

    The_Unknown_Dev

    Joined:
    Sep 18, 2016
    Posts:
    23
    Alright so this is where the problem I was expecting occurs. Look how incorrect the roof surface of this room i made looks when i have my reflections intensity on 0, and look how correct it looks when i have the intensity on 1:


    The silver ball also helps seeing the difference...

    And when i have no reflections, this also happens:

    Look how dark the side of the room looks like...

    So yeah. Only the actual interior of this room looks nice without reflections(i showed the screenshot in the previous reply), while surfaces that are extra exposed to sunlight look sooo bad. I have no idea what to do. I need reflections but they ruin the interiors.
     
  5. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,797
    If you want day night cycles, you need to use realtime (precompute) GI. And also for "proper" reflections, you need to set up reflection probes. Otherwise they reflect the skybox, no matter where they are.

    Seriously, read the manual. For all its faults, it's pretty decent at explaining these things.
     
  6. The_Unknown_Dev

    The_Unknown_Dev

    Joined:
    Sep 18, 2016
    Posts:
    23
    The manual will not help me get the effect... Not to be rude but at least try to read the post and the update reply properly. Adding a reflection probe seemed to just make things worse. Now even when i turn the reflection intensity up, it's like it's still 0. Here:

    And even if i got the probe working properly, i don't see how it will fix it so the interiors stay realistically lit while the reflection intensity is high.
     
  7. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,797
    Well, in an a very dark interior (I notice you don't have any form of GI in what you are showing me in your last post), reflections don't have much to reflect do they?

    So you tried precompute(realtime) GI, and placed reflection probes and you still don't like the results? Why?
     
    DroidifyDevs likes this.
  8. The_Unknown_Dev

    The_Unknown_Dev

    Joined:
    Sep 18, 2016
    Posts:
    23
    Because how would I? Isn't the silver ball supposed to be collecting skybox reflection when it's on the roof of the room? And the way roof is lit just looks incorrect. It should have slight reflections from the sky, but it doesn't.

    Edit: Not to mention how the probe also made the interior look more unrealistic too
    Edit 2: Or i don't know, maybe it's more realistic. But none of this changes the fact the roof is just not right.

    Edit 3: Here's the screenshot of how the interior looks like with the reflection probe:


    I don't know if that looks correct, but i'm fine with that. The problem is the roof now, and the silver ball, why is it not collecting the skybox reflection?


    Edit 4: ... Aaand also when I set up the night, the reflection is still there, and makes the interior lit...
     
    Last edited: Sep 18, 2016
  9. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,797
    Place a second probe for the roof then?

    gi.jpg
     
  10. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,797
    Did you set it to realtime? You should if you want the lighting to change so dramatically. All of this is info that is in the docs.
     
  11. The_Unknown_Dev

    The_Unknown_Dev

    Joined:
    Sep 18, 2016
    Posts:
    23
    Hmm thanks that fixed the problem. I hope admins are fine with this post being continuous, I'm not over I have more questions. Now, let's say i have for example a big map with a city in it, tons of building and each have their interiors and everything. How would I correctly organize my light probes, how many do i need?
     
  12. The_Unknown_Dev

    The_Unknown_Dev

    Joined:
    Sep 18, 2016
    Posts:
    23
    And yes the probes are set to realtime, however when the directional light is rotated under, the reflections stay... A bug?
     
  13. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,797
    That's a question of a much much bigger scope and I've never done anything that big, so I can't exactly guess where the bottlenecks will be.

    But, you would place as many as it makes sense, you will have active only those that are visible and near the player, you will probably need to update them via script when your lighting changes dramatically (some info here : https://docs.unity3d.com/Manual/RefProbePerformance.html ), so that they don't update all the time...

    And getting precompute GI to work will be a challenge on a big scene.
     
  14. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,797
    Tweak the settings of the reflection probe (try lowering the blend distance and then tweak the shape of the box a bit).
     
  15. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,797
  16. The_Unknown_Dev

    The_Unknown_Dev

    Joined:
    Sep 18, 2016
    Posts:
    23
    I hate how it never looks like that good whenever i try to make a simple scene haha. I have no idea as of why... That gif looks absolutely gorgeous even though it's so simple. And i can't get the reflection probes to work with the cycle, they still act like they're baked...
     
  17. The_Unknown_Dev

    The_Unknown_Dev

    Joined:
    Sep 18, 2016
    Posts:
    23
    Okay, next to this problem with it acting like it's baked, there's another problem. In the interior, i made a room that is completely isolated from all the light. However, the reflections still make it lit, while by the logic, it should be pitch dark, look:


    And this is how it looks like when i get rid of the reflection probes and turn the reflection intensity to high:


    So yeah... I don't know if these are bugs really, but it's just frustrating. Can you send your project, or is there something simillar or asset store or something. A ready scene like that. I just want to make sure if it's me or unity making the mistake.

    Note: I will go to sleep now so i won't be able to reply instantly.
     
  18. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,797
    It's not a bug. Play with the reflection probes borders and placement. Try lowering its blend distance to 0.
     
  19. The_Unknown_Dev

    The_Unknown_Dev

    Joined:
    Sep 18, 2016
    Posts:
    23
    There isn't really a "blend distance" parameter

    Edit1: Okay and let's say i got the reflection probe working and the cycle works (it doesn't but let's say it does). How can mine compare to your beautiful scene? Just look at your gif and look at my scene:

    That looks like a 15 years old engine compared to a modern engine... And you did nothing in the scene, you just made a room and placed 2 blocks inside it. I'm absolutely unsatisfied, something's wrong and i'm not seeing what it is. Not to mention how the room that's isolated from light is still lit because of the reflection probe...

    Edit 2: Okay the reflection probes work properly in playtime. They didn't work in the scene view when i rotated the sun though, they just kept reflecting when there's no light. But i don't mind that it's probably supposed to be like that, what's important is the playtime.

    Edit 3: And wow I actually get 28 FPS on this scene with a sun rotating scrip... I mean the PC i'm currently stuck with is really bad, ultra low end, but that's still ridiculous.

    Edit 4: I still have problems with the isolated room. It still gets lit when there's no light reaching into it, the reflection probes do this to it.
     
    Last edited: Sep 18, 2016
  20. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,797
    blenddistance.jpg

    Also play a bit with the material settings and maybe the indirect intensity.

    I had the smoothness of the "room" material to be pretty high in mine and I also boosted the indirect intensity a bit. Other than that I didn't do anything special.
     
  21. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,797
    Realtime GI and realtime reflection probes are not low end features.
     
  22. The_Unknown_Dev

    The_Unknown_Dev

    Joined:
    Sep 18, 2016
    Posts:
    23
    Seems like i don't have that... What unity version are you using? I think i'm pretty outdated myself.


    Well they do work on low end though... But do you mean my machine won't be able to render it like you did on that .gif?
     
  23. DroidifyDevs

    DroidifyDevs

    Joined:
    Jun 24, 2015
    Posts:
    1,724
    What are the specs of your machine? Like CPU, RAM, GPU, OS etc...
     
  24. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,797
    5.4
     
  25. The_Unknown_Dev

    The_Unknown_Dev

    Joined:
    Sep 18, 2016
    Posts:
    23
    They're really bad, it's a temporary PC, mine needs yet to arrive. Um:
    RAM: 3GBs DDR2
    GPU: ATI Radeon HD 4650 (1GB)
    CPU: AMD Athlon 64 X2 4400+ (2.3Ghz)

    So is that the reason why it doesn't render nicely like @AcidArrow did?
     
  26. DroidifyDevs

    DroidifyDevs

    Joined:
    Jun 24, 2015
    Posts:
    1,724
    Pretty much any PC can render almost anything. Thing is, at how many FPS can you render? You might be able to render some amazing graphics like Fallout 4 at 2FPS. Yes, you might be able to do it, but the FPS will be way too low.

    So perhaps the low FPS is just due to your PC... I don't know much about AMD, but apparently that CPU compares to an Intel core duo 2 or a Pentium. Your graphics card compares to an Nvidia 9600. Considering that I can't find a New Nvidia 9600, and the used ones are $20, it is pretty bad. So don't be worried about 28FPS, as actually for that hardware it isn't bad at all. First try to get the effect you want, then you can always bake the lights and use Occlusion Culling to save performance.

    Did you try this: https://www.assetstore.unity3d.com/en/#!/content/33630

    Perhaps you could look into that project and learn something from there.
     
    theANMATOR2b likes this.
  27. The_Unknown_Dev

    The_Unknown_Dev

    Joined:
    Sep 18, 2016
    Posts:
    23
    Oh alright. I just wondered if unity has some kind of system to disable visual features if your PC is bad, guess not. And about the FPS yeah, i kinda figured it's just my PC. I still don't get why my scenes always turn out looking bad though, just not good enough, and i look at @AcidArrow 's scene and it's so simple but the lighting looks so beautiful and correct, like honestly what the hell am i doing wrong, i'm trying for hours here... I'll look into that demo scene, thanks.
     
  28. DroidifyDevs

    DroidifyDevs

    Joined:
    Jun 24, 2015
    Posts:
    1,724
    Actually, you can go to Preferences > Project Settings > Quality and then select your platform (Windows) and then choose a preset or lower the quality manually. Lowering the texture quality will probably be the best, but will make the materials look less crisp. However it shouldn't affect the lighting too much.

    https://docs.unity3d.com/Manual/class-QualitySettings.html

    Follow AcidArrow's advice, he's helped me before and he is just magic when it comes to graphics.
     
  29. The_Unknown_Dev

    The_Unknown_Dev

    Joined:
    Sep 18, 2016
    Posts:
    23
    I don't really care about the FPS, i just want to find the perfect lighting for the kind of scene/map i have for my game and work on that while i wait for my PC to arrive. I work on a high end PC usually. But yes i'm trying to follow what @AcidArrow is saying but i'm still struggling to find what i want.
     
    Last edited: Sep 20, 2016
  30. The_Unknown_Dev

    The_Unknown_Dev

    Joined:
    Sep 18, 2016
    Posts:
    23
    This is actually frustrating... I kept trying and the best i got is this:

    Edit: I changed the blend distance of the reflection probe to 0 as @AcidArrow said

    Edit 2: Also this is how it lits when bounce intensity of directional light is only 1:
    (note: I did change the texture of the walls, and the material has no metalicness or smoothness)

    Does it look correct to you? Shouldn't it be more dark in the room?
     
    Last edited: Sep 20, 2016
  31. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,797
    It should.

    Are your walls completely white? They shouldn't. Especially in Linear, white materials tend to bounce light around too much (and they should, they are completely white, right?). Try a grey.

    Is your project on Deferred/Linear? Are you using 5.4?
     
    DroidifyDevs likes this.
  32. The_Unknown_Dev

    The_Unknown_Dev

    Joined:
    Sep 18, 2016
    Posts:
    23
    Okay yes, the gray made it look more dark, thanks for putting that out i obviously don't know how lighting works even in real life.
    I use linear color space, deffered rendering path. If you have time, what do you recommend for the kind of scene i want (which rendering path and which color space)? I have more questions, what do you think are ideal settings for everything with the kind of scene which is basically a huge map with multiple cities and nature, considering the night cycle is in aswell. And what do i need to do in order to make it as perfect as possible. I would like the visuals to go as close as possible to the game called "miscreated", i really liked what they did there (and yes i know it's hardly even possible in unity especially for someone that doesn't know anything about visuals in unity, but i obviously want to try and work hard on it and make it as close as possible, not exac same).

    Edit 1: I use 5.3.4 version. Should i update it for better results?

    Edit 2: And any idea what are these marks here?

    link: http://s12.postimg.org/ml3tim3fh/spots.png
     
    Last edited: Sep 20, 2016
  33. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,797
    Definitely stick to Linear.

    I really can't tell you. I can give you advice for setting up a room, but scaling that to multiple cities is multiple upward leaps in order of magnitude in complexity. I call definitely tell you you won't be able to achieve the high resolution precompute lighting we are doing in these tests, if at all.
    AFAIK Miscreated used either no GI at all (just ambient light and SSAO on top), or you could enable some SVOGI like tech, which is something similar to SEGI for Unity (which is a great asset, but it's in beta and is really not performing well enough to be put in a game (yet?)).
    Those marks are an artifact that results from the RGBM encoding that is done to the lighting data. It's going to be change in 5.5 or 5.6 AFAIK. There isn't anything you can do about it now. The only workaround that might work is slightly overlighting everything and then bringing the range you want back with tonemapping.
     
  34. The_Unknown_Dev

    The_Unknown_Dev

    Joined:
    Sep 18, 2016
    Posts:
    23
    Thanks for the answers, really appriciate it. I guess i have the last one: what's the best i can do about such a big map/scene? You think the current settings will be too much? But what do I do then? Damn. (Also, i wouldn't go for unstable assets. If there's good ones that are stable i will probably buy them, let me know)
     
  35. DroidifyDevs

    DroidifyDevs

    Joined:
    Jun 24, 2015
    Posts:
    1,724
    Well, how many FPS are you getting now on your much-less-than-ideal PC? You can always have settings toggles for different powered devices.
     
  36. The_Unknown_Dev

    The_Unknown_Dev

    Joined:
    Sep 18, 2016
    Posts:
    23
    Around 28, but as i said before I don't care about older devices. The game spec requirements can go high, i just want to get the perfect lighting. The question is:

    Also @AcidArrow , any idea how did @jdraper3 achieve such lighting here?

    Anything too special? Or it's the image effects that helped heavly here.
     
    Last edited: Sep 20, 2016
  37. DroidifyDevs

    DroidifyDevs

    Joined:
    Jun 24, 2015
    Posts:
    1,724
    Well, you're doing really well. Note that most games do have graphics quality settings, so if it runs at 28 on "max" settings on your old PC, it should run great on other people's PC's.

    As for the attachments, in the first one there is a LOT of camera effects going on there. The rain was probably achieved with particle systems. The second one probably also has camera effects, along with rays.

    The particle system in Unity is super cool, try some assets from the asset store to see what I mean. Here's my favorites; they're all free:
    https://www.assetstore.unity3d.com/en/#!/content/11158
    https://www.assetstore.unity3d.com/en/#!/content/42866
    https://www.assetstore.unity3d.com/en/#!/content/1
     
  38. The_Unknown_Dev

    The_Unknown_Dev

    Joined:
    Sep 18, 2016
    Posts:
    23
    Okay thanks. But i don't know if i understood @AcidArrow correctly but he said here:


    So i'm not really doing good am I? The actual scene i need the lighting for is a different story, the test scenes i showed were just... test scenes. I don't know if he ment that this low end PC won't be able to do it, or in general i won't be able to achieve it even on a high end PC.
     
  39. DroidifyDevs

    DroidifyDevs

    Joined:
    Jun 24, 2015
    Posts:
    1,724
    Well, you are trying to achieve *maximum* quality. Truth is, even in the highest-budget games such as Fallout 4, GTA5 etc... the quality is ALWAYS sacrificed somewhere to keep performance acceptable. You simply have to create a scene that you'll use in your game and experiment with what looks best while keeping performance acceptable. Your low-power PC isn't helping as you can't tell what a decent PC can render.

    What I'm trying to say is that it is possible to create 100% realistic HD amazing graphics, but you need to take into account your game's performance. You need to test with your actual scenes.
     
  40. The_Unknown_Dev

    The_Unknown_Dev

    Joined:
    Sep 18, 2016
    Posts:
    23
    Okay i understand. Well yeah i guess it's pointless to guess from here. I should work on graphics once I have the scene ready and mapped, and also my PC that can actually handle it. I guess that's it, thanks for all the help, much appriciated.
     
  41. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,797
    I believe it's mostly because of the volumetric light post process filters he/she used.

    Both? Enlighten isn't great at doing precompute for large scenes, so there's simply the chance that it might not even finish baking, but it might also become pretty expensive at runtime, which might make your game unbearably slow.

    But these are things that you'll find out for sure once you have a large-ish enough scene in at least a half finished state.

    All I'm trying to point out, is figuring out something that works nicely for a room with a bunch of boxes, tells us nothing about whether it's viable in a huge scene.
     
    DroidifyDevs likes this.
  42. DroidifyDevs

    DroidifyDevs

    Joined:
    Jun 24, 2015
    Posts:
    1,724
    Exactly. That's why I said that he needs to test in his actual scene. Baking fancy lights in a room with boxes is cute, but not really helpful.
     
  43. The_Unknown_Dev

    The_Unknown_Dev

    Joined:
    Sep 18, 2016
    Posts:
    23
    Well okay. Unity isn't very powerful with visuals afterall. I saw unreal and cryengine do better lighting even on big scenes than unity does on SMALL scenes. Kinda disappointed but yeah, nothing i can do. Thanks again man, and @DroidifyDevs
     
  44. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,797
    That's a generalization. CryEngine has SVOGI of course, which is great for what you're going for, but I'd argue that Unreal's LPV looks worse than Enlighten.

    Dynamic GI is a rather different beast than traditional static lightmaps that we are used to seeing in games.
     
    DroidifyDevs likes this.
  45. DroidifyDevs

    DroidifyDevs

    Joined:
    Jun 24, 2015
    Posts:
    1,724
    Different game engines produce different results. Some are better for certain projects than others. While Unreal does have a very impressive lighting system, it doesn't achieve very realistic results. I'd say CryEngine is Unity's closest competitor. However I've only developed with Unity (as I don't have much time since gave development is my hobby). I can't wait for the PowerVR lighting engine to come to Unity.

    Take a look at Unity's Adam or Blacksmith demos. Can't say that Unity does a bad job on lighting. Note that the rendering is real-time.





    So yeah, Unity can do pretty much just as well as other game engines in lighting.
     
  46. The_Unknown_Dev

    The_Unknown_Dev

    Joined:
    Sep 18, 2016
    Posts:
    23
    Yes it can but not on bigger maps. I saw those yeah.


    I see