POV-Ray : Newsgroups : povray.binaries.animations : Cyclic fire animation (~80kbu) : Re: Cyclic fire animation (~80kbu) Server Time
5 Nov 2024 01:26:15 EST (-0500)
  Re: Cyclic fire animation (~80kbu)  
From: Warp
Date: 17 Jul 2000 11:28:47
Message: <3973262f@news.povray.org>
Well, the idea is quite simple.
  Some people said that the fire looks too smooth and regular. Well, I didn't
spend much time making a good-looking fire, but I just wanted to show that
the idea of cyclic fire animation works. The idea should be easily applicable
to almost any other fire animation.

  I made the fire with a media with a density function like this:

noise3d(x*5, y*5-clock*10, z*5)*exp(-sqr(x)-sqr(y)-sqr(z))

  Now, this makes a fire very similar to the one in the animation, but it's
not cyclic.
  The idea behind this function is that the y-parameter of the noise3d is
translated with the clock, thus creating the upwards movement of the function.
  To get a cyclic animation we need to get the same function in the last
frame as in the first one (well, the same if we are not using +KC).
  So we need another similar function that will have the same value with
clock being 1 as the abobe function with the clock being 0. Also the direction
and speed of the movement should be equal. This function is:

noise3d(x*5, y*5+10-clock*10, z*5)*exp(-sqr(x)-sqr(y)-sqr(z))

  Now we have to interpolate between these two functions so that when the
clock is 0 only the first function is in effect and when clock is 1 only the
second one is in effect. The linear interpolation function is the usual:

F1*(1-clock)+F2*clock

  I wasn't sure if this would work well (because for example when interpolating
image maps it doesn't morph between the images but just fades between them,
and here what we want is more like morphing than fading), but it seems to
work very well.

  And here is the povray code for the animation I posted:

#version Unofficial MegaPov 0.5;

camera { location -y-z*6 look_at 0 }

#declare F1 =
  function { noise3d(x*5,y*5-clock*10,z*5) }
#declare F2 =
  function { noise3d(x*5,y*5+10-clock*10,z*5) }

sphere
{ 0, 2
  hollow no_shadow pigment { rgbt 1 }
  interior
  { media
    { emission .5
      density
      { function
        { (F1(x,y,z)*(1-clock)+F2(x,y,z)*clock)*exp(-sqr(x)-sqr(y)-sqr(z))
        }
        density_map
        { [0 rgb 0]
          [.1 rgb <1,0,0>]
          [.2 rgb <1,1,0>]
          [1 rgb 1]
        }
      }
      method 3
    }
  }
  scale <1,2,1>
  translate -y
}

light_source { 0,2 }

difference
{ sphere { 0,2 }
  sphere { 0,1.8 }
  box { <-2,0,-2><2,2,2> }
  pigment { rgb <1,.6,.3> }
  scale 1.2 translate -y*1.5
}
light_source { <100,50,-200>, .5 }


-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

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