|
|
Renuka nous apporta ses lumieres en ce 24 / 05 / 2007 07:15:
> Dear All,
> I want to animate the color changing of cube.
>
> This is the simple code I use,
> #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 {
> texture{pigment{rgb < 6.1 , 2 , 2 > }}
> texture{pigment{rgb < 0 , 2 , 2 > }}
> texture{pigment{rgb < .5 , 2 , 2 > }}
> texture{pigment{rgb < .2 , 2 , 2 > }}
> texture{pigment{rgb < .6 , 2 , 2 > }}
> texture{pigment{rgb < 11 , 2 , 2 > }}
> texture{pigment{rgb < .2 , 2 , 2 > }}
> texture{pigment{rgb < .2 , 2 , 2 > }}
>
> }
> 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> }
>
> Here I each time frame (say 1 Sec interval) I want to change the color.
> These color values dont have any mathematical relation, I should give
> myself. Say, if I have 10 set of colors, how can I animate this color
> change?
>
> Please help me!!!!!!!!!!!
>
> Thanks a lot in advance.
>
> I read in this forum, it suggested that to use csv file format include file
> for color change, each line color data refer to each frame. I dont
> understand well that point too. If anybody can help me that regard also
> useful for me.
>
> Regards,
> Renuka.
>
>
If you only have 10 sets of textures, you can use the
#switch(frame_number)/#case(Value)/#break structure with 10 entries.
If you have another situation, it may be beter to use splines for your colours.
This enable you to use any arbitrary number of textures with any arbitrary
length animation. Each spline don't have to have the same number of control
points, only the same starting and ending values. One may be a linear_spline and
another a natural_spline.
Once you have all your splines deffined, you travel along them using the clock
system variable (range from 0 to 1 unless set otherwize)
By the way, colour vectors values normaly go from 0 (0%) to 1 (100%). The
colours in your sample will get clipped to that range. For example, rgb<11,2,2>
will render as rgb<1,1,1>. If your original range is 1 to 255, you need to
divide your colours by 255 to avoid problems.
--
Alain
-------------------------------------------------
Practical: Deal with shit one day at a time.
Post a reply to this message
|
|