Search Unity

Is ambient light a realtime light ?

Discussion in 'General Discussion' started by keshav2010, Apr 29, 2019.

  1. keshav2010

    keshav2010

    Joined:
    Jun 6, 2016
    Posts:
    34
    Hi, i was just wondering what category ambient light belong to, i have this gut feeling deep inside that it isn't realtime but i also resist to classify it as baked, a good technical explanation about ambient light with a little bit deep insight (or giving me reference to some book or article) on as to how gpu handles / implement it (non mathematical, just the pipeline and where exactly in the entire process ambient effect is implemented onto the scene)
     
  2. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,982
    Ambient is just an amount of light applied to everything. It is realtime in a sense, but really its just a scalar in most senses.

    Something like FinalLight = Diffuse * Specular * Ambient etc. It literally just acts as a scalar on the lighting equation
     
    keshav2010 likes this.
  3. keshav2010

    keshav2010

    Joined:
    Jun 6, 2016
    Posts:
    34
    Thanks for that scalar example, so basically it is best to think of it as just a sort of a scalar quantity that somehow contribute its value, btw it would be more helpful if you could also guide me to some specific book or article from where you gathered this knowledge about ambient light or lights in general. Thanks :)
     
  4. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    2,443
    Well, the word ambient means the general conditions surrounding something. The ambient temperature in your room is the general average value. I expect this ambient temperature is probably pretty comfortable, and there are maybe some hot spots (behind a refrigerator, next to a light bulb) and cool spots (a drafty corner of a window).

    When modeling a lighting situation, you usually know if the subject is in the atmosphere or near other objects. If you're deep in space, there should be almost no ambient light value, so anywhere that isn't lit by a nearby source of light should appear pretty deep black. If you're in a fog bank at noon, the sun is bouncing all kinds of light in every direction through the fog, so objects in that environment would be strongly lit with almost no shadows at all. Most scenes are somewhere in between, so shadows are still possible but they aren't pure black. Any light that comes from all directions is your ambient light.

    In a graphics scene based on physics, nothing out in the open should be darker than the ambient light level. "Ambient occlusion" is a bit of shadowing where the geometry of the object is hiding or occluding the ambient light from hitting it as much as it would on most other shapes. Take the interior of a cardboard box for instance... it is able to be darker than the ambient level because the light hitting it from all sides still can't get in from many angles.
     
    keshav2010 likes this.
  5. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,982
    Well its just general shading knowledge, thats how lighting is worked out (all the terms are multiplied together). If you go through the "rendering" series of catlike coding tutorials here:

    https://catlikecoding.com/unity/tutorials/rendering/

    You will learn all about it. It is probably overkill for working this out, its only useful if you want to learn more about rendering and shading
     
    Lurking-Ninja and keshav2010 like this.
  6. keshav2010

    keshav2010

    Joined:
    Jun 6, 2016
    Posts:
    34
    Thank you very much guys
     
    MadeFromPolygons likes this.
  7. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    - Ambient light is also an artistic approximation of bounced light for early 3d. Since in real life most object are lit through indirect light when in shadow (ie light bouncing off surfaces) they don't have pure black.

    - Early 3d (and even now) didn't have access to bounce light, so a way to represent that light was to "add" an "ambient" to shadow so they don't produce hard shadowed images and make them seems more natural, and it's super cheap for its effectiveness.

    - It's also a great way to control artificially atmosphere of a scene since no audiovisual creation actually use purely natural light "ie why you can see night and cave bathing in blue light in movie".
     
    MadeFromPolygons and keshav2010 like this.
  8. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,982
    You are most welcome!
     
  9. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    Just to be clear ambient lighting is not realtime for baked lighting. Here is one of my scenes were I have changed the color, it does not even contribute to dynamic objects since they read their info from the light probes which are baked

    upload_2019-5-2_9-28-28.png
     
    Joe-Censored and keshav2010 like this.
  10. DrakeClausen

    DrakeClausen

    Joined:
    Apr 24, 2022
    Posts:
    7
    Unity's ambient lighting that is controlled in the in the Lighting window on the Environment tab in the Environment Lighting section seems to function like this, if the object is marked as static the ambient lighting will be applied to it via baked lightmaps and if the object is not marked static the ambient lighting will be applied realtime.