camera { location <0,0,-7> look_at 0 angle 48 } light_source {<-100,150,-200>, 1.4 } #macro Make_Texture() #local Specular_Subtract= ; #local Specular_Add=<1,1,1>-Specular_Subtract+.001; #local f_red=function{Color_Map(x,y,z).red} #local f_green=function{Color_Map(x,y,z).green} #local f_blue=function{Color_Map(x,y,z).blue} // For use in layer1 #local Color_Map1=pigment{ average pigment_map{ [1 function{f_red(x,y,z)} color_map{[0 red 0][1 red 3 + Specular_Add.x*3 ]}] [1 function{f_green(x,y,z)} color_map{[0 green 0][1 green 3 + Specular_Add.y*3 ]}] [1 function{f_blue(x,y,z)} color_map{[0 blue 0][1 blue 3 + Specular_Add.z*3 ]}] }} // For use in layer 2 = double intensity #local Color_Map2=pigment{ average pigment_map{ [1 function{f_red(x,y,z)} color_map{[0 red 0][1 red 6 + Specular_Add.x*6 ]}] [1 function{f_green(x,y,z)} color_map{[0 green 0][1 green 6 + Specular_Add.y*6 ]}] [1 function{f_blue(x,y,z)} color_map{[0 blue 0][1 blue 6 + Specular_Add.z*6 ]}] }} // Add the opposite of specular color to layer 1 & 2 // Layer 1 color, normal. Uses ordinary reflection & specular #declare Layer_1=texture { pigment { Color_Map1 } finish { ambient 0 specular Specular_Amount roughness Specular_Roughness metallic Metallic_Amount reflection Reflection_Amount } normal { function { Bump_Map(x,y,z) } bump_size Bump_Strength/2 } } // Layer 2 Color, normal. The underlying layer transmits by values based on reflection_map #declare Layer_2=texture { pigment { average pigment_map { [ 1 Color_Map2 ] [ 1 function { Reflection_Map(x,y,z) } color_map { [ 0 rgbt 0 ] [ 1 transmit 2 ] } ] } } finish { ambient 0 } normal { function { Bump_Map(x,y,z) } bump_size Bump_Strength/2 } } // Layer 3 Filter. Subtracts specular color #declare Layer_3=texture { pigment { rgbft <0,0,0,.5,.5>+Specular_Subtract } finish { ambient 0 } } // Final texture #local Layers=texture { Layer_1 } texture { Layer_2 } texture { Layer_3 }; Layers #end // USER INPUT #declare Color_Map=function { pigment { bumps color_map { [ 0 rgb .9 ] [ 1 rgb .65 ] } } } #declare Bump_Map=function { pattern { granite scale .5 } } #declare Reflection_Map=function { pattern { granite scale .5 } } #declare Bump_Strength=0; // Negative strength inverts bump map #declare Reflection_Amount=0; #declare Metallic_Amount=0; #declare Specular_Amount=.8; #declare Specular_Roughness=.05; #declare Specular_Filter=<0,0,1>; // filters specular & reflection #declare Blue=Make_Texture() #declare Specular_Filter=<1,1,0>; #declare Specular_Amount=.6; #declare Yellow=Make_Texture() #declare Color_Map=function { pigment { bumps color_map { [ 0 rgb .6 ] [ 1 rgb 1 ] } } } #declare Specular_Filter=<0,1,0>; #declare Specular_Amount=.4; #declare Specular_Roughness=.18; #declare Bump_Strength=.13; #declare Green=Make_Texture() #declare Color_Map=function { pigment { granite scale .5 color_map { [ 0 rgb .6 ] [ 1 rgb 0 ] } } } #declare Specular_Filter=<1,0,0>; #declare Specular_Amount=.8; #declare Specular_Roughness=.7; #declare Bump_Strength=-.3; #declare Red=Make_Texture() sphere { <-1,1,0>,1 texture { Blue } } sphere { <-1,-1,0>,1 texture { Yellow } } sphere { <1,1,0>,1 texture { Green } } sphere { <1,-1,0>,1 texture { Red } }