POV-Ray : Newsgroups : povray.text.scene-files : Media density mapping Server Time
26 Jun 2024 04:28:44 EDT (-0400)
  Media density mapping (Message 1 to 1 of 1)  
From: A J Le Couteur Bisson
Subject: Media density mapping
Date: 1 Feb 2003 15:20:36
Message: <3e3c2c14@news.povray.org>
In the scene below I am using media to place a glow around a plasma beam.
Is it possible to cause the density of the glow to fall off radially from
the
sphere-sweep axis?  The radial map seems to apply to the entire sweep from
the origin (as I would expect) rather than from the sweep axis.

Thanks,
Andy

P.S. I know its a big example but its also quite pretty!

// Persistence of Vision Ray Tracer Scene Description File
// File: Plasma Instability.pov
// Vers: 3.5
// Desc: Unstable Plasma in a Cyclotron
// Date: 1 Feb 2003
// Auth: A J Le Couteur Bisson
//


// The author cannot be held responsible for changes to
// parameter setting which would cause the plasma to breach
// its containment.  You may wish to add a lead-lined box
// to the scene description.      8-)

#version 3.5;

#include "colors.inc"
#include "textures.inc"
#include "rand.inc"

global_settings
{
  assumed_gamma 1.0
}

// ----------------------------------------

camera {
  location  <11.0, 1.0, -1.5>
  direction 1.5 * z
  right     x * image_width / image_height
  look_at   <6.0, 0.0,  -10.0>
}

light_source
{
  <0, 0, -10>
  color Red + Blue
  media_attenuation off
  media_interaction off
}

light_source
{
  <0, 0, 10>
  color Blue * 2
  media_attenuation off
  media_interaction off
}

// ----------------------------------------

torus
{
  10, 2
  texture { Polished_Chrome }
  pigment { color rgb <0.7,0.5,0.3> }
  hollow
}

// Plasma
// A torus created by sphere_sweep is randomly displaced by values
// generated by VRand_In_Sphere.  This constrains the plasma to a torus
// of given minor radius and biases the points to the centre - Good Value!!
#declare step = 5;
#declare npts = floor(360 / step) + 1;
#declare plasma_pts = array[npts];

#declare n = 0;
#while (n < npts)
    #declare plasma_pts[n] = vrotate(VRand_In_Sphere(RdmA) *
                             <0.3, 0.3, 0> -
                             <10, 0, 0>,
                              n * step * y);
  #declare n = n + 2;
#end

// Interpolate control points
#declare n = 1;
#while (n < npts - 1)
    #declare plasma_pts[n] = (plasma_pts[n - 1] + plasma_pts[n + 1]) / 2.0;
  #declare n = n + 2;
#end

// Just checking...
#declare n = 0;
#while (n < npts - 1)
    #debug concat(str(plasma_pts[n].x, 5, 2), ", ",
                  str(plasma_pts[n].y, 5, 2), ", ",
                  str(plasma_pts[n].z, 5, 2), "\n")
  #declare n = n + 1;
#end

// Glow
sphere_sweep
{
  cubic_spline,
  npts,

  #declare n = 0;
  #while (n < npts)
    plasma_pts[n], 0.1
    #declare n = n + 1;
  #end

  pigment { colour Yellow filter 1.0  }
  finish { ambient 0 diffuse 0 }
  interior
  {
    media
    {
      emission 1.0
      intervals 1
      samples 5
      method 3
      density { colour Yellow transmit 0.9 }
    }
  }

  hollow
  no_shadow
}

// Plasma
sphere_sweep
{
  cubic_spline,
  npts,

  #declare n = 0;
  #while (n < npts)
    plasma_pts[n], 0.03
    #declare n = n + 1;
  #end

  pigment { colour White }
  finish { ambient 1 diffuse 0 }

  hollow
  no_shadow
}


Post a reply to this message

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