// ------------------------------------------------------------- // Chromadepth - centered on object - script by Kenneth // red, green, blue #macro MakeChromadepthTextureObjectRGB(CameraLocation, NearCorner, FarCorner) #local C_L_1 = vlength(NearCorner - CameraLocation); // or - 1.68 FUDGE FACTOR or - 1.70 FUDGE FACTOR #local C_L_2 = vlength( FarCorner - CameraLocation); // or + 1.44 FUDGE FACTOR or + 1.65 FUDGE FACTOR #local C_S = C_L_1/C_L_2; #local C_T = 1.0 - C_S; pigment { spherical color_map { [0 color srgb 3] [0 color srgb CHSL2RGB(<240, 1, 1/2>)] #for (i, 0, 240, 1) #local iThis = i/240; [iThis*C_T color srgb CHSL2RGB(<240 - i, 1, 1/2>)] #end [C_T color srgb CHSL2RGB(<000, 1, 1/2>)] [C_T color srgb 3] } scale C_L_2 translate CameraLocation //#debug concat("\n", "C_L_1/C_L_2 = ",str(C_L_1/C_L_2,0,9)," (should never go over 1.0 !)","\n") //#debug concat("\n", "C_T = ",str(C_T,0,9),"\n") } // finish // { // ambient 1 // diffuse 0 // } #end // red, white, blue #macro MakeChromadepthTextureObjectRWB(CameraLocation, NearCorner, FarCorner) #local C_L_1 = vlength(NearCorner - CameraLocation); // or - 1.68 FUDGE FACTOR or - 1.70 FUDGE FACTOR #local C_L_2 = vlength( FarCorner - CameraLocation); // or + 1.44 FUDGE FACTOR or + 1.65 FUDGE FACTOR #local C_S = C_L_1/C_L_2; #local C_T = 1.0 - C_S; pigment { spherical color_map { [0 srgb 3] [0 srgb <0,0,1>] // BLUE -- outside edge of pattern [0.5*C_T srgb <1,1,1>] // YELLOW [C_T srgb <1,0,0>] // RED [C_T srgb 3] } scale C_L_2 translate CameraLocation //#debug concat("\n", "C_L_1/C_L_2 = ",str(C_L_1/C_L_2,0,9)," (should never go over 1.0 !)","\n") //#debug concat("\n", "C_T = ",str(C_T,0,9),"\n") } // finish // { // ambient 1 // diffuse 0 // } #end