# Formula for the ambient light intensity of a scene?

I understand that ambient light is light that occurs a result of light from a given source refecting off an infinite number of points in a scene, thereby illuminating all objects in the scene uniformly and explains why areas not directly illuminated by a light source in a scene aren't pitch black.

So I guess ambient light gives everything in the scene the same basic "brightness". But how does one determine this value? I presume the ambient light is proportional to the primary light source intensity (a floodlight in a bedroom will surely produce more ambient light than a lit match in the same room) and inversely proportional to the scene size (a lamp in a closet surely produces more ambient light than a lamp in a hall). Is there a formula that gives ambient light "brightness" as a function of scene volume, light source intensity, and any other variables please?

Please excuse my naivety, as I'm a noob to computer graphics, and only a hobbyist at that.

The formula you are seeking (and implying with the examples of a match and a lamp) is really a Radiosity formula - at which point we have to stop using the term "ambient light", as with Radiosity, everything (light source and surfaces of all scene objects including) is just energy, only converted to the monitor's RGB values at the last [rendering] stage.

As a 10,000 ft overview, during radiosity, you break up all polygons into patches, and it's the FormFactor portion of the formula that takes care of how much energy of the current patch ends up at the target patch.

Going back to your examples - a match will have different amount of starting energy than a lamp. Also, the distance from the light source to the closet walls vs hall walls will ensure a drastically different amount of energy arriving at those patches (due to the distance falloff).

Using an 'ambient light' term in your lighting calculations is an approximation of the indirect light reflected around the scene. Usually it's up to the artist to choose an appropriate value. There isn't really a formula, because the indirect light is dependent on many factors:

• Light intensity
• Light shape
• The BRDFs of the surfaces the light will bounce off of
• Visibility to the light source (Think the back of a deep cave)
• etc.

You could use some kind of formula to get an approximate value, based on these factors, but, in my opinion, it's simpler just to do it manually per scene. Or, you can remove it entirely, and use more sophisticated methods to calculate indirect lighting.

The "Ambient" term more accurately is described as the light emitted by the object itself. While it's not wrong to see it as a constant which approximates indirect lighting, it's still more accurate to call it the former, especially for the thinking process.

As such, the answer depends on your scene. Considering that all objects emit their own "light", there is no way to manually set a global ambient term without sacrificing image quality, as no object will be equally shaded compared to the next one. That causes the brain to perceive it as "wrong looking".

So, there is no formula for ambient, because ambient in the way it has been introduced a few decades ago has no basis in reality. The values are set based on the scenes, to make sure they look "good enough".

Indirect light though, as found in modern graphics engines, can be calculated on the fly and removes the need for a manually set ambient term completely.

In short: For "ambient" they guess, for "indirect light" they calculate.