Light sources are objects that are typically thought to emit light from their internals. However, in terms of programming, light leaves a surface from one of two fundamental processes – self-emission and reflection. Generally, any object has an illuminative function that is determined by several variables (Angel and Shreiner, 2022). The surface points – x, y, and z, signify the objects place in a three-dimension environment. The direction of the emission is characterized by two variables, θ, and φ. These variables are the degrees between the direction of light and the x, y, and z axes. Lastly, the intensity of the light emitted is the λ variable. Objects both emit and reflect light from their environment, and one of these aspects will be covered in this essay.
When modeling a room that is supposed to be evenly lit, programmers use ambient light to conserve resources. Modeling each light source and its reflection from the environment would be very inefficient. Instead, setting an ambient intensity, Ia, in certain strategic places along the surface would be far more suitable for the graphics system. An example of ambient lighting would be sunlight because it is uniformly spread out and affects all the objects outside. Regardless of where the object is, ambient lighting sets a certain intensity to it.
The light has red, green, and blue color components that are represented by Iar, Iag, and Iab. For example, to create red ambient light, the color components must be set at 1.0, 0.1, and 0.1 (Sonar Systems, 2021). The light reflected from every surface will vary, even though it receives the same illumination from the source. Ambient lighting set on the object will illuminate it, regardless of the angle or positioning.
References
Sonar Systems. (2021). Ambient Lighting – WebGL Programming [Video]. YouTube.
Angel, E., & Shreiner, D. (2022). Interactive Computer Graphics: A Top-Down Approach with WebGL. (7th ed.). Pearson Education Inc.