Can I determine which objects are affected by a light?

Hello, is there an easy way to determine if a particular object is being affected by a light? Or from the light, determine which objects it is illuminating?

I am creating a game where the illumination is part of the game mechanics, and so need to know which particular lights are affecting which objects, as a simple yes/no.

Obviously I can just use the lights radius and determine distance, but I wondered if this information was already stored within game objects or lights.


If your light casts shadows you could sample the shadowmap. Alternatively, cast a ray from the light to the object in question. If it hits the object (and the ray is the same length as the light distance), it’s lit. Otherwise, it’s in shadow.

Lights have a culling mask, similar to cameras. They will only affect objects that have layers which are part of their culling mask.