# Detect light amount on surface?

Is there a way to detect amount of light affecting some surface and use this value in a driver?

• That would be in the shaders which do your lighting computation per material, but if those values are available from within the UI is another matter. – G.Rassovsky Apr 28 '15 at 15:18

Blender shaders or objetcs does not have this kind of output to use in drivers.

You can use the Inverse square law.

$$I \propto \frac{1}{d^{2}}$$

Where $I$ is the intensity and $d$ is the distance. (Intensity is proportional to inverse of distance squared)

You can use this in your driver multiplied with the lamp or emission-shader intensity.

To account for surface normal (how it is rotated towards light) you would have to script a pydriver and access the mesh data inside: How to create a PyDriver in blender 2.7

Or use a dummy plane tangent to surface that will not render and get the direction and distance into the driver from there.

If you would like to account for mirrors or indirect lighting in general then forget it;)

• Thought embedding Latex formula like Intensity \propto \frac{1}{distance^{2}}is a standard feature at all stackexchange sites, but I can't preview it here. Maybe it's only supported at math.stackexchange... Anyway, I've created an image of the formula for this answer, if you want to use it: i.stack.imgur.com/w8wI0.gif with this online tool. – p2or Apr 28 '15 at 18:46
• Not very optimistic answer but thank you) I wanted to do this for indirect lightning as well =( – Terion Apr 28 '15 at 20:45
• @ВладимирКорнилов Well technically you could do that but it would be the same as scripting your own renderer.. or you would have to somehow connect OSL scripted shaders to pydrivers.. – Jaroslav Jerryno Novotny Apr 28 '15 at 20:50
• I understand) Well, I think I can handle my task with shaders only. Thank you again) – Terion Apr 28 '15 at 21:13