POV-Ray : Newsgroups : povray.general : Animating Color Maps : Re: Animating Color Maps Server Time
6 Aug 2024 19:27:25 EDT (-0400)
  Re: Animating Color Maps  
From: Warp
Date: 11 Feb 2002 23:25:39
Message: <3c689943@news.povray.org>
Mitchell Waite <mit### [at] dnaicom> wrote:
: Is there a way to animate a color map in POV Ray. In other words say I have
: a terrain aerial map in color. I want to make an animation showing the color
: of the trees going from green to brown and snow to appear. I can paint up
: different color maps but how would I get them to change in POV Ray?

  You can try something like this:

#declare Colors1 = array[3] { <0,0,0>, <1,0,0>, <1,1,0> }
#declare Colors2 = array[3] { <0,1,0>, <1,1,0>, <1,1,1> }
...
  color_map
  { #declare ColorsAmnt = dimension_size(Colors1, 1);
    #declare Ind = 0;
    #while(Ind < ColorsAmnt)
      #declare factor = Ind/(ColorsAmnt-1);
      [factor Colors1[Ind]*(1-factor)+Colors2[Ind]*factor]
      #declare Ind = Ind+1;
    #end
  }

  Note that it works only if both color maps have the same number of
colors. Adding support for color maps with differing amount of colors makes
the problem a quite more complicated (but not impossible).
  Also if the colors are not distributes equally in the color_map, it would
need extra arrays for the index values.

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

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