POV-Ray : Newsgroups : povray.animations : Can fog be animated? : Re: Can fog be animated? Server Time
1 Jun 2024 06:48:19 EDT (-0400)
  Re: Can fog be animated?  
From: Tim Nikias
Date: 2 Mar 2006 14:32:08
Message: <44074838@news.povray.org>
> And dont confirm my greatest fears; that it has to be media... for I
cannot
> grasp that function yet.. 8(

Well... Confirmed. Sorry.

> Tim, if you happen to read this, you had some smoke/fog/media moving in
your
> Chasm teaser. That's what I wanna do, but with ground fog!

That was media.

> (Almost) Any answer is highly respected and
> heavily appreciated. ( <-- or sumthing )

So, here's the code for the fog in the Chasm Teaser:

#declare Keylight_Pos = vrotate(<9,8,-2>,y*8*Clock);
#declare Black_Fade = 1;
#declare Animation_Time = 1;
#declare Clock = clock;

light_group{
  //Key-Light
  light_source{
    Keylight_Pos rgb 1*Black_Fade
    spotlight point_at <0,2.5,0> radius 15 falloff 30
    media_interaction on
  }

  box{
    <-50,-30,-5>,<20,10,55>
    hollow pigment{rgbt 1}
    interior{
      media{
        scattering{3,.025 extinction 0}
        method 3 intervals 1 samples 35,65
        density{
          bozo color_map{[0 rgb .3][.8 rgb 1][1 rgb 1]}
          scale <2.5,1,2.5> turbulence .1
          translate <-.15,.75,.4>*Animation_Time*Clock
        }
      }
    }
  }
  global_lights off
}

I'll explain it: the light-group is there to ensure that only the one single
light-source illuminates the media (hence also the global_lights off at the
end of the light_group). In the Teaser, I fade the light to fade the fog
shots, was much more intuitive to me.

The fog itself is a box filled with scattering media. Note extintion is set
0, so that the fog doesn't swallow light and thus darken objects that are
behind or in it. I animate the density to move the less thick areas around.
Animation_Time actually is the time in seconds, so you might have to adjust
that for your animation.
In order to turn that fog into ground-fog, you'd simply have to add another
density block:

density{planar color_map{[0 rgb 0][1 rgb 1]}

At y=0 the fog will be thick, at y=1 and -1 the fog will be invisible,
everything in between fades from thick to invisible unless you change the
color_map. Anything above and below y=1 and y=-1 isn't fogged as well. Scale
that density statement, and you also scale the height at which the fog
stops.

It's not that complicated once you read about it and start playing with
code. Getting good settings for artifact-free rendering requires a little
patience and you have to accumulate some experience over time, but media is
a beast worth learning. :-)

Regards,
Tim
-- 
aka "Tim Nikias v2.0"
Homepage: <http://www.nolights.de>


Post a reply to this message

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