POV-Ray : Newsgroups : povray.advanced-users : Help for animation : Re: Help for animation Server Time
4 Oct 2024 17:06:04 EDT (-0400)
  Re: Help for animation  
From: Alain
Date: 25 May 2007 05:43:01
Message: <4656afa5@news.povray.org>
Renuka nous apporta ses lumieres en ce 25 / 05 / 2007 03:58:
>> Hi Renuka,
>> You could assign the color values to a 2 dimensional array and then use the
>> frame number to select the appropriate array dimension for a specific  frame
>> of the animation.
>>
>> The following example uses a 4 x 8 array where the first dimension stores
>> the number for the frame and the second defines the vertex color.
>> I then used a #while loop to write the color into the appropriate position
>> of the texture list.
>>
>> To read these values from a csv file, (e.g. if the values are generated
>> outside of POVRay) you can create a file in much the same format with 8
>> vectors on each line (no squiggly brackets), then use the 'read' directive
>> to read the appropriate line for a given frame.
>>
>> Hope this helps,
>> Regards,
>> Chris B.
>>
>> camera {location  <20,30,-10> look_at <5,5,5>}
>> light_source {<30, 20, -300> color rgb 1}
>> #declare MyFrameNumber = 1;
>>
>> #declare ColourArray = array[4][8] {
>>  
{<0,1,1>,<0.5,1,1>,<0.8,0.5,0.9>,<1,0.5,0.4>,<0,1,1>,<0.5,1,1>,<0.8,0.5,0.9>,<1,0.5,0.4>}
>>  
{<1,1,0>,<0.5,1,1>,<0.8,0.5,0.9>,<1,0.5,0.4>,<0,1,1>,<0.5,1,1>,<0.8,0.5,0.9>,<1,0.5,0.4>}
>>  
{<1,1,0>,<0.5,1,1>,<0.8,0.5,0.9>,<1,0.5,0.4>,<0,1,1>,<0.5,1,1>,<0.8,0.5,0.9>,<1,0.5,0.4>}
>>  
{<1,1,0>,<0.5,1,1>,<0.8,0.5,0.9>,<1,0.5,0.4>,<0,1,1>,<0.5,1,1>,<0.8,0.5,0.9>,<1,0.5,0.4>}
>> };
>>
>>
>> #declare Box = mesh2{
>>   vertex_vectors{
>>     8,
>>     <0,0,0>,
>>     <10,0,0>,
>>     <10,10,0>,
>>     <0,10,0>,
>>     <0,0,10>,
>>     <10,0,10>,
>>     <0,10,10>,
>>     <10,10,10>,
>>   }
>>   texture_list {
>>     8
>>     #local I = 0;
>>     #while (I<8)
>>       texture{pigment{rgb ColourArray[MyFrameNumber][I]}}
>>       #local I = I + 1;
>>     #end
>>   }
>>   face_indices{
>>     12,
>>     < 0 , 1 , 2 >,0 , 1 , 2  ,
>>     < 2 , 3 , 0 >,2 , 3 , 0   ,
>>     < 0 , 1 , 5 >,0 , 1 , 5   ,
>>     < 5 , 4 , 0 >,5 , 4 , 0   ,
>>     < 0 , 3 , 6 >, 0 , 3 , 6  ,
>>     < 6 , 4 , 0 >,6 , 4 , 0 ,
>>     < 4 , 5 , 7 >,4 , 5 , 7   ,
>>     < 7 , 6 , 4 >, 7 , 6 , 4 ,
>>     < 7 , 2 , 3 >,7 , 2 , 3   ,
>>     < 3 , 6 , 7 >,3 , 6 , 7  ,
>>     < 7 , 5 , 1 >,7 , 5 , 1  ,
>>     < 1 , 2 , 7 >,1 , 2 , 7 ,
>>   }
>> }
>>
>>
>> object { Box
>>  scale <1,1,1>
>> rotate <0,0,0> }
> 
> Hi Charis,
> I am very thankful for your kind help. I tried your coding, but it didnt
> animate. How should I animate your coding? Please help me.
> 
> Thank you.
> 
> Rgds,
> Renuka.
> 
> 
Replace "MyFrameNumber" by frame_number. This sample will only work for a 4 
frame animation.

-- 
Alain
-------------------------------------------------
BACHELOR: A man who never makes the same mistake once.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.