RenderMan Shading Language: Difference between revisions

Content deleted Content added
No edit summary
cleanup
Line 1:
Commonly referred RSL, '''Renderman Shading Language''' (abbreviated RSL) is useda tocomponent defineof shadersthe [[RenderMan Interface Specification]], and is used into define [[RenderManshader]]s. The language syntax is [[C programming language|C-like]].
 
TheA beautyshader ofwritten usingin aRSL standardcan languagebe isused thatwithout achanges programmedon shaderany canRenderMan-compliant be used in multiple rendersrenderer, besuch itas [[PhotoRealistic RenderMan]], DNA Research 3Delight, Sitexgraphics Air or an open source solution such as [[Pixie (renderer)|Pixie]] or [[Aqsis]].
[[Pixar]] has set a standard in the Shading Language.
 
The beauty of using a standard language is that a programmed shader can be used in multiple renders, be it [[PhotoRealistic RenderMan]], DNA Research 3Delight, Sitexgraphics Air or an open source solution such as [[Pixie (renderer)|Pixie]] or [[Aqsis]].
 
RenderMan Shading Language defines standalone functions and five types of shaders: surface, light, volume, imager and displacement shaders.
 
An example of a surface shader that defines a metal surface is:
<source lang="c">
surface metal(float Ka = 1; float Ks = 1; float roughness = 0.1;)
{
{
normal Nf = faceforward(normalize(N), I);
normal vector VNf = - faceforward(normalize(N), I);
vector OiV = Os- normalize(I);
Oi = Os;
Ci = Os * Cs * (Ka * ambient() + Ks * specular(Nf, V, roughness));
}
</source>
Shaders do the work by reading and writing special variables likesuch as Cs - (surface color), N - (normal at given point), and Ci - (final surface color).
The arguments to the shaders are global parameters that are attached to objects of the model (so one metal shader can be used for different metals and so on),
andThe theyarguments haveto nothe returnshaders values.are Onglobal theparameters otherthat handare functionsattached operateto byobjects takingof argumentsthe andmodel returning(so aone value,metal andshader makecan littlebe useused offor specialdifferent variablesmetals and so on). ForShaders examplehave theno followingreturn functionvalues, computesbut vectorfunctions lengthcan andbe looksdefined almostwhich liketake aarguments [[Javaand (programmingreturn language)|Java]]a orvalue. [[CFor (programmingexample, language)|C]]the following function, exceptcomputes forvector length using the [[dot product]] operator ".":
<source lang="c">
float length(vector v) {
return sqrt(v . v); /* . is a [[dot product]] */
}
}
</source>
 
==Further reading==