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...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

A.2.3<br />

Metal surface<br />

surface<br />

metal(<br />

float Ka = 1;<br />

float Ks = 1;<br />

float roughness =.1;)<br />

{<br />

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

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

Oi = Os;<br />

Ci = Os * Cs * (Ka*ambient()+Ks*specular(Nf, V, roughness));<br />

}<br />

A.2.4<br />

Shiny metal surface<br />

surface<br />

shinymetal(<br />

float Ka = 1;<br />

float Ks = 1;<br />

float Kr = 1;<br />

float roughness = .1;<br />

string texturename = ””; )<br />

{<br />

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

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

vector D = reflect(I, normalize(Nf));<br />

D = vtransform(”current”, ”world”, D);<br />

Oi = Os;<br />

Ci = Os * Cs * (Ka*ambient() + Ks*specular(Nf, V, roughness)<br />

+ Kr*color environment(texturename, D));<br />

}<br />

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

the shinymetal surface shader operates identically to the metal shader.<br />

A.2.5<br />

Plastic surface<br />

surface<br />

plastic(<br />

float Ka = 1;<br />

float Kd =.5;<br />

float Ks =.5;<br />

float roughness =.1;<br />

color specularcolor = 1;)<br />

{<br />

156

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

Saved successfully!

Ooh no, something went wrong!