Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

From what I've read, with a simple directional light, the color of a point, if you only take diffuse reflection into account (intensity = 1), should be

color = color_of_point * color_of_light * dot(normal, -light_direction);

However, this is confusing for me. For example, if the light direction is parallel to the normal, and if the color of the point is pure red (1,0,0) and the color of the light is pure blue (0,0,1) I'd expect the point to have a color of violet - yet the result will be black.

Similarly, if I have a completely white point, or a completely black point, I wouldn't intuitively assume that the result is completely white (regardless of light color) or completely black either.

I guess I'm fundamentally misunderstanding something here. Can someone explain?

share|improve this question

2 Answers 2

up vote 13 down vote accepted

Your lighting equation is physically correct. However, in real life, one almost never sees highly pure colors. (An exception is when lasers are involved.) That's probably why your intuition is that red * blue = violet - a more realistic red might be something like (1, 0.1, 0.1), and a blue (0.1, 0.1, 1). Multiply those and you get (0.1, 0.01, 0.1), which is indeed a (dark) violet.

Similarly, nothing is perfectly black. Even black plastic, paint or cloth has at least a little specular reflection. The specular albedo at normal incidence doesn't get below about 2% for most materials, and at grazing incidence it rises due to the Fresnel effect. (Super black is an exception - a special material that reflects only 0.4% at normal incidence.)

For a white material, the reflected light will be the light color, not completely white. However, you've got to watch out here as your brain plays tricks on you: it adapts to the overall color of the light around you, so that white objects tend to look perceptually white even when illuminated by colored light. This is why digital cameras have a white balance setting - photographs would look completely wrong without it. (Of course, this only works up to a point - illuminate a room with a red laser and things will look red, not white.) Games don't generally simulate this visual adaptation process, though; instead they just have light colors that are less saturated than in reality.

(By the way, a nitpick: your lighting equation should have saturate() around the dot product, to avoid generating negative values on the dark side of an object.)

share|improve this answer

How do objects show color?

Well, an 100% red object looks red because it absorbs all other wavelengths of light (orange,yellow,green..you know, a rainbow) and reflects only red.

So what if you shone pure blue light on a pure red surface? Well it would absorb the blue light and reflect.. nothing. Hence black.

enter image description here

I'm sorry for the terrible picture

share|improve this answer
8  
The picture is not terrible :) –  nightcracker Aug 15 '13 at 6:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.