[CYCLES] Get color data from bsdf output in nodes

Hi !

I’m playing with material nodes and I would like to know if it is possible to get the color from a bsdf socket. I would like to use the color as the Fac input of a Mix shader to display a different shader on the shadowed part of my object. I’ve tried to connect the bsdf directly to the Fac or through a ColorRamp but the result remains the same : the result is uniform, as if I’ve input a plain color.
Is it doable ? Do I have to use an OSL script ?

Thanks !

If i am understanding you correctly than i do not believe so. The reason i understand to be why is because the shaders are, well, shaders, and are more easily compared to the output to the output… i dont know what your node setup looks like or what your expectaton is but i would suggest the Input>RGB if you are looking to add color, or if you want to drop it between 2 other nodes than really any kindof mix rgb node will work.

BSDF node does not output a colour. I think what you are looking for is around 8 minutes in the video here:

A BSDF stores no color information, it only outputs a recommendation for where a light ray should go and be modulated as it runs through its path. There’s no way in any path tracer to use the output of a BSDF to drive the scalar value of another property. OSL may be able to be hacked around with to get it to work, but the results would be unreliable/unpredictable.

Ok, I see.

So if I want to use the result of a shader, maybe I should have a look in the compositor nodes instead, or using some baked texture from Blender Internal. I hoped to have more control (I want to do an animation with this) but I suppose that as we are dealing with a physically accurate renderer, we can’t make it do all we want.

Thanks for your answers. I’ll also give a try to OSL and if I find something clean I’ll post it.