RenderMan Shading Language: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 18:
Shaders do the work by reading and writing special variables like 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),
and they have no return values. On the other hand functions operate by taking arguments and returning a value, and make little use of special variables. For example the following function computes vector length and looks almost like a [[Java (programming language)|Java]] or [[C (programming language)|C]] function, except for using the [[dot product]] operator:
float length(vector v) {
return sqrt(v . v); /* . is a [[dot product]] */