POV-Ray : Newsgroups : povray.general : Help needed with 'media' : Re: Help needed with 'media' Server Time
13 Aug 2024 01:16:12 EDT (-0400)
  Re: Help needed with 'media'  
From: =Bob
Date: 1 Dec 1998 16:39:14
Message: <36646202.0@news.povray.org>
Here's a revamped script:

/* Smoothness factor [1=grainy, 2=rough, 3=default, 4=smooth */

#declare G = 2;

#switch (G)
#case (1)
#declare Granularity = 2;
#break
#case (2)
#declare Granularity = 5;
#break
#case (3)
#declare Granularity = 10;
#break
#case (4)
#declare Granularity = 20;
#break
#end

camera
{
  location  <0.0 , 4.0 ,-8.0>
  look_at   <0.0 , 0.0 , 0.0>
}

light_source { 0*x
  color red 1.0  green 1.0  blue 1.0
  translate <-20, 40, -20>
 media_attenuation off
}

#declare Red=color red 1;
#declare Clear=color rgbf 1;

union {

sphere {<0,0,0>,1
  texture {
    pigment {
     spotted color_map {
            [0 Red][.6 Red][.61 Clear][.9 Clear][.91 Red][1 Red]}
                       }
    scale .2}
     finish {ambient 0 diffuse .5}  //tweaked the sphere
}  //inner sphere

light_source
{  0*x   color rgb<3,2,1> //intense reddish light
  fade_distance 1 fade_power 2  //cause falloff of light
 //neither of these media_ statements are needed unless turning off
// media_attenuation on media_interaction on
}

// Add media
sphere {<0,0,0>,2
  hollow on  //always use this remember (things do not default to this!)
 pigment {rgbf<1,1,1,1>}
   interior {
        media {
        
         absorption <0,.5,1>  //filter out all blue, half green
         
  intervals Granularity  //smoothness of media
  
  samples 5, 10     //fair amount of sampling
  confidence 0.95   //better than default 0.9
  variance 1/150    //better than default 1/128
  ratio 1           //ratio of spotlight lit to unlit region for 
intervals/samples to calculate
  
  scattering {1, rgb .1 extinction 0}  //lower extinction brightens

        }
      }
  } //outer sphere

} //union

Don't know why, but your texture and pigment statements were missing their 
leading braces. Other than that, only real thing wrong was the hollow keyword 
and a need for larger scattering color.

Message <3662ef6d.0@news.povray.org>, Andrew Cocker  typed...
>
>Hi,
>    Please help me with this annoying problem.
>    I have created a union of a sphere ( at origin, radius 1,textured mainly
>Red, but with Clear patches), a light_source, (also at origin
>media_attenuation on), and a final sphere ( also at origin, radius 2}.
>    How do I add media to the larger sphere, so that the shafts of light
>coming from within the smaller sphere are visible? I've tried following the
>documentation, but the outer sphere is invisible.
>    Here's my code ( it's messy, I know).
>
>Thanks in advance.
>
>Andy C.
>
>// ==== Standard POV-Ray Includes ====
>#include "colors.inc" // Standard Color definitions
>#include "textures.inc" // Standard Texture definitions
>
>camera
>{
>  location  <0.0 , 4.0 ,-8.0>
>  look_at   <0.0 , 0.0 , 0.0>
>}
>
>light_source
>{
>  0*x
>  color red 1.0  green 1.0  blue 1.0
>  translate <-20, 40, -20>
>media_attenuation off
>}
>
>union {
>sphere {<0,0,0>,1 texture
>
>    pigment
>
>    spotted color_map {
>                [0 Red][.6 Red][.61 Clear][.9 Clear][.91 Red][1 Red]}
>                }
>                scale .2}
>}
>
>light_source
>{  0*x   color red 1.0  green 1.0  blue 1.0
>  translate <0, 0, 0>
>media_attenuation on}
>
>// Add media
>sphere {<0,0,0>,2 pigment {rgbf<1,1,1,1>}
>        interior {
>        media {
>  intervals 40
>  scattering {1, rgb 0.02}
>  samples 1, 10
>  confidence 0.9999
>  variance 1/1000
>  ratio 0.9
>}
>        }
>}
>
>}
>
>
>
>

-- 
 omniVERSE: beyond the universe
  http://members.aol.com/inversez/POVring.html
=Bob


Post a reply to this message

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