|
|
pour ma part je le ferais comme ceci :
To copy and to run directly in ".pov" format.
#declare PosCam=4 ;
#declare Rep=0 ;
#declare camx=-4;
#declare camy=0;
#declare camz=4;
#declare dcamx=0;
#declare dcamy=0;
#declare dcamz=0;
#if (PosCam=1)
light_source {<camx,camy, camz> rgb< 1, 1, 1>}
#end // du if
camera{ //________________________________
#switch(PosCam) // |
#case(1) //de loin
location <camx,camy,camz>
look_at <dcamx,dcamy,dcamz>
#break
location <0, 10, 0>
look_at <0, 0, 0>
#break
location <5, 0, 5>
look_at <0, 0, 0>
#break
#case(4) //de dessus
location <0, 0, -8>
look_at <0, 0, 0>
#break
#case(5) //base du tronc
location <5,5, 5>
look_at <0, 0, 0>
#break
#end
}//_______________________________________|
//____________________________________
light_source // (Principale) |
{<26,10, +9> rgb< 2, 2, 2>}
light_source // (diffuse1)
{<0,0, 0> rgb<1,1,1>}
light_source // (diffuse2)
{<-6,-10,-9> rgb<1,1,1>}
//____________________________________|
#if (Rep=1)
//#########################################################################################################################
sphere{ <4, 0, 0> 0.25 pigment {rgb <0,3,3>}}
sphere{ <0, 4, 0> 0.25 pigment {rgb <0,3,3>}}
sphere{ <0, 0, 4> 0.25 pigment {rgb <0,3,3>}}
box // axe des X
{ <-20, 0, 0>< 20, 0.1, 0.25>
pigment {rgb <1,0,0>}}
box // axe des Y
{ <0, -30, 0><0.25, 30, 0.25>
pigment {rgb <0,1,0>}}
box // axe des Z
{ <0, 0, 20> <0.25, 0.1, -30>
pigment {rgb <0,0,1>}}
#end
//****************************************
background {rgb <0.4,0.5,0.6>} // ciel plus sombre
//------------------------Objets:---------------------------
#macro cercle(fin,nbsph)
#declare pas=fin/nbsph;
#declare dim=2.5
#declare compt=0
object{union{
#while (compt<=fin)
#if (compt<(fin/2))
#declare bleu=(2*compt)/fin
#declare rouge=1-(2*compt)/fin
#else
#declare bleu=2-(2*compt)/fin
#declare rouge=(2*compt)/fin-1
#end
sphere { <dim*cos(2*pi*compt/fin), dim*sin(2*pi*compt/fin), 0> 0.125
pigment {rgb<rouge,0,bleu>}}
#declare compt=compt+pas;
#end //---------- de While
} // de union
} // de object
#end //------------ de Macro plante
object {cercle(10,50) rotate <0,0,-90>}
//--------------------------------------------------fin code
> I'm fairly new to Povray. Well I'm just actually trying to learn
> it. I'm trying to create a circle of spheres that change color. I want
> it to go from red to blue at the bottom of the loop. Then from blue to
> red. So it all blends together. Here is the code i came up with to do
> this. Is there an easier way? This does not work completely yet I
> can't get it to go back to red.
>
> #declare Count = 0 ;
> #while(Count < 36)
> object {YellowSphere
> pigment{
> #if(Count <= 18)
> color < (1-.027*(2*Count)), 0, ((2*Count)*.027)>
>
> #else
>
> color < abs(1-((2*Count)*.027)), 0,
> ((Count)*.027) >
>
> #end}
> rotate z*10*Count
>
> translate <0, 0, 2>
>
> }
> #declare Count = Count + 1 ;
>
> #end
Post a reply to this message
|
|