# Amount of light in a room?

Alright, I’ve been having a lot of headaches trying to figure this out. How do I go about and find out the amount of light in a room?

Let’s say I have a light source in the center of a square room, but it can’t fill the entire room. If it moves into a corner, for instance, naturally the light in the room dims.

How can I know how much light I have in a room, based on the location of the light source?

Technically, wherever your light is you’ll have the same amount of light in a room.

Now if you want to know how much light reach a given point in 3D this can be from very simple to not-possible in real-time depending on the realism you want to achieve. There’s a lot of parameters :

• for each direct light :
• intensity
• distance
• range and attenuation formula
• % of occlusion of the light source from the point you’re trying to sample
• for indirect light :
• how much light is reflected toward the point you’re sampling by its environment
• how many light bounces you are ready to take into account

All of these can be precalculated by a 3D renderer like Maya or 3DSMax but only the first three parameters i listed for the direct lights are really easy to get in real time. The rest can be faked, precalculated or approximated…

That sounds a bit… complicated.

Can’t I just calculate the percentage of the room covered by light from the range and position of the light?

• Approximate the sphere of your light with a cube ( for an omni light )
• Calculate the volume of this cube that is included inside the box of the room
• Make a ratio of this volume with the total volume of the room

This shouldn’t be too difficult if the room is rectangular and if you align the “light cube” with the axis of the room.

Yeah, but what about randomly-shaped rectangular rooms? I reckon that if I have a room (or a tight corridor) smaller than the “light cube”, the overflow means 100% coverage.

of course, the maximum value is 100%.
Though in reality the tight corridor will seem more illuminated than a room with the same size as the light because all points of the tight corridor are near the light source. If you want to take that into account, the Maths involved will be much much more complicated…

Heh. Challenge accepted. I’ll post here if I get anywhere with it.