POV-Ray : Newsgroups : povray.newusers : color_map : Re: color_map Server Time
30 Jun 2024 04:25:08 EDT (-0400)
  Re: color_map  
From: ltong
Date: 28 Aug 2012 01:35:07
Message: <web.503c57dff6ca84721cd19dea0@news.povray.org>
ok, after some experimentation, the result looks much better. seems value_n is
defined as 1-min(1,Fn). Don't know how to attach a pic here, below follows the
code.

   #declare FALLOFF  = 1.3; // just an example, toy with it
   #declare a = 0.7;
   #declare b = 0;
   #declare c = 0.44;
   #declare FnRadial = function(r) {a*exp(-(r-b)*(r-b)/2/c/c)}
   #declare FnAxial  = function(z) {1/(1+(FALLOFF*z*FALLOFF*z))}

   // helper function to compute radius from x,y
   #declare FnR = function(x,y) { sqrt(x*x+y*y) }

   // the resulting 3D function
   #declare Fn = function(x,y,z) { FnRadial(FnR(x,y)) * FnAxial(z) }

object {gauss
  hollow
  pigment { color rgbt<1, 1, 1, 1> }
  interior {
    media {
      emission color rgb < 1.0, 0.0, 0.0>
      density{ function {Fn(x,z,y)}
               color_map {
                  [0 color rgb <0.0, 0.0, 0.0>]
                  [1.0 color rgb <1.0, 0.0, 0.0>*1.2]
                         }
             } // end density
     }//end of media
    } //end interior
   scale <1,1,1>*1.5
   translate<0,2.0,0.0>
} //end object


Post a reply to this message

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