POV-Ray : Newsgroups : povray.general : spot_light : Re: spot_light Server Time
5 Aug 2024 22:14:12 EDT (-0400)
  Re: spot_light  
From: Philippe Lhoste
Date: 30 Jul 2002 08:58:21
Message: <3d468d6d@news.povray.org>
"Rafal 'Raf256' Maj" <raf### [at] raf256com> wrote:
> "Rafal 'Raf256' Maj" <raf### [at] raf256com> wrote in
> news:Xns### [at] 204213191226
>
> > I thought that this would be 90*sin(_rad/_dist) but following example
> > (full posted to p.b.s-f) shows that it is 57*sin(_rad/_dist)
>
> Sorry, how stupid :/ I forgot about rad -> deg calculations :(

Mmm, plus the formula isn't right.
I had to refresh my memory about base trigonometry, a good exercice :-)
I give here the result, if anybody is interested.

To reuse your simple scene (slightly modified):

#declare _rad    = 1.0; // <-- configuration
#declare _dist   = 5.0;

camera { location <0,_dist,-10> look_at <0,0,0>  angle 15 }
background { color rgb <.3,.3,1> }

cylinder {
  <0,-0.1,0>, <0,0,0>,
  _rad
  pigment { color rgb <.7,1.0,.7> } finish { ambient .4 }
}
light_source { <40,160,-100>*1e3 color rgb .4 } // ambient

light_source { // SPOT
  <0,_dist,0> color rgb 1
  spotlight  point_at <0,0,0>
//  #declare _f = sin(_rad/_dist)*57;
  #declare _f = atan2(_rad,_dist)*180/pi;
  radius  _f
  falloff _f
  tightness 1
}

plane {
  y, -0.1
  pigment {
    checker rgb <.5,.5,1> rgb <1,.5,1>
  }
}

-- #=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=# --
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist
http://jove.prohosting.com/~philho/


Post a reply to this message

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