POV-Ray : Newsgroups : povray.binaries.animations : media_attenuation of a light source -- animation tests : Re: media_attenuation of a light source -- animation tests Server Time
29 Nov 2022 18:57:02 EST (-0500)
  Re: media_attenuation of a light source -- animation tests  
From: Kenneth
Date: 16 Feb 2018 02:35:01
Message: <web.5a8686cdee9d509da47873e10@news.povray.org>
My code for the scene...

#version 3.71;

global_settings {assumed_gamma 1.0 max_trace_level 5}
#default{finish{ambient 0 emission 0 diffuse 0}}
//-------------------------------
#declare USE_CSG_DIFFERENCE = on; // for differencing a tiny sphere
// from the media sphere, to create a 'void' around light

#declare LIGHT_LOCATION = <-2.6 + 4.2*clock, .1, .1>; // for BOTH the
// point light source AND the tiny differenced sphere;
// they move together
#declare MEDIA_SAMPLES = 20;
#declare SCAT_EXTINCTION = .6; // extinction value for scattering media
#declare LIGHT_INTENSITY = .7; // 0.7 when extinction = 0.0,  0.11 when
// extinction = 0.6

//-------------------------------
camera {
  perspective
  location  <0, .2, -4>
  look_at   <0, .1,  0>
  right     x*image_width/image_height
  angle 67
}

light_source {
  0*x
  color rgb LIGHT_INTENSITY
  looks_like{sphere{0,.05}
       pigment{rgb <1,0,0>}
       finish{ambient 0 emission 1 diffuse 0}
            }
  translate LIGHT_LOCATION
  media_attenuation on
}

sky_sphere{
    pigment{
        average
        pigment_map{
            [1 bozo warp{turbulence .5 omega .5} scale .03*<12,1,1>]
            [70 rgb .01]
                  }
           }
          }

#if(USE_CSG_DIFFERENCE)
difference{
sphere{0,1}
sphere{0, .005 translate LIGHT_LOCATION}
#else
sphere{0,1
#end
hollow on
texture{
    pigment {rgbt 1}
    finish {ambient .2 diffuse 0}
    }
    interior{
        media{
            scattering{1, 3.5 extinction SCAT_EXTINCTION}
            method 3
            intervals 1
            samples MEDIA_SAMPLES
            density{
                spherical
                    color_map{
                            [0.0 rgb 0]  // OUTSIDE SURFACE
                            [0.24 rgb 0]
                            [0.34 rgb 1]
                            [1.0 rgb 1] // CENTER of sphere
                             }
                  //  scale 2.5
                  //  warp{turbulence .8 omega .7}
                  //  scale 1/2.5
                  }
            }
          }
         }

// flat vertical slab to the right
box{0, <0,2.6,2.6>
   translate <0,-1.3,-1.3>
   pigment{rgb 1}
   finish{ambient 0 emission 0 diffuse 1}
   translate 1.8*x
   }

// cylinder embedded in media to the right, to try and show any
// changing light-brightness effects
cylinder{-.015*x, .015*x .1
    pigment{rgb 1}
    scale <1,2,2>
    finish{ambient 0 emission 0 diffuse 1.0}
    rotate <0,-15,-20> translate <.88,-.2,.1>
    }

// to delineate the main sphere's boundary, seen from the camera
// position
torus{1.39, .008
   pigment{rgb <.2,1,.2>} finish{ambient .1 diffuse 0}
   rotate 90*x
   scale .52
   translate <0,.057,-1.2>
   }

text {
#if(USE_CSG_DIFFERENCE)
    internal 1 "WITH small CSG-differenced sphere."
    #else
    internal 1 "NO small CSG-differenced sphere."
    #end
    .001, 0
    scale .17
    no_shadow
    pigment{rgb 1} finish {ambient 0 emission 1 diffuse 0}
    translate <-1.8,1.4,0>
    }

text {
    internal 1
    concat("scattering EXTINCTION = ",str(SCAT_EXTINCTION,0,2))
    .001, 0
    scale .17
    no_shadow
    pigment{rgb 1} finish {ambient 0 emission 1 diffuse 0}
    translate <-1.8,1.2,0>
    }

text {
    internal 1
    concat("light: rgb  ",str(LIGHT_INTENSITY,0,2))
    .001, 0
    scale .17
    no_shadow
    pigment{rgb 1} finish {ambient 0 emission 1 diffuse 0}
    translate <-1.8,1.0,0>
    }


Post a reply to this message

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