# [SOLVED] Why does object get dimmer/darker when light gets closer to it?

Here’s a pen, showing some objects with shadow, and the object are bright with light further away:

http://jsfiddle.net/trusktr/xy2Wz/99/

If I move the light closer to the objects, from 300 to 80 on Z, then the object appear to be darker:

http://jsfiddle.net/trusktr/xy2Wz/101/

Why does this happen?

It’s a gradual loss of flux through a medium. In this case 3d graphics simulate light flux, traveling through air.

edit sorry no this is what would happen if you pushed it further away and had attenuation on.

The intensity at some point depends on the angle at which the light hits the surface. 90 degrees point gets all the light, 0 degrees it gets none. This is a pretty basic graphics concept, can also be known as ndotl (normal dot light)

I think that can be described more simply here - in the first fiddle, the light cone is covering the entire surface, so the entire surface is illuminated. In the second fiddle, it’s so close that only part of the surface is illuminated.

That’s physically correct - imagine that you are in a dark room with a torch that has a narrow tight beam, and you’re holding a book in your other hand. You roll a D6 and hear a rumbling of large rocks down a long corridor to the right and… sorry, where was I?

Oh yeah, so if you hold the torch far back from the book, it will illuminate the whole book (first fiddle), but if you hold it just 2cm from the book, it will only illuminate a small section in front of the beam (second fiddle).

If you don’t mind i’d modify your example to say that if you point the torch straight at a wall you’ll get a pretty bright spotlight. If you lean it against the wall and point sideways, the wall will be barely illuminated, depending on how rough it is.

This is happening in the fiddle as well, mathematically, points on that cube get less light as the angle between the surface and the light goes from 90degrees to 0.

Conceptually, every pixel you render is a point in world space. But since atoms are much smaller than what your pixel contains, you can think of a pixel as an area rather than just a point. So imagine that you increase the resolution of your image, and 1 pixel turns into 4. Extrude these 4 pixels and you get a box. Now “skew” it, by taking the top vertices and moving them around.

If you slice it at a 90 degree angle to that direction, you get a smaller section:

(the blue line is longer when the ray is perpendicular to the surface, shorter and eventually 0 as it goes to 0)

1 Like

Ah, makes sense. I played around with my flashlight in a dark room, and see the effect on the semi-shiny floor. Thanks!

Shiny floor would yeald more of the specular reflection than diffuse. Do it on a painted wall.

It was semi-glossy wood floor, so it worked well. Up higher, the wood texture was much more visible, but down lower it became much darker, just like in the rendering.