POV-Ray : Newsgroups : povray.general : glow with shine around the object : Re: glow with shine around the object Server Time
29 Jul 2024 14:11:26 EDT (-0400)
  Re: glow with shine around the object  
From: Thomas de Groot
Date: 21 Mar 2011 04:01:13
Message: <4d8705c9$1@news.povray.org>
"CAD-Andi" <nomail@nomail> schreef in bericht 
news:web.4d8600f95784deadb642fbb20@news.povray.org...
> "Thomas de Groot" <tDOTdegroot@interDOTnlANOTHERDOTnet> wrote:
>
>>
>> I am working on a night scene with halos around light sources. I use an
>> emission media with a spherical density.
>>
>> Thomas
>
> Hi Thomas!
> Do you happen to have a small code example to get me started? Would be 
> awesome!
>

Of course. This is the code I use.

//-----------------------------------------------start code

#local HaloScale    = 100;
#local colLum       = rgb <1.0, 1.0, 0.9>; // light color
#local haloTurb     = 0.1;                 // outer halo turbulence
#local haloStrength = 0.5;                 // inner and outer halo intensity 
(outer halo is 50% inner halo intensity)
#local DensityShift = 0.9;         // shifts the density within the media

#local DensityHalo =
density {
  spherical
  turbulence haloTurb
  color_map {
    [0.4 rgb 0]
    [0.8 colLum*haloStrength*0.05]
    [1.0 colLum*haloStrength*0.5]
  }
  scale <1, 1, 1>
  translate DensityShift*y
}

#local mediaHalo =
media {
  emission haloStrength*0.5
  intervals 1
  samples 100
  confidence 0.9999
  variance 1/10
  density {DensityHalo}
}

#declare LampHalo =
sphere {0, 1
  texture {pigment {rgb 0 transmit 1} finish {ambient 0 diffuse 0}}
  interior {media {mediaHalo}}
  hollow no_shadow
  translate -DensityShift*y
  scale HaloScale
  translate <-0.09911, 1.861, 0.0> //locate halo center a bit within the 
lamp shade
}

#declare LampHalo2 =
sphere {0, 1
  texture {pigment {rgb 0 transmit 1} finish {ambient 0 diffuse 0}}
  interior {
    media {
      scattering {1, (colLum*0.05)/200}
    }
  }
  hollow no_shadow
  scale 200
  translate <Max.x, Max.y, 1>
}

#macro Lamp(Force,Area,FD)
light_source {
  <-0.6221, 3.953, 0.0>,
  colLum*Force
  #if (Area)
    area_light
    <1.0, 0, 0> <0, 0, 1.0>
    3, 3
    adaptive 1
    jitter
    circular
    orient
  #end
  fade_distance FD
  fade_power 2
  //looks_like {sphere {0, 1.0 pigment {rgb <1,1,1>} finish {emission 1}}}
}
#end //of macro

//-----------------------------------------------end code

Thomas


Post a reply to this message

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