What's different between ambient light and diffuse light,?

if the postion the last paramter is zero,
GLfloat light_ambient[] = { 0.0, 0.0, 1.0, 1.0 };
GLfloat light_diffuse[] = { 0.0, 0.0, 1.0, 1.0 };

GLfloat light_position[] = { 1.0, 1.0, 1.0, 0.0 };
what’s their different?

if there is only one ambient light in a scene, and as above, its a directional one, is there any shadow on an object which is behind another object?

3] How does the ambient light is lighting the scene? or Dpes it also act like ray tracing algorithm?

[QUOTE=reader1;1267687]if the postion the last paramter is zero,
GLfloat light_ambient = { 0.0, 0.0, 1.0, 1.0 };
GLfloat light_diffuse = { 0.0, 0.0, 1.0, 1.0 };

GLfloat light_position = { 1.0, 1.0, 1.0, 0.0 };
what’s their different?[/QUOTE]
If the w component of the light’s position is zero, the light is directional (at infinity), i.e. the direction of the light relative to a vertex is independent of the vertex’ position. If the w component is non-zero, the direction of the light is obtained by subtracting the vertex’ position from the light’s position.

The fixed-function lighting model doesn’t have shadows. If you want shadows, you have to implement them yourself using e.g. shadow volumes (using the stencil buffer to calculate the intersection between a surface and a lighting or shadow volume) or shadow maps (generating a depth buffer treating the light as a camera and testing against that to determine whether a point is in shadow).

The ambient lighting is simply multiplied by the material’s ambient colour and the result added to the final colour.

Unlike diffuse lighting, ambient lighting isn’t affected by the surface normal. It represents light which comes from all directions equally (e.g. indirect lighting, reflected from surrounding surfaces).

【quote]The ambient lighting is simply multiplied by the material’s ambient colour and the result added to the final colour.[/quote]
This is the last result in lighing scene. I wish to know how the ambient light part light the objects in a scene? in which algorithm? does it use light tracing way?

Thanks, I want to know _amb and _diff distinguish at this situation? (at the state of w=0).

They are all directional vector at this state. what different action or application to objects is there between them?
How does the _amb light illuminate the objects in the scene? What algorithm for the api? is it in way of ray tracing or ordinary raster scanning?
and then diffuse…?
(I knpw how they use, how to blend with mateials)
Is there any vague in the description? if there is, I shall modify until all understand.
if it were you, how would you ask this question?

The fixed-function lighting model doesn’t have shadows. If you want shadows, you have to implement them yourself using e.g. shadow volumes (using the stencil buffer to calculate the intersection between a surface and a lighting or shadow volume) or shadow maps (generating a depth buffer treating the light as a camera and testing against that to determine whether a point is in shadow).

I havn’t yet paid attention to the shadow mapping, What I concern is tht is there any shadow for an object which is behind another one in way of _amb lighting? we can suppose there are many objejcts in the scene. or say is there any illumination affect among objects.?
most aricles say the object was illumated uniformly without any affection respectlively.? is that right?

Ambient lighting is something of a hack.

In normal OpenGL rendering, lighting is computed by taking the sum of the light produced by a variety of light sources. However, in the real world, a lot of the lighting for an object comes, not directly from light sources, but indirectly from other objects. After all, we see objects because of the light they reflect. It stands to reason that they’d reflect light onto other objects, and that light would be reflected by them a second time.

This is why you can light up a whole room in the daytime, just by drawing back the curtains. Even parts of the room that aren’t facing the window will not be in total darkness, due to the reflection of light from other surfaces.

This indirectly reflected light is called “interreflection”; lighting models which attempt to handle this are said to perform “global illumination”, since it takes into account light globally throughout the scene.

Ambient lighting is, as previously stated, a hack. It’s basically saying, “there is a light source with intensity X that comes from everywhere”. This is an attempt to handle global illumination, by pretending that the contribution of all indirect lighting can be boiled down to a single intensity at all positions in space equally.

quote]In normal OpenGL rendering, lighting is computed by taking the sum of the light produced by a [/quote]
thank you for your patient explain. and are you aware of what I ask? I wonder why you all like to talk about what is lihgt beyong how they implement this lighting?

Would you pls repeat what I asked? ask what?

How does these api work? what is their algorithm to illuminate the objects? and

GLfloat light_ambient = { 0.0, 0.0, 1.0, 1.0 };
GLfloat light_diffuse = { 0.0, 0.0, 1.0, 1.0 };

GLfloat light_position = { 1.0, 1.0, 1.0, 0.0 };
what’s their different?

tThen, hey are all directional, whats their different?
I wish you would not misunderstand my question. and how do they illuminate the scene? (in which way or in what algorithm)

perform “global illumination”, since it takes into account light globally throughout the scene

how to calculate this gloable lighting?

As if this is an irrational question, I seem to confuse their define and observation aspect from viewer.
well I shall have a think twice, ignore this question pls.