POV-Ray : Newsgroups : povray.general : halo conversion question : Re: halo conversion question Server Time
13 Aug 2024 19:29:51 EDT (-0400)
  Re: halo conversion question  
From: Chris Colefax
Date: 17 Jul 1998 11:11:04
Message: <35AF3584.3576F7DD@geocities.com>
Dan Connelly wrote:
> 
> I apologize for all the questions, but I have been struggling
> with making a fog of a decaying exponential density for some
> time now.  And the issue of media has been brought up
> by other posters.
> 
> I finally figured it out, I think, but within the halo
> framework -- I can't figure out how to convert it into
> 3.1 compliance.  It looks as though my current project
> will be in 3.02 TM unless I can figure out the conversion.
> 
> A halo solution is the following.  Note the exponential
> behavior is effected through the transparancy channel of
> the halo color map.
> 
> Any ideas on converting this into media?

While I won't claim to be an expert at either halos or media, the
following seems to at least approach what you achieved under POV-Ray 3.0
(see original at the end of the message):

   #declare dY =0.05;
   #declare A = 5;

   box {<-0.5, 0, -0.5>, <0.5,  1, 0.5> hollow
      pigment { rgbf 1 }
      interior { media { absorption <1, 1, 1> emission <0, 1, 0>
         density {planar
            color_map {
               #declare Y = 0; #while (Y < 1 + dY/2)
                  [Y rgb exp(-A*(1-Y))]
               #declare Y = Y + dY; #end }
            }}}}

This seems to work because, as the docs explain, the color_map value at
any point is multiplied by the absorption and emission values to get the
final colour.  Therefore, at Y = 0 (which, with the planar pattern,
actually equates to a height of 1 up the y-axis), the color_map value
is  close to 0 (using the above A value).  This brings the absorption
and emission values close to 0, giving a practically transparent media
(at the top of the box).  At Y = 1 (the bottom of the box), the
color_map value is 1, giving the full absorption and emission specified.

I'm sure there are many other ways of achieving the same (or better!)
results, but hopefully this is helpful in some way (it was for me, at
any rate...)


// Originally posted scene

#version 3.0
#declare Camera_Location = <1.5, 0.7, -2>;

camera {
  location Camera_Location
  look_at <0, 0.5, 0>
}
light_source {
  Camera_Location
  color rgb 0.5
}
light_source {
  <-100, 100, -100>
  color rgb 0.5
}

box {
  <-0.5, 0, -0.5>,
  <0.5,  1, 0.5>
  hollow
  pigment { rgbf 1 }
  halo {
    attenuating
    planar_mapping
    linear
    max_value 1
    color_map {
      #declare Y = 0;
      #declare dY =0.05;
      #declare A = 5;
      #while (Y < 1 + dY/2)
        [Y rgbt <0, 1, 0, 1-exp(-A*(1-Y))>]
        #declare Y = Y + dY;
      #end
    }
  }
}

plane {
  y,
  0
  pigment {
    color rgb <1, 1, 1>
  }
}

sky_sphere {
  pigment { color rgb 1 }
}


Post a reply to this message

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