I would like to create a Cycles Material that assigns a color to the points of an object's surface based on how many light sources hit that point.

If, for example, there are 10 light lamps into the scene (and no ambient occlusion nor emissions from anywhere), each will contribute with a (0.1, 0.1, 0.1)RGB to the final color of the object surface if any of its rays hit it.

Do you think it is possible? Any suggestions about how to achieve this?


EDIT: (To be a little more specific). For an academic paper I'm writing, which will be a bit long to describe, I need to know how many lights are contributing to the color of a specific point of a surface. My idea was to paint this point with a tint obtained by adding the colors of those lights that hit it. In this way I don't know which lights are hitting a surface point (which could have been even better) but at least I know how many of them contribute to its final color.

  • 1
    $\begingroup$ As far as Cycles is concerned, all lights in the scene hit all objects in the scene. Some lights just contribute very little to some objects. Could you edit your question with some more info in why you need this, what you're trying to achieve? It might help people offer better suggestions to get the result you need. $\endgroup$
    – JtheNinja
    Apr 17, 2018 at 16:49
  • $\begingroup$ You may find blender internal better at dealing with this problem. For example, you can have lamps that have constant falloff, no bounces, and cast shadows. They will contribute to the objects rendered surface color additively, as you described. $\endgroup$
    – dixiepig
    Apr 17, 2018 at 17:05
  • $\begingroup$ @dixiepig: I will give internal a try! Tnks $\endgroup$ Apr 19, 2018 at 7:41

1 Answer 1


This is possible using the Toon shader which can be set to produce completely 'flat' shading that is only dependent on the incident lamps. By also setting the lamps to 'Constant' shading the effect of each lamp can effectively be clamped to a constant contribution for each visible lamp.

Start by setting your lamps to 'Constant' illumination :

lamp - constant

Adjust the Light Falloff node to adjust the Strength of the lamp. This will result in each lamp contributing the same illumination to a surface regardless of distance.

For the mesh material, use the Toon shader with the Size and Smooth values set to 1.0 to give completely 'flat' shading. Also, set the Render properties Light Paths for 'Bounces' to zero as we don't want to take account of any bounced rays :

material and light paths

This can produce the following result :


Blend file included

Note that you may also want to reduce the lamp size from the default size so as to ensure sharp shadow edges.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .