/* Shader description goes here */ surface subsurf1(float Km = 0, /* subsurface bumpiness*/ Kd = 0.5, /* basic brightness of the sub surface */ Ks = 0.7, /* hilite brightness */ subKs = 0.3, /* sub specular */ DsubKs = .3, DKsub = .3, TsubKs = .3, TKsub = .3, Ksub = .5, Ktop = .5, Kenv = 0, tint = 1, roughness = 0.1; /* hilite spread */ color hilitecolor = 1; /* hilite color */ string envname = "M:/vsfx419/shaders_src/new2.tx" ) { color ambientcolor, diffusecolor, speccolor, surfcolor = 1, envcolor = 1; //==============this is the first section normal n = normalize(N); normal nf = faceforward(n, I); vector i; if (envname != "") { vector R = reflect (I, nf); envcolor = environment(envname, R) * Kenv ; } Oi = Os; i = normalize(-I); speccolor = Ks * specular(nf, i, roughness) * hilitecolor; color trueLightColor = speccolor * Ktop; float dot = normalize(nf).normalize(-I); color tint; tint = spline(dot, color(0,0,1), color(0,0,1), color(0,1,0), color(0,0,1), color(0,0,1)); //============================This Calculates a layer of noise point oldP = P; normal oldN = N; float hump = noise( (s+s)*(t+t) * 50 ); P = P - hump * n * Km; N = calculatenormal(P); //================================This recalculates it and puts it together n = normalize(N); nf = faceforward(n, I); diffusecolor = Kd * diffuse(nf); i = normalize(-I); speccolor = subKs * specular(nf, i, roughness) * hilitecolor; color fakeLightColor = (diffusecolor + speccolor) * Ksub; //============================This Calculates a layer of noise point DoldP = P; normal DoldN = N; float Dhump = noise(s * 50); P = P - Dhump * n * Km; N = calculatenormal(P); //================================This recalculates it and puts it together n = normalize(N); nf = faceforward(n, I); diffusecolor = Kd * diffuse(nf); i = normalize(-I); speccolor = DsubKs * specular(nf, i, roughness) * hilitecolor; color DoublefakeLightColor = (diffusecolor + speccolor) * DKsub; //============================This Calculates a layer of noise point ToldP = P; normal ToldN = N; float Thump = noise( n * 10); P = P - Thump * n * Km; N = calculatenormal(P); //================================This recalculates it and puts it together n = normalize(N); nf = faceforward(n, I); diffusecolor = Kd * diffuse(nf); i = normalize(-I); speccolor = TsubKs * specular(nf, i, roughness) * hilitecolor; color TriplefakeLightColor = (diffusecolor + speccolor) * TKsub; //====I want to do a third and fourth recalculation Ci = Oi * Cs * surfcolor * (envcolor + trueLightColor + fakeLightColor + DoublefakeLightColor + TriplefakeLightColor - tint); P = ToldP; N = oldN; } // this changes the color as it goes around i still need to findout where to go //==float dot = normalize(nf).normalize(-I) //==tint = spline(dot, color(0,0,1), color(0,0,1),color(0,1,0),color(0,0,1), color(0,0,1));