#include "colors.inc"
light_source { <6,15,-7> color rgb <0.95,0.95,1> shadowless}
light_source { <-6,15,-6> color rgb <1,1,1> }
//light_source { <-1.,1.6,-0.2>*20 color rgb <1,0.8,0>*0.4 shadowless}
background { SkyBlue*1.2 }
camera {orthographic location <0,1.5,-5>
look_at <0,0.8,0>
}
// ------------ les textures -----------------------
#declare ecorce=texture {
pigment { granite
color_map {
[0.1 color rgb <0.7,0.5,0.5> ]
[0.5 color White*0.5 ]
} scale 0.1 }
normal {
granite 2
turbulence 0.2
scale 0.4
accuracy 1
}
finish { diffuse 0.8
ambient 0.5
}
} // fin texture ecorce
#declare herbe=texture {
pigment { crackle
color_map {
[0.1 color Green ]
[0.5 color rgb <0.,1,0.3> ]
} }
normal {
granite 2
turbulence 0.5
scale 0.4
accuracy 0.0001
}
finish { diffuse 0.2
ambient 0.4
}
scale <0.0001,1,0.0001>
} // fin texture herbe
#declare neige=texture {
pigment { marble
color_map {
[0.2 color White*0.999 ]
[0.5 color White ]
}
turbulence 0.5
scale <1,5,1>
}
normal {
granite 0.7
accuracy 0.0001
turbulence 0.2
scale 8
}
finish { ambient 0.5 diffuse 0.7 }
} //texture neige
//----------------- le ciel --------------
plane{ z,8 pigment {gradient y
color_map {
[0.1 color rgb <0.9,0.8,0.7> ]
[0.5 color SkyBlue*0.9 ] }
scale 3.5 translate -1*y}
finish {ambient 0.65 diffuse 0.3 roughness 0.0001 }
}
//------------------- le sol -------------
plane{ y,-1
texture { herbe} // neige pour le paysage d'hiver
} //plane
//------------------------ arbre 1 ---------------------
#declare alea=seed(0);
#declare rap1=1;
# declare r=0.3;
#declare a=0.25;
#declare b=0.08;
#declare c=-0.2;
#macro arbre1(n,p)
#if (n=1)
union {cone{<0,0,0>,r/pow(p-n,rap),<0,1,0>,r/pow(p-n+1,rap)
texture{ ecorce scale 0.02}}
//------ supprimer les deux polygon pour supprimer les feuilles
polygon{7, <0,1,0>,,<2*a,1+2*b,a>,<3*a,1+3*b,0>,<2*a,1+2*b,-a>,,<0,1,0>
pigment { Green*0.7 }}
polygon{7, <0,1,0>,,<2*c,1+2*b,c>,<3*c,1+3*b,0>,<2*c,1+2*b,-c>,,<0,1,0>
pigment { Green*0.85 }}
//-------------------------------
}
#else
union{ union{
#declare rap=pow(rap1,1/(n+3));
object{ arbre1(n-1,p) rotate <30,0,0> scale 0.8}
object{ arbre1(n-1,p) rotate <-50,0,-30> scale 0.75}
object{ arbre1(n-1,p) rotate <10,0,40> scale 0.65}
#declare scmax=0.9 ; // le max des 3 précédents
sphere{ 0,r/pow(p-n+1,rap)*scmax texture{ ecorce scale 0.02}}
translate 1*y
rotate 360*rand(alea)*y }
cone{<0,0,0>,r/pow(p-n,rap),<0,1,0>,r/pow(p-n+1,rap)*scmax
texture{ ecorce scale 0.02}}
}
#end
#end
#declare p=11;
object{ arbre1(p,p+2)
scale 1.1
rotate 5*y
translate <0,-1,1>
}
//------------------------ fin arbre 1 ---------------------
/*
//------------------------ arbre 2 ---------------------
//plutôt que mettre de multiples paramètres à arbre1, j'ai préféré ecrire
// une autre macro
#declare alea=seed(0);
#declare rap=0.65;
# declare r=0.1;
#macro arbre2(n,p)
#if (n=1) cone{<0,0,0>,r/pow(p-n,rap),<0,1,0>,r/pow(p-n+1,rap)}
#else
union{ union{
object{ arbre2(n-1,p) rotate <-5,0,0> scale 0.9}
object{ arbre2(n-1,p) rotate <15,0,0> scale 0.6}
object{ arbre2(n-1,p) rotate <-20,0,10> scale 0.55}
object{ arbre2(n-1,p) rotate <15,0,20> scale 0.3}
#declare scmax=0.8; // le max des précédents
sphere{ 0,r/pow(p-n+1,rap)*scmax}
translate 1*y
rotate 360*rand(alea)*y } //pow(5*n,3.32)*y}// pour mettre un peu de desordre
// je n'ai pas su faire fonctionner rand
cone{<0,0,0>,r/pow(p-n,rap),<0,1,0>,r/pow(p-n+1,rap)*scmax}
}
#end
#end
#declare p=8;
#declare unarbre= object{ arbre2(p,p+2)
texture{ ecorce scale 0.02}
}
union {
object{ unarbre
scale 1. translate <0,-1,-1>}
object{ unarbre
scale 0.8
rotate 70*y translate <1,-1,0.5>}
object{ unarbre
scale 0.6 rotate 120*y translate <-1.,-1,4>}
object{ unarbre
scale 0.4 rotate 100*y translate <0.5,-1,3>}
object{ unarbre
scale 0.7 rotate 55*y translate <-0.5,-1,2.5>}
object{ unarbre
scale 0.6 rotate 160*y translate <-0.3,-2.2,2.5>}
object{ unarbre
scale 0.4 rotate 180*y translate <0.3,-2,3.2>}
texture{ neige scale 0.02}
scale 0.8
translate -2*z }
//------------------------ fin arbre 2 ---------------------
*/