Course contentsShow
← Unity Game Development
Lesson 597 of 8289. Rendering and VisualsFree lesson

Understanding the Physics of Light Interaction

Analyze how light reflects, refracts, and scatters off surfaces to establish the fundamental principles of energy conservation in digital materials.

In this lesson, you will learn how energy conservation dictates the behavior of light as it hits a surface, allowing you to create physically accurate materials in Unity.

The Physics of Light Interaction

When a photon strikes a surface in your scene, it doesn't simply disappear; it must obey the law of Energy Conservation. In digital rendering, this means the light hitting a surface must be reflected, refracted, or absorbed (scattered as heat). If a material reflects 100% of the light, it is a perfect mirror; if it absorbs all light, it is perfectly black.

The Three Pillars of Interaction

  1. Reflection: This occurs at the interface of two media. In Unity’s PBR (Physically Based Rendering) pipeline, we define this via Smoothness and Metallic maps. A smooth surface results in sharp, specular highlights, while a rough surface scatters the reflected light in many directions (diffuse reflection).
  2. Refraction: When light passes through a transparent or translucent medium (like glass or water), it changes speed and direction. This is governed by the Index of Refraction (IOR). In Unity, you achieve this using materials with Transparent surfaces that utilize grab-passes or screen-space refraction to distort what is behind the object.
  3. Scattering: Light that penetrates a surface but is dispersed internally—common in skin, wax, or leaves—is known as Subsurface Scattering (SSS). While standard shaders focus on surface-level interaction, SSS simulates the "glow" of light traveling through a volume before exiting.

Energy Conservation in Practice

Unity’s Standard Shader and HDRP/URP Lit shaders are built to enforce energy conservation automatically. A core rule to remember is that the sum of reflected, refracted, and scattered light cannot exceed the incoming energy.

If you create a custom shader, you must ensure your logic balances these outputs. For example, if you increase the Metallic value (increasing reflection), the shader must darken the Albedo (base color) to compensate. If it didn't, the material would appear to "emit" more light than it receives, creating an artificial, "glowing" look that breaks visual realism.

Key Takeaway: To achieve physical realism, ensure your material properties balance reflection and absorption so that the total energy exiting the surface never exceeds the energy that hit it.