Material Node that gives back recieved light

Hi,
is there a node in Cycles or BI that can give back the recieved light of the object?
I would like to mix shaders based on recieved light.

For example: If an object is darker at a specific place because it recieves a shadow from another object the second shader would be more intense than the first shader of the mix node.

Or an object is lit by one light from the front. In the front it would show the first shader of the mix shader and on the back, where it doesn´t recieve much light it would portray the second shader.

I managed to create such a shader in 3ds Max. It basically checks for brightness which is determined by light, shadows and and ambient occlusion.
It also uses different shaders based on direction but that is pretty easy in blender.

Here is an image of the shader in 3ds max. All objects have the same material and no UV mapping. The crosshatching is completely procedural. As you can see, all the dark parts (caused by shadows, little lighting or ambient occlusion) use a different shader with different textures.
The material itself is set to shadeless (or 100% self illumination as it is called in Max). The differences in brightness are only due to the different texture the different shader uses.
If I exchange the lines for random colors I get the second image.
3ds Max is very bad with outlines and toon shading, so it would be interesting to have a shader like that in Blender to combine it with Freestyle.

So, is there a node that gives back the brightness of a pixel?



Attachments


Such a thing as using light intensity to drive a shader is not an easy thing to implement in a path tracing environment (and is the reason why Cycles doesn’t have such a thing).

However, you can light the scene with Blender’s built-in lamp types and enable the shadow pass (which you can then add your effects via the compositor).

Allright, thank you. :slight_smile:

If objects have some degree of translucency, transparancy, or refraction (via a mix with one of those shaders or glass), then light paths offers an option to control shadow and transmission color. There might be some ways of exploiting that.

Other than that, I remember seeing something about shadow-catcher materials being under development. (But who knows when that’ll be ready?)

There’s the diffuse_ramp() shader that can do something like this, but unfortunatly it is only accessible by OSL.

Here’s the sample code:

/*
 * TDDiffuse_ramp.osl by Thomas Dinges (c)2012
 * from https://github.com/sambler/osl-shaders
 *
 * original script from -
 * http://www.openshading.com/osl/example-shaders/
 *
 * NOTE: diffuse_ramp function added to blender svn at r52887 12/12/2012
 * This will not run in the 2.65 release
 *
 */

#include <stdosl.h>

shader TDdiffuse_ramp(
        normal Normal = N,
        color Color1 = color(0.8, 0.0, 0.0),
        color Color2 = color(0.0, 0.8, 0.0),
        color Color3 = color(0.0, 0.0, 0.8),
        color Color4 = 0.1,
        color Color5 = 0.2,
        color Color6 = 0.3,
        color Color7 = 0.4,
        color Color8 = 0.5,
        output closure color BSDF = 0 )
{
    color Color[8] = {Color1, Color2, Color3, Color4, Color5, Color6, Color7, Color8};

    BSDF = diffuse_ramp(Normal, Color);
}


edited: And quick test render (no post effects, direct from cycles):