3

In the Renderman Shading Language, the whole purpose of a shader is to determine the final pixel color for each fragment. You have complete control over what the shader does and what the final color is. If you have a scene with a mountain covered in snow, with trees in the foreground and a lake, if you want the whole image to be completely red--like (255, 0, 0) red in every single pixel--you can do that by setting the final color at the end of each shader. It can completely disregard the lights, image textures and geometry.

Is this possible in Cycles or OSL? I realize that the REYES algorithm is a very different beast than OSL closures in a unidirectional path tracer. But, can I override the physically-based-ness of Cycles in a shader?

Justin
  • 1,972
  • 4
  • 24
  • 43

1 Answers1

2

I do believe that RSL scripts might have more control over the final colour than OSL scripts do. From the OSL specification --

A closure is an expression or function call that will be stored, along with necessary contextual information, to be evaluated at a later time.

What this means is the green node sockets that connect to the Material Output provide the render engine with a way to calculate the final colour not the specific colour to use in the final image. The steps of mixing reflections and lighting is performed by the renderer not by the OSL script.

For interest the first example that gandalf3 pointed you to can be achieved in OSL with --

shader flatcolour(color Colour = 0.8,
    float Strength = 1.0,
    output closure color BSDF = 0 )
{
    if(raytype("camera"))
        BSDF = (Strength * Colour) * emission();
    else
        BSDF = transparent();
}
sambler
  • 55,387
  • 3
  • 59
  • 192