Stealth Gameplay: Getting how much light is on an object

Hi.
I was just wondering I was just wondering how to calculate how much light is on an object as a AI feature for a stealth game. This is easy when i know how many light sources are nearby as AI can just apply the light attenuation function but i know unity uses light noes for differed rendering and calculates this with the light probes.

Is there a way to steal the result without calculating it again every frame?

I would reduce the need for search for light sources and improve over performance.

Games like the Thief series and Splinter Cell use this.
The Darkness 2 uses this feature to reduce AI’s view range.

Might want to look into Light Probes.

http://docs.unity3d.com/Documentation/ScriptReference/LightProbes.GetInterpolatedLightProbe.html

Wow thanks for the quick reply. But i probably should have asked what component in your GameObject would actually have a light probe.
MeshRenderer?

Beacuse to use that function i would need a lightprobe.

Unless i add one to the character

You don’t need a LightProbe, you need the LightProbes collection - There’s a static variable in the LightmapSettings class named “lightProbes”, you access it with LightmapSettings.lightProbes

Also, while there is various information posted around that this will get you light at a point, I actually have no clue how to make sense out of the data it returns. :slight_smile: