POV-Ray : Newsgroups : povray.general : spot_light Server Time
6 Aug 2024 00:10:20 EDT (-0400)
  spot_light (Message 1 to 3 of 3)  
From: Rafal 'Raf256' Maj
Subject: spot_light
Date: 19 Jul 2002 20:11:31
Message: <Xns925115B675FADraf256com@204.213.191.226>
Hi,
I have a cylinder in <0,0,0> with radius _rad and a spot light at
<0,_dist,0> pointing at 0. What should be radius (and falloff) to make 
light shine exacly and only on my cylinder (on it's top side) and not on 
sorrounding ?

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)
Why 57.0 ? This number probalby deepends on tightness, what's formula for 
it ?

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


-- 

> A jedyne co czytam, ze to terrorysci internetowi z echelonu planuja
> kolejny atak na centrale TPSA
- Expert vel Jacek (obecnie gol### [at] pocztaonetpl)


Post a reply to this message

From: Rafal 'Raf256' Maj
Subject: Re: spot_light
Date: 19 Jul 2002 20:21:42
Message: <Xns92511770F59A9raf256com@204.213.191.226>
"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 :(


-- 

> A jedyne co czytam, ze to terrorysci internetowi z echelonu planuja
> kolejny atak na centrale TPSA
- Expert vel Jacek (obecnie gol### [at] pocztaonetpl)


Post a reply to this message

From: Philippe Lhoste
Subject: Re: spot_light
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.