How do I only show direct illumination and shadows and turn of all bounces?

I’d like to set up a scene such that for all objects in the scene, if the sun lamp directly illuminates it, it is shaded in one colour. For all other scenarios (e.g. in shade, so that it is only indirectly illuminated) it will be shaded in another colour.

How can I achieve this in either Blender Internal, Cycles, or Eevee?

It should only consider direct illumination - no ray bouncing should be considered.

Bonus points if I can set another material to be like “glass” and not block direct illumination and basically be invisible.

Ideas?

You can turn down the bounces to 0, and you set all the materials in a render layer to all be the same material. And you can to this in BI as well.

You could use the light path node…
For example, a Lamp that emits light if the ray depth is greater than 1 will only give you indirect illumination to the scene… Or an object that becomes transparent if the ray is a shadow ray, and stays diffuse for other rays, will be visible but won’t cast shadows…