//Eye material for the cornea:
//---------------------------
#declare F_EyeTrans=
finish {
  specular 1
  roughness 0.001
  ambient 0
  diffuse 0
  reflection 0.05
}

#declare I_EyeTrans =
interior { ior 1.5 }

#declare T_EyeTrans =
texture {
  pigment { rgbf<1.0, 1.0, 1.0, 0.7> }
  finish  { F_EyeTrans }
}

#declare M_EyeTrans =
material {
  texture { T_EyeTrans }
  interior { I_EyeTrans }
}
 
//==================================================
//Ive's skin texture:
//------------------

//use this for the figure (on/off):
#declare Ive = on;

/*For the on/off switch, change the corresponding figure's materials by adding:
#if (Ive)
  material {M_....}
#else
  code of original material
#end
*/

//--------------------------------------------------------
//Controls the skin's hue and shininess (specular intensity):
#declare SkinColor = <237, 199, 177>/255;
#declare SkinOil   = 0.1;

//--------------------------------------------------------
//The basic image maps (change the p_map.. to need):
#declare PP_Head = pigment {pigment_multiply(p_map4,pigment {srgb SkinColor})}  //diffuse map
#declare S_Head  = pigment{p_map16}  //use the same diffuse map or a saturation map (if provided)
#declare N_Head  = normal {p_map5}

#declare PP_Body = pigment {pigment_multiply(p_map1,pigment {srgb SkinColor})}  //diffuse map
#declare S_Body  = pigment{p_map15}  //use the same diffuse map or a saturation map (if provided)
#declare N_body  = normal {p_map2}

//--------------------------------------------------------
//This can be used when not using image maps:
#local C_Face_0 = srgb SkinColor * 1.05;
#local C_Face_1 = srgb SkinColor * 0.95;

#local P_Face = 
pigment {
   pigment_pattern {uv_mapping PP_Head}
   pigment_map {
     [0 C_Face_0 transmit 0.1]
     [1 C_Face_1 transmit 0.3]
   }
}

//--------------------------------------------------------
//The normal maps (change bump_size to need):
#local N_Face = 
normal {
   uv_mapping N_Head 
   bump_size 1
}

//if lips are defined separately in Poser:
#local N_Lips = 
normal {
   uv_mapping N_Head 
   bump_size 2
}

#local N_Body = 
normal {
   uv_mapping N_body
   bump_size 1
}

//--------------------------------------------------------
//The finish:
#local F_Skin_S0 = 
finish {
   ambient 0  diffuse 1
   specular 0.01 roughness 0.011  //for very shiny/wet skin, increase roughness
   //phong 0.01  phong_size 2
   brilliance 1
   reflection {0.0, 0.01 fresnel on falloff 1.0 exponent 1.0} 
   conserve_energy
}

#local F_Skin_S1 = 
finish {
   ambient 0  diffuse 1 - 0.1 * SkinOil
   specular 0.01 + 0.75 * SkinOil roughness 0.006  //for very shiny/wet skin, increase roughness
   //phong 0.01 + 0.5 * SkinOil  phong_size 5
   metallic 0.4 brilliance 1.05
   reflection {0.01, 0.1 * SkinOil fresnel on falloff 1.0 exponent 1.0 metallic 0.4}  //for very shiny/wet skin, increase max reflection
   conserve_energy
}

//--------------------------------------------------------
//The textures for the different body parts:
#local T_Head_S0 = 
texture {
   pigment {uv_mapping PP_Head}//instead of {P_Face}
   normal {N_Face}
   finish {F_Skin_S0}
}

#local T_Head_S1 = 
texture {
   pigment {uv_mapping PP_Head}//instead of {P_Face}
   normal {N_Face}
   finish {F_Skin_S1}
}

#local T_Lips_S0 = 
texture {
   pigment {uv_mapping PP_Head}//instead of {P_Face}
   normal {N_Lips}
   finish {F_Skin_S0}
}

#local T_Lips_S1 = 
texture {
   pigment {uv_mapping PP_Head}//instead of {P_Face}
   normal {N_Lips}
   finish {F_Skin_S1}
}

#local T_Body_S0 = 
texture {
   pigment {uv_mapping PP_Body}//instead of {P_Face}
   normal {N_Body}
   finish {F_Skin_S0}
}

#local T_Body_S1 = 
texture {
   pigment {uv_mapping PP_Body}//instead of {P_Face}
   normal {N_Body}
   finish {F_Skin_S1}
}

#local T_Nails_S0 = 
texture {
   pigment {uv_mapping PP_Body}//instead of {P_Face}
   finish {F_Skin_S0}
}

#local T_Nails_S1 = 
texture {
   pigment {uv_mapping PP_Body}//instead of {P_Face}
   finish {F_Skin_S1}
}

//--------------------------------------------------------
//The final materials for the different body parts:
#local M_Head = 
material {
   texture {
     pigment_pattern {uv_mapping S_Head}
     texture_map{
       [0 T_Head_S0]
       [1 T_Head_S1]
     }
   }
   interior {ior 1.33}
}

#local M_Lips = 
material {
   texture {
     pigment_pattern {uv_mapping S_Head}
     texture_map{
       [0 T_Lips_S0]
       [1 T_Lips_S1]
     }
   }
   interior {ior 1.33}
}

#local M_Body = 
material {
   texture {
     pigment_pattern {uv_mapping S_Body}
     texture_map{
       [0 T_Body_S0]
       [1 T_Body_S1]
     }
   }
   interior {ior 1.33}
}

#local M_Nails = 
material {
   texture {
     pigment_pattern {uv_mapping S_Body}
     texture_map{
       [0 T_Nails_S0]
       [1 T_Nails_S1]
     }
   }
   interior {ior 1.33}
}