Game Development
Ambient and environment
Learn Window > Rendering > Environment Lighting settings.
Ambient light
Ambient light is indirect light that reaches everywhere in the scene at the same time. Even with no light source, objects do not look completely black; ambient light brightens them slightly. This setting is made in the Environment Lighting section of the Window > Rendering > Lighting window.
RenderSettings.ambientLight = Color.gray;
RenderSettings.ambientLight holds the color of the ambient light.
Skybox and Environment Lighting
A skybox is the texture that shows the sky and the far surroundings of the scene. When the skybox is chosen as the ambient source in the Environment Lighting section, the colors of the sky reflect into the scene as indirect light. If the sky is orange, the scene takes on a warm tone as well.
// Environment Lighting > Ambient Source > Skybox
This way, when the sky changes, the overall lighting of the scene changes too.
Exercise Choose the ambient source
In a class named OrtamIsigi, define a string kaynak field with the value "Color". In the Awake method, set the kaynak value to "Skybox". In the Start method, print the text "Ambient kaynagi: " joined with kaynak using Debug.Log.
Show example solution
using UnityEngine;
public class OrtamIsigi : MonoBehaviour
{
string kaynak = "Color";
void Awake()
{
kaynak = "Skybox";
}
void Start()
{
Debug.Log("Ambient kaynagi: " + kaynak);
}
}
Test yourself
-
Why does a scene with no light source at all not look completely black?
- Because ambient light slightly brightens the scene
- Because shadow resolution is low
- Because spot lights are cone shaped
- Because the skybox adds lights automatically
Show answer
Because ambient light slightly brightens the scene — Ambient light is indirect light spread over the whole scene; it keeps objects visible even without a light source.
-
Set the ambient light to gray
RenderSettings.ambientLight = Color.____;
Show answer
RenderSettings.ambientLight = Color.gray;
-
Ambient light terms
- Ambient ışık
- The indirect lighting of the scene
- Environment Lighting
- Ambient light settings section
- Skybox
- The texture that shows the sky
- Ambient Color
- The color of the indirect light
Next lesson: Baked vs realtime