26.01.2015 Views

The RenderMan Interface - Paul Bourke

The RenderMan Interface - Paul Bourke

The RenderMan Interface - Paul Bourke

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

}<br />

normal Nf = faceforward(normalize(N), I);<br />

vector V = -normalize(I);<br />

Oi = Os;<br />

Ci = Os * (Cs * (Ka*ambient() + Kd*diffuse(Nf)) +<br />

specularcolor * Ks*specular(Nf, V, roughness) );<br />

A.2.6<br />

Painted plastic surface<br />

surface<br />

paintedplastic(<br />

float Ka = 1;<br />

float Kd = .5;<br />

float Ks = .5;<br />

float roughness = .1;<br />

color specularcolor = 1;<br />

string texturename = ””;)<br />

{<br />

normal Nf = faceforward(normalize(N), I);<br />

vector V = -normalize(I);<br />

Oi = Os;<br />

Ci = Os * (Cs * color texture(texturename) *<br />

(Ka * ambient() + Kd * diffuse(Nf)) +<br />

specularcolor * Ks * specular(Nf, V, roughness));<br />

}<br />

If the Texture Mapping capability is not supported by a particular renderer implementation,<br />

the paintedplastic surface shader operates identically to the plastic shader.<br />

A.3 Light Source Shaders<br />

A.3.1<br />

Ambient light source<br />

light<br />

ambientlight(<br />

float intensity = 1;<br />

color lightcolor = 1;)<br />

{<br />

Cl = intensity * lightcolor;<br />

}<br />

A.3.2<br />

Distant light source<br />

light<br />

157

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!