| 123456789101112131415161718192021222324252627282930313233343536373839 |
- /****************************
- Plastic Surface Shader
- (c) Mad Processor, 2009
- Features Color texture mapping
- and Opacity texture mapping
- *****************************/
- surface
- mp_plastic(
- float Ks = .5;
- float Kd = .5;
- float Ka = 1;
- float roughness = .1;
- color specularcolor = 1;
- string texturename = "";
- string alphamap = "";)
- {
- normal Nf;
- vector V;
- color Ct;
- float a;
- Nf = faceforward(normalize(N), I);
- V = normalize(-I);
- Ct = ( texturename != "" ) ?
- texture( texturename, "filter", "gaussian" ) : 1.0;
- a = ( alphamap != "" ) ?
- texture( alphamap[3], "filter", "gaussian" ) : 1.0;
-
- Oi = Os*a;
- Ci = (Cs * Ct * (Ka * ambient() + Kd * diffuse(Nf)) +
- specularcolor * Ks * specular(Nf, V, roughness));
- Ci *= Oi;
- }
|