/*	paintedplastic surface shader
 *
 * 	Pixie is:
 * 	(c) Copyright 1999-2003 Okan Arikan. All rights reserved.
 */

surface plastic_amb ( float Ka = 1, Kd = .5, Ks = .5, roughness = .1;
                         color specularcolor = 1;
                         float samples = 64, maxdist = 1e30, coneangle = PI/2;
                         float scaling = 1.0;
                         ) {
    normal Nf = faceforward (normalize(N),I);
    float occ = scaling*occlusion(P, Nf, samples, "maxdist", maxdist, "coneangle", coneangle);
    vector Cio = Cs;
    Ci = (1 - occ) * Cs * Os;

    /*
     should play around with the effect of the occlusion and maybe have an effect on specular
     highlights also.
    */
    Ci = Ci * Cio * (Ka*ambient() + Kd*diffuse(Nf)) + specularcolor * Ks*specular(Nf,-normalize(I),roughness);
    //Ci = Cio * (Ka*ambient() + Kd*diffuse(Nf)) + specularcolor * Ks*specular(Nf,-normalize(I),roughness);
    Oi = Os; 
    Ci *= Oi;
}

