Archived

This topic is now archived and is closed to further replies.

cowsarenotevil

Ambient light is a phony.

Recommended Posts

cowsarenotevil    3006
I''ve always wondered why it''s so commonly used, when it doesn''t acurately represent lighting. Is it because it''s a cheap way to brighten the whole scene? The only real use I can think of for it is emissive light sources. So, am I missing something, or is it not really an accurate description of real lighting?

Share this post


Link to post
Share on other sites
JohnBolton    1372
How do you light your scenes without using an ambient light? I assume the non-lit faces in your scenes completely black. That isn''t very accurate, unless you are in outer space.

Share this post


Link to post
Share on other sites
Sneftel    1788
Ambient lighting is used because it''s a hell of a lot cheaper than radiosity calculations.


How appropriate. You fight like a cow.

Share this post


Link to post
Share on other sites
It''s just to compensate for the small amounts of reflective and matte lighting that would occur naturally in most scenes. For example, a house at night is not completely dark and ambient lighting can add it.


Brian J
DL Vacuum - A media file organizer I made | MM

Share this post


Link to post
Share on other sites
jeeky    126
Pick a room in your house that does not appear to get any direct sunlight. A bathroom, bedroom with heavy curtains, or a room at the center of the house will probably work fine. Now, turn all of the lights off. In most cases, you will still be able to see (unless you picked a place with too little light such as a closet with door seals). Why is this?

Once you have answered that question, you have two options:
1-Simulate the real physics describing why there is still light in the room.
2-Approximate it using ambient lighting.

Trust me, #2 is easier.


[edited by - jeeky on September 2, 2003 8:22:31 PM]

Share this post


Link to post
Share on other sites
cowsarenotevil    3006
quote:
Original post by JohnBolton
How do you light your scenes without using an ambient light? I assume the non-lit faces in your scenes completely black. That isn''t very accurate, unless you are in outer space.



Try diffuse and specular lighting.

Share this post


Link to post
Share on other sites
quote:
Original post by cowsarenotevil
quote:
Original post by JohnBolton
How do you light your scenes without using an ambient light? I assume the non-lit faces in your scenes completely black. That isn''t very accurate, unless you are in outer space.



Try diffuse and specular lighting.


No thats what he''s trying to say! If there are no lights in a part of a scene, you just want them to be VERY dim, not black. Black is not natural due to the reasons stated above.

Share this post


Link to post
Share on other sites
quote:
Original post by cowsarenotevil
...still isn''t an accurate way of representing it, but yes, it works.

Is representing a human being with triangles accurate?
Point being- as programmers we must find the best shortcuts and use them like we are incapable of feeling shame.



Brian J
DL Vacuum - A media file organizer I made | MM

Share this post


Link to post
Share on other sites
Yann L    1802
The physically based representation of diffuse ambient light is radiosity. You can just exchange both: take out your ambient light term, plug in your radiosity solution. There you go, the difference in visual quality is more than significant.

But computing the radiosity solution of a reasonably complex environment can take anything from hours to weeks. Compared to the nanosecond it takes to get the ambient term, that''s quite a difference... Also, programming a radiosity solver is a lot more involved than a simple ambient term addition.

Share this post


Link to post
Share on other sites
cowsarenotevil    3006
Another related question, is it worth trying to do a per-vertex radiosity simulation for speed?

EDIT: Or cheating in various ways on the vertex level, but still using the very basic concepts behind radiosity?

[edited by - cowsarenotevil on September 2, 2003 9:07:43 PM]

Share this post


Link to post
Share on other sites
jeeky    126
quote:
Original post by cowsarenotevil

EDIT: However, couldn''t diffuse lights where the windows are, or even projected textures, look more realistic?


Not quite. Diffuse lighting is directional, but is everywhere. The objects in your room will be lit as if there were no walls or window. Also, surfaces with normals nearly identical to the diffuse direction will be black. Ambient lighting brings up the lights in all areas of the room, not just surfaces facing into the light.

Usually, you will want to have a small ambient component and use diffuse and specular lights to show the details. You can also use light maps and other even less accurate, yet cool looking, techniques.



Share this post


Link to post
Share on other sites
blueEbola    464
quote:
Original post by cowsarenotevil
Another related question, is it worth trying to do a per-vertex radiosity simulation for speed?

EDIT: Or cheating in various ways on the vertex level, but still using the very basic concepts behind radiosity?

[edited by - cowsarenotevil on September 2, 2003 9:07:43 PM]

It''s going to be a while before we start seeing realtime global illumination. Even if you do do it per vertex, it''s still going to be slow. It wouldn''t look as good as preprocessed radiosity using patches, either.

Share this post


Link to post
Share on other sites
BlackSheep    100
Vertex-based Radiosity

This is the best resource I''ve found for vertex radiosity, but it''s quite limited. It''s not eral-time, but interactive to a degree. Shows that it can be done though.

I implemented VBR myself a month or so ago, and was so impressed at needing to hugely tessellate my surfaces to make them look good, that I scrapped it and went back to light-mapping. It''s much slower than VBR, but the memory requirements are a lot smaller, and the GPU just laughs at it''s pitiful vertex requirements.

The main problem I found was that calculating form-factors was very awkward with arbitrary vertex placements, as lots of calculations needed doing to get the ''patch-area''. Lightmaps allow you to specify the patch area at pre-process time, and makes things a lot easier.

Share this post


Link to post
Share on other sites
Retrep    122
You could carefully place your lights so that all surfaces get lit, but that''d be tricky.

You could also try attaching a light (with no falloff, and with specular turned down) to your camera so that all visible surfaces within the view frustrum get lit. That might not be satisfactory though.

Share this post


Link to post
Share on other sites
BlackSheep    100
quote:
Original post by Retrep
You could carefully place your lights so that all surfaces get lit, but that''d be tricky.

You could also try attaching a light (with no falloff, and with specular turned down) to your camera so that all visible surfaces within the view frustrum get lit. That might not be satisfactory though.


Attaching a non-fall-off light is essentially the same as adding an ambient light term to each surface. Placing extra lights around the scene is the best way to solve the ''no ambient required'' problem, but does mean that to keep a reasonably even light level, you would need to add a heck of a lot of lights to the geometry.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
I see that some of us skipped our physics class when they taught optics.

Ok, it works like this.

Light photons are emitted from a source. When a photon reaches a surface, it bounces off of it. The photon then travels in a new direction until it bounces off of another surface. The photon then travels in a new direction until it bounces off of another surface. The photon then travels in a new direction until it bounces off of another surface.

Now, throw in billions of photons. All bouncing off of surfaces repeatedly. This creates the effect of ambient light. Light that appears to come from no particular direction but yet is still there.

There are 2 ways this can be simulated in hardware.

1.) model each photon individually and calculate it''s position and intensity as it bounces its way around the environment. The sum of all the photons represents the ambient lighting.

or

2.) something a bit less computationally expensive, use the ambient lighting effects provided by Graphics APIs to simulate the activity of billions of photons and use the remaining CPU cycles for AI, physics, particle systems, etc.

Share this post


Link to post
Share on other sites
Yann L    1802
or

3.) instead of tracing each photon individually, you compute the photon energy flux over a differential surface/volume. With the notable exception of photon mapping, many GI solutions are based on that principle. For example classical (progressive, non-Monte Carlo) radiosity, or Metropolis LT (which uses a kind of hybrid approach).

Share this post


Link to post
Share on other sites
hWnd    122
I am planning to use something like irradiance environment-maps for the ambient lighting in my engine. Whether that''d be good or not, i don''t know. But i think it would look cool in outdoor scenes. And it is relatively cheap compared to radiosity .

It is only a texture lookup. As texcoord the normal in worldspace is used. And the irradiance environmap would be a downsampled and blurred version of the environment map.

Sounds cool, doesn''t it? But i would like to hear if this could replace the constant ambient term.

Share this post


Link to post
Share on other sites
Yann L    1802
hWnd, if you go one step further, and store this irradiance map in high dynamic range format, then you''d have a HDRI irradiance map. The visual results are indeed very good for outdoor, as well as for static indoor environments. Look in the FAQ, there are a couple of links to Paul Debevec''s HDRI implementation. You can also download some test HDRI maps there.

You can easily extend this technique by a radiosity system later on, if you want. But in this case, the high dynamic range is important, as a simple 8bit RGB environment map doesn''t mix well with a radiosity algorithm.

Share this post


Link to post
Share on other sites
hWnd    122
OK thanks Yann, I will give it a try! If floating-point buffers are not available, I can still fall back to standard A8R8G8B8.

Share this post


Link to post
Share on other sites
cowsarenotevil    3006
Take this real time example scene I was playing with:


I have a red and blue diffuse light(drawn in with MSPaint ), and then to simulate light bouncing off, I added another purple diffuse light(also drawn in with MSPaint). I tried replacing the 3rd diffuse light with purple ambient light, but I couldn''t get a good effect at all. I think well-placed diffuse lights usually give a better effect than ambient light, but maybe I''m just no good at getting the values right.

Share this post


Link to post
Share on other sites
Thr33d    382
No, I think you''re right - well placed diffuse light sources do a better job than a simple ambient term.

However, setting up a simple ambient term is much easier than setting up "well placed" diffuse lights.

Also, if the diffuse lights cast shadows then it kinda ruins the effect btw.

Remember that website on radiosity (hugo elias'')
http://freespace.virgin.net/hugo.elias/radiosity/radiosity.htm

He shows his example of the difference between radiosity and no radiosity.
Notice in the "no radiosity" example he actually adds a directional light so you can at least see the geometry instead of just black with a little red.
If he had added just an ambient term it would have looked solid dark red (no way to see the pillar''s edges against the walls) and solid dark gray for the walls.


A directional light does wonders if you don''t want a very dark scene area. So yeah, in cases where you''d use an ambient term, a single directional light (not very bright) would probably look better.

You might think about a directional light source (no shadow calculation) instead of many point lights (cheaper calculations too) because it would be much easier on the artists.

-Michael

Share this post


Link to post
Share on other sites