Overview
Lighting is an important factor to consider while rendering realistic 3D shapes. The following discusses adapting lighting conditions while rendering 3D images.
Details
According to physics, visible light is made up of a band of different wavelengths. Each segment has a designated color that human eye can detect.
When light is shone on an object, it absorbs some wavelengths and reflects some giving out the color based on the material property of the object.
The reflection is different based on its proximity to the light source and the angle between its position and the light source. Therefore light calculations should factor these.
The calculations primarily considers three kinds of light sources.
Ambient
Ambient light means that light always existed in absence of a light source. Imagine a unlit room next to the street where light is coming in from a street lamp through the window bouncing off the walls onto curtains, furniture etc. It's dark, yet curtains, furnitures etc are visible albeit not clearly.
This pictorially represented as below
I = Ka × ∑ Ia
Ka is the ambient reflection intensity of the material that ranges from 0 to 1. Higher the value stronger is the reflection.
Ia is global of the ambient reflection intensity of the individual light source.
Example:
Here the 3rd image shows ambient lighting of the the back face of the sphere where lighting is same everywhere.
Diffused light means that directional light that is reflected equally irrespective of user view point. The effectiveness of the reflection depends on the angle of incidence and the surface normal. In other words, the cross product of both. The lesser the value, higher is the reflection.
This pictorially represented as below. θ represents the cross product between light incidence and the surface normal.
To calculate the amount of diffuse reflection (I) on a surface, the formula below is used.
I = Kd Ip(n.L)
Kd is the surface diffuse reflection intensity of the material that ranges from 0 to 1. Higher the value stronger is the reflection.
Ia is the diffuse reflection intensity of the light source.
n.L is the cross product of the surface normal n and light incident on the surface.
Example:
Here the 3rd image represents the back face of the sphere where lighting is poor because of angle of incidence.
The 4th image combines both ambient and diffuse lighting highlighting the curvature.
Specular Light
Specular light applies to smooth and polished surfaces that readily reflect light. When light hits the shiny surface it forms bright highlights.Here the reflection is targeted and is perpendicular to the angle of incidence in the opposite direction. A viewer can see only if in exactly the right position, somewhere along the path of the reflection.
Specular reflection from a very shiny surface produces very narrow cones of reflected light;
specular highlights on such a material are small and sharp. A duller surface will produce wider
cones of reflected light.