I'm experimenting with NPR materials in Cycles, in particular, half-toning and hatching. In order to make things work, I often have to bake the output of a Cycles shader to a texture map and, in a second session/pass, multiply the colors in that map with a halftone screen, put the result through a threshold, etc., and feed the result back into say, an emission shader, to render the result.
Would it be possible to write an OSL shader that would accept a closure color as input (like the Cycles 'Mix Shader' node) so I can use the output of, say, a Diffuse BSDF node as the input for further calculations? (so as not have to bake it first?) I've seen OSL scripts which contain the grammar for this, but I've never seen it used.
At least, for example, it would be nice to be able to combine the outputs of Cycles closures in other ways than the factored mix provided by the 'Mix Shader' node. Maybe multiply, subtract, and all those other modes.
Being an OSL baby, I'm afraid I might be getting the shading logic all wrong- I don't understand why I haven't seen this done in any of the OSL scripts I've seen - even if it worked, would it be an abuse of the rendering system?