How to get information of how much light is hitting the surface for material nodes

Is there a way to somehow get material node for amount of light hitting the surface? For example I have a plane with diffuse and glossy mixed with mix shader and I would like to use amount of light hitting the surface for mix factor. I know I can bake that to image texture, but I want that data dynamically (for animation or something). It would be cool to make material change color to warmer in more lighted places.

Hi Torquem, no there isn’t. Arnold has that though, so it’s theoretically possible (although I don’t see how because at the time of tracing a ray against a surface you don’t know how much light is going to contribute, maybe with a probability increasing for each bounce).

If you need this information for some specific effect, then you can bake the illumination first and use the baked result. It’s clumsy, I know; cycles algorithm is just about that (finding how much light reaches each point), so to use this value in a shader you need to make two renders.

You can also create another render layer (or use the current one), and use that information/image as a mask in the compositor.