// POVRAY ||| COURS N¡2 07/11/2006 // BIBLIOTHEQUE #include "lib.inc" #macro test_textures() object { difference { box { <-1/2,-1/2,-1/2>, <1/2,1/2,1/2> scale <1,1,1> } cylinder { <0,-1,0>, <0,1,0>, 1/4 rotate <-45,30,0> } } //sphere { <0,0,0>, 1/2 } //cylinder { <0,-1/2,0>, <0,1/2,0>, 1/2 } //cone { <0,-1/2,0>, 1/2, <0,1/2,0>, 1/8 open } //superellipsoid { <1/8,1/8> scale 1/2 } texture { pigment { granite // marble granite wood color_map { [ 0.0 color rgbt <1,1,1,0> ] [ 1.0 color rgbt <0,0,0,0> ] } scale 1/4 } finish { ambient 0.3 diffuse 0.7 specular 0.7 roughness 0.01 reflection 0.0 } } } #end #macro spot( position, cible, cone_lumiere, taille_spot, couleur ) light_source { position // position de la source lumineuse color rgb <1,1,1> // couleur emise par la source lumineuse spotlight // type de source lumineuse point_at cible // direction du spot radius cone_lumiere // angle interieur du cone lumineux tightness 0 // intensitŽ du faisceau 0 ˆ 100 falloff cone_lumiere // angle exterieur du cone lumineux looks_like { sphere { 0, taille_spot } texture { pigment { color rgb couleur } finish { ambient 1 } } } } #end #macro test_spots( N ) #local i=0; #while (i, , 20, 0.05, ) #local i=i+1; #end #end #macro fond_ciel() sky_sphere // Create an infinite sphere around scene and allow any pigment on it { pigment { marble color_map { [0.0 color rgb 0.5] [1.0 color rgb 0.2 ] } scale 1/8 turbulence 1 } } #end #macro plateau( taille ) object { box { <-1/2,-1/2,-1/2>, <1/2,1/2,1/2> scale <1,1/16,1> } texture { pigment { checker color rgb <0.2,0.2,0.2> color rgb <0.8,0.8,0.8> scale 1/8 } finish { ambient 0.2 diffuse 0.7 specular 0.7 roughness 0.01 reflection 0.5 } } normal { granite //marble, granite, wood bump_size 1/8 turbulence 0 // 1, 0, 0 scale 1/8 } scale taille } #end #macro glass() object { difference { cylinder { <0,0.0,0>, <0,0.5,0>, 0.150 } cylinder { <0,0.1,0>, <0,0.6,0>, 0.140 } } texture { pigment { image_map { gif "joe.gif" once } rotate <0,90,0> translate <0,2,0> scale 1/8 } finish { ambient 0.2 diffuse 0.7 specular 0.6 roughness 0.01 } } texture { pigment { color rgbt <1,1,1,0.95> } finish { ambient 0.2 diffuse 0.7 specular 0.7 roughness 0.01 reflection 0 } } normal { granite //marble, granite, wood bump_size 1/32 turbulence 1 // 1, 0, 0 scale 1/16 } interior { ior 1.3 } } #end #macro liquide( couleur ) object { cylinder { <0,0.11,0>, <0,0.4,0>, 0.139 } scale 0.999 texture { pigment { color rgbt couleur } finish { ambient 0.3 diffuse 0.9 specular 0.7 roughness 0.01 reflection 0 } } interior { ior 1.2 caustics 0.1 } } #end #macro paille() object { cylinder { <0,0.11,0>, <0,0.7,0>, 0.005 } texture { pigment { checker color rgbt <1,0,0> color rgbt <0,1,0> scale 1/32 } finish { ambient 0.3 diffuse 0.9 specular 0.7 roughness 0.01 reflection 0 } } rotate <15,0,0> } #end #macro quatre_verres() union { glass() liquide( <2,2,0,0.9> ) paille() translate <-1/4, 0, -1/4> } union { glass() liquide( <0,2,2,0.9> ) paille() translate < 1/4, 0, -1/4> } union { glass() liquide( <2,0,2,0.9> ) paille() translate <-1/4, 0, 1/4> } union { glass() liquide( <2,0,0,0.9> ) paille() translate < 1/4, 0, 1/4> } #end #macro quatre_spots() object { spot( <0, 1/2, -1/4>, <0, 0, -1/4>, 40, 0.02, <1,1,1> ) rotate <0,0,0> } object { spot( <0, 1/2, -1/4>, <0, 0, -1/4>, 40, 0.02, <1,1,1> ) rotate <0,90,0> } object { spot( <0, 1/2, -1/4>, <0, 0, -1/4>, 40, 0.02, <1,1,1> ) rotate <0,180,0> } object { spot( <0, 1/2, -1/4>, <0, 0, -1/4>, 40, 0.02, <1,1,1> ) rotate <0,270,0> } #end #macro test_multi_textures() object { difference { superellipsoid { <1/16,1/16> } cylinder { <0,1,-10>, <0,1,10>, 2/3 } } texture { pigment { granite //marble, granite, wood color_map { [ 0.0 color rgbt <1,0.8,0.5,0> ] [ 1.0 color rgbt <0.3,0.2,0,0> ] } turbulence 0 // 1, 0, 0 } normal { granite //marble, granite, wood bump_size 1/2 turbulence 0 // 1, 0, 0 } finish { ambient 0.2 diffuse 0.7 specular 0.6 roughness 0.01 } scale 1/8 rotate <10,0,0> translate <0,-1.25,0> } texture { pigment { image_map { gif "joe.gif" once } translate <-0.5,-0.5,0> scale 1.5 } finish { ambient 0.2 diffuse 0.7 specular 0.6 roughness 0.01 } } scale 1/2 rotate <0,15,0> } #end // SCENE camera { location <-0.8,1,-1> look_at <0,0,0> scale 1/1.25 } //camera { orthographic location <-0.8,1,-1> look_at <0,0,0> } //background { color rgb 2/4 } fond_ciel() light_source { <-1,1,-1> color rgb <1,1,1> } light_source { <1,1,-1> color rgb <1,1,1> } light_source { <0,1,5> color rgb <1,1,1> } axes( 1 ) //chainon() //boite() //cubix( 4 ) //cubix_intersection() //test_textures() plateau( 2 ) quatre_verres() //quatre_spots()