4

I am just getting into lighting with Unity 3d and right now have a function that progressively deepens the lighting of my scene here. I have done this via Render Settings and have tried 3 different approaches with lighting, I have received the same result with all of them:

                RenderSettings.ambientLight = Color.Lerp (RenderSettings.ambientLight, colors2 [currentColor], changeTime * Time.deltaTime);
                RenderSettings.ambientSkyColor = Color.Lerp (RenderSettings.ambientSkyColor, colors [currentColor], changeTime * Time.deltaTime);
                RenderSettings.ambientGroundColor = Color.Lerp (RenderSettings.ambientGroundColor, colors2[currentColor], changeTime*Time.deltaTime);

I am not entirely understanding the difference between all of these and am having a problem lighting the world - when the color changes, the color of the sky AND the ground (which has the same material as other game object blocks that are sitting on top of it) change in accordance with the lighting. I.e my white ground goes orange.

The problem is that the blocks on top of my ground (same material with standard shader) are not affected/lit to the same degree. They remain generally white/unaffected while my ground is all the way orange. No matter if I'm changing ambientGroundColor or SkyColor this happens.

How can I light the whole scene evenly? What is going wrong here?

Problem:

enter image description here

blue
  • 7,175
  • 16
  • 81
  • 179
  • 1
    I'm waiting to see an answer for this, too. Lighting in Unity has been, by far, my biggest hurdle. Much of it doesn't seem rooted in any logic that I can wrap my brain around. – Jesse Williams May 26 '16 at 20:51

1 Answers1

0

Unity implements a lighting system that usually combines real time and precomputed lighting. The ambient light you see affecting the ground is probably precomputed. However the blocks on top of the ground are not included in the precomputed lighting. So flagging these blocks as static will add them to the precomputed lighting but also makes them un-editable at run time. Check the link below for more info.

TL;DR:

Only static geometry is considered by Unity’s precomputed lighting solutions. To begin the lighting precompute process we need at least one GameObject marked as ‘static’ in our scene. This can either be done individually, or by shift-selecting multiple GameObjects from the hierarchy panel.

Quoted from the unity 5 documentation about lighting and rendering

Sander Saelmans
  • 831
  • 4
  • 13
  • Thank you but I don't think this is the problem - the floor was not marked static and I couldn't find a Gameobject that was. I then made the blocks and floor static with no difference. I added a picture to my question - Is there a way to just achieve even lighting or change JUST the color of the sky, not the objects beneath? I have my scene within a larger mesh by the way; does that make a difference? – blue May 27 '16 at 02:19