/*Inside and Outside Shader*/ surface playingCard (float Ka = 1, Kd = 1, Ks = 0.1, roughness = 1; float Opec = 1; string OutSideTxt = ""; string InSideTxt = ""; color hilitecolor = 1; float blend = 0) { float switch = 1; color ambientcolor, diffusecolor, speccolor; color surfcolor1, surfcolor2 = 1; /* STEP 1 - make a copy of the surface normal one unit in length */ normal n = normalize(N); normal nf = faceforward(n, I); /* STEP 3 - calculate the lighting components */ ambientcolor = Ka * ambient(); diffusecolor = Kd * diffuse(nf); vector i = normalize(-I); speccolor = Ks * specular(nf, i, roughness) * hilitecolor; /*My Code*/ if (OutSideTxt != "" || InSideTxt != "") /*This first Statement is to make sure that there are textures in the string - if there are not then the it doesn't work*/ if (switch == 1 && n == nf) /*Here I made a true statement with the switch and the normals and textured it accordingly.*/ { surfcolor1 = texture(OutSideTxt); surfcolor2 = texture(InSideTxt); } else if (switch == 1 && n != nf) /*You will notice here that the statement is also true but the textures are opposite*/ { surfcolor1 = texture(InSideTxt); surfcolor2 = texture(OutSideTxt); } /*Added a multiplyer to the opacity for more variance*/ Oi = Os * Opec; /*Added a blend to the the textures so we could see through the to the other side - Was orginally a test; however, this turned out to be an inaccurate test*/ color mixedColor = mix(surfcolor1, surfcolor2, blend); /* STEP 4 - calculate the apparent surface color */ Ci = Oi * Cs * mixedColor * (ambientcolor + diffusecolor + speccolor); }