- Real-Time 3D Graphics with WebGL 2
- Farhad Ghayour Diego Cantor
- 196字
- 2021-06-10 19:43:02
Positional Versus Directional Lights
Light sources can be positional or directional. A light source is called positional when its location will affect how the scene is lit. For instance, a lamp inside a room is a positional light source. Objects far from the lamp will receive very little light and may even appear obscure. In contrast, directional lights are lights that produce the same luminous result, regardless of their position. For example, the light from the sun will illuminate all objects in a terrestrial scene, regardless of their distance from the sun. This is because the sun is so far away that all light rays are considered parallel when they intersect the surface of an object. Directional lighting assumes that the light is coming uniformly from one direction:
A positional light is modeled by a point in space, while a directional light is modeled with a vector that indicates its direction. It is common to use a normalized vector for this purpose, given that this simplifies mathematical operations. Also, it is generally the case that computing directional lighting is actually simpler and less computationally expensive than positional lighting.