The light component defines the entity as a source of light. Light affects all
materials that have not specified a flat shading model with shader: flat.
Note that lights are computationally expensive we should limit number of lights
in a scene.
By default, A-Frame scenes inject default lighting, an ambient light and a
directional light. These default lights are visible in the DOM with the
data-aframe-default-light attribute. Whenever we add any lights, A-Frame
removes the default lights from the scene.
Directional lights are like a light source that is infinitely far away, but shining
from a specific direction, like the sun. Thus, absolute position do not have an
effect on the intensity of the light on an entity. We can specify the direction
using the position component.
The example below creates a light source shining from the upper-left at a
45-degree angle. Note that because only the vector matters, position="-100 100
0" and position="-1 1 0" are the same.
Hemisphere lights are like an ambient light, but with two different colors, one
from above (color) and one from below (groundColor). This can be useful for
scenes with two distinct lighting colors (e.g., a grassy field under a gray
Point lights, unlike directional lights, are omni-directional and affect
materials depending on their position and distance. Point likes are like light
bulb. The closer the light bulb gets to an object, the greater the object is
Amount the light dims along the distance of the light.
Distance where intensity becomes 0. If distance is 0, then the point light does not decay with distance.
Spot lights are like point lights in the sense that they affect materials depending on its position and distance, but spot lights are not omni-directional. They mainly cast light in one direction, like the Bat-Signal.