RenderMan Shading Language: Difference between revisions

Content deleted Content added
m Pixar not PIXAR
No edit summary
 
(46 intermediate revisions by 39 users not shown)
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]].
 
A shader written in RSL can be used without changes on any RenderMan-compliant renderer, such as Pixar's [[PhotoRealistic RenderMan]], DNA Research's [[3Delight]], Sitexgraphics' Air or an open source solution such as Pixie or [[Aqsis]].
[[Pixar]] has set a standard in the Shading Language. The word Renderman is used when referring to renderers that use the [[Reyes rendering]] algorithm and follow the standard set by [[Pixar]] as far as programming the shaders.
 
The beauty of using a standard language is that a programmed shader can be used in multiple renders, be it [[PhotoRealistic RenderMan]] 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 dthatthat defines a metal surface is:
<syntaxhighlight 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));
}
</syntaxhighlight>
Shaders doexpress thetheir 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). Shaders have no return values, but functions can be defined which take arguments and return a value. For example, the following function computes vector length using the [[dot product]] operator ".":
<syntaxhighlight lang="c">
float length (vector v) {
return sqrt (v . v); /* . is a [[dot product]] */
}
</syntaxhighlight>
 
==Further reading==
Shaders do the work by reading and writing special variables like Cs - surface color, N - normal at given point, and Ci - final surface color.
* {{cite book | last=Upstill | first=Steve | title=The RenderMan companion : a programmer's guide to realistic computer graphics | publisher=Addison-Wesley | ___location=Reading, Mass | year=1990 | isbn=0-201-50868-0 | url=https://archive.org/details/rendermancompani00upst }}
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),
* {{cite book | last=Apodaca | first=Anthony | authorlink=Anthony Apodaca | last2=Gritz | first2=Larry | title=Advanced RenderMan : creating CGI for motion pictures | publisher=Morgan Kaufmann | ___location=San Francisco | year=1999 | isbn=1-55860-618-1 | url=https://archive.org/details/advancedrenderma00apod_0 }}
and they have no return values. On the other hand functions operate by taking arguments and returning a value, and make little use f special variables. For example the following function computes vector length looks almost like a [[Java programming language|Java]] or [[C programming language|C]] function except for using [[dot product]] operator:
* {{cite book | last=Cortes | first=Rudy | last2=Raghavachary |first2=Saty | title=The RenderMan shading language guide | publisher=Thomson Course Technology | ___location=Boston, Mass | year=2008 | isbn=1-59863-286-8 }}
float length(vector v) {
return sqrt(v . v); /* . is a [[dot product]] */
}
 
==External links==
[[Category:3D graphics software]]
* [https://renderman.pixar.com/resources/RenderMan_20/shadingLanguage.html Shading Language (RSL) documentation]
[[Category:Pixar]]
 
{{RenderMan}}
 
{{DEFAULTSORT:Renderman Shading Language}}
{{graphics-software-stub}}
 
[[Category:PixarRenderMan]]
[[Category:Shading languages]]
[[zh:RenderMan规范#RenderMan着色语言(RSL)]]