Limiting Light

Started by
3 comments, last by DwarvesH 10 years, 7 months ago

I notice when I have light inside the building, it affect the building from outside as well

So If I have a light inside the building, I can notice the building outer wall is affected by the light, while in real life only the inner wall should be affected.

How do I resolve that?

Advertisement

Two simple solutions: During art content creation, either make your light radius small enough that the light never goes out of the building or move the position of the light such that the light never goes out of the building.

A third solution is to use shadow maps. However they're expensive for point lights and will probably have artifacts hard to fix as shadow maps are far from perfect. The best options are the ones Steve_Segreto said.

A fourth option could be to set a bit mask to the outer walls different from the inside walls, and have lights from the inside match the bit mask from the inner walls. Again, this requires artist intervention.

A fourth option could be to set a bit mask to the outer walls different from the inside walls, and have lights from the inside match the bit mask from the inner walls. Again, this requires artist intervention.

Yep, in general you can assign individual lights to individual objects (or rather larger groups of objects like "room 1 interior") in your scene and render each object only with lights that belong to it.
It doesn't have to be a bitmask, it doesn't matter.

A fifth, probably more expensive solution is to implement light clipping. Clipping to an AABB box is the simplest form.

But the best solution would be to have some convex polygons for each interior. Project the light to the floor plane (the easiest way is to say that the polygon has a Y of 0 and all lights have a Y of 0). If the light is inside the polygon, determine all other objects that are inside the polygon and render them using the interior light + the exterior lights. The rest of the objects that are not inside the polygon will be rendered only with the exterior lights. It also helps if you use smart light placement, like Steve_Segreto suggested. Put the lights either somewhere near the center of the polygon, or place them on walls, but not near the door. This was you won't get weird lighting changes once the object begins to get close or enter the interior. And your interior should have an exterior surface and an interior one. This is not a problem because most interiors that can be viewed from the inside or outside are modeled this way.

For a first test, I would recommend using an AABB box for you polygon and interior surface and for the exterior surface a slightly bigger AABB, with the mesh having a simple door cut inside it.

This topic is closed to new replies.

Advertisement