POV-Ray : Newsgroups : povray.newusers : Newbie - Want to create a square flood light Server Time
29 Jul 2024 00:26:36 EDT (-0400)
  Newbie - Want to create a square flood light (Message 1 to 6 of 6)  
From: TheMightyZog
Subject: Newbie - Want to create a square flood light
Date: 7 Jun 2007 10:15:02
Message: <web.4668123c7fc265f0ff6e04e90@news.povray.org>
Hi,

I'm a bit stuck trying to create an outside security light, that is like a
spot light but has a square/rectangle area of illumination and has a
falloff (so that the edges are faded rather than sharp).

I've succeeded using a light with the projected_through{aPlane} facility,
but I get a hard edge and area_light doesnt help.

I'd be greatful for any ideas how I would go about constructing it.

Thanks
Zog


Post a reply to this message

From: Trevor G Quayle
Subject: Re: Newbie - Want to create a square flood light
Date: 7 Jun 2007 10:35:02
Message: <web.466817849713ab9c150d4c10@news.povray.org>
"TheMightyZog" <Chr### [at] HotPOPcom> wrote:
> Hi,
>
> I'm a bit stuck trying to create an outside security light, that is like a
> spot light but has a square/rectangle area of illumination and has a
> falloff (so that the edges are faded rather than sharp).
>
> I've succeeded using a light with the projected_through{aPlane} facility,
> but I get a hard edge and area_light doesnt help.
>
> I'd be greatful for any ideas how I would go about constructing it.
>
> Thanks
> Zog

An area light with projected_through should work.  You just need to make
sure the area light is far enough away from the projected_through rectangle
to get the amount of softness you want.

An alternative would be to create a square array of spotlights, however this
loses some of the advantages that area_lights give you for interpolation and
smoothing.

-tgq


Post a reply to this message

From: Trevor G Quayle
Subject: Re: Newbie - Want to create a square flood light
Date: 7 Jun 2007 11:35:02
Message: <web.4668252c9713ab9c150d4c10@news.povray.org>
> An area light with projected_through should work.  You just need to make
> sure the area light is far enough away from the projected_through rectangle
> to get the amount of softness you want.

I've thown together a quick macro and scene to demonstrate this below.  The
radius and falloff angles work the same as for spotlights, however, the
tightness parameter cannot be duplicated.

//START
global_settings {ambient_light 1}

camera{
  up y*image_height
  right x*image_width
  angle 60
  location <0,30,-30>
  look_at  <0,0,0>
}

#macro RecAreaLight(SIZ,GSIZ,RADIUS,FALLOFF)
  #local
ASIZ=SIZ*(tan(radians(FALLOFF))-tan(radians(RADIUS)))/(tan(radians(FALLOFF))+tan(radians(RADIUS)));
  #local DIST=(SIZ.x+ASIZ.x)/(2*tan(radians(FALLOFF)));
  area_light
  <ASIZ.x, 0, 0> <0, 0, ASIZ.y>
  GSIZ.x,GSIZ.y
  adaptive 1
  jitter
  translate y*DIST
  projected_through{box{-<SIZ.x,0,SIZ.y>/2,<SIZ.x,0,SIZ.y>/2}}
#end


#declare P=<4,6>; //light size
#declare G=<4,4>; //area light grid size
#declare RA=30; //radius angle
#declare FA=45; //falloff angle

light_source{
  0
  rgb 2
  fade_power 1
  fade_distance 5
  RecAreaLight(P,G,RA,FA)
  looks_like{box{-<P.x,0,P.y>/2,<P.x,0,P.y>/2} pigment{rgb 1} finish{ambient
1 diffuse 1}}
  rotate x*30
  rotate y*90
  translate y*5
}

plane{y,0 pigment{rgb 1}}
sphere{y*2,2 pigment{rgb 1}}
//END


-tgq


Post a reply to this message

From: TheMightyZog
Subject: Re: Newbie - Want to create a square flood light
Date: 7 Jun 2007 12:55:05
Message: <46683869@news.povray.org>
That is awesome Trevor, thank you very much.

I have been playing with it and seeing how you put it all together for the
last hour and have learnt a lot from following what you did.

As a complete beginner, having examples to work through is a real help.

It would have taken me years to define the RecAreaLight

Once again thanks
Chris
"Trevor G Quayle" <Tin### [at] hotmailcom> wrote in message
news:web.4668252c9713ab9c150d4c10@news.povray.org...
> > An area light with projected_through should work.  You just need to make
> > sure the area light is far enough away from the projected_through
rectangle
> > to get the amount of softness you want.
>
> I've thown together a quick macro and scene to demonstrate this below.
The
> radius and falloff angles work the same as for spotlights, however, the
> tightness parameter cannot be duplicated.
>
> //START


Post a reply to this message

From: Trevor G Quayle
Subject: Re: Newbie - Want to create a square flood light
Date: 7 Jun 2007 13:10:02
Message: <web.46683aea9713ab9c150d4c10@news.povray.org>
"TheMightyZog" <Chr### [at] HotPOPcom> wrote:
> That is awesome Trevor, thank you very much.
>
> I have been playing with it and seeing how you put it all together for the
> last hour and have learnt a lot from following what you did.
>
> As a complete beginner, having examples to work through is a real help.
>
> It would have taken me years to define the RecAreaLight
>
> Once again thanks

No problem.  I enjoy coming up with stuff like this.
As an addendum, you could change the macro to:

#macro RecAreaLight(SIZ,GSIZ,RADIUS,FALLOFF)
  #local
ASIZ=SIZ*(tan(radians(FALLOFF))-tan(radians(RADIUS)))/(tan(radians(FALLOFF))+tan(radians(RADIUS)));
  #local DIST=(SIZ.x+ASIZ.x)/(2*tan(radians(FALLOFF)));
  area_light
  <ASIZ.x, 0, 0> <0, 0, ASIZ.y>
  GSIZ.x,GSIZ.y
  translate y*DIST
  projected_through{box{-<SIZ.x,0,SIZ.y>/2,<SIZ.x,0,SIZ.y>/2}}
#end


I.e. remove the jitter, adaptive, etc. from the macro itself.  That way you
can control it in the light_source instead.  Just add the jitter, adaptive
'n', orient and/or circular keywords as needed to each light_source after
invoking the macro.

-tgq


Post a reply to this message

From: Trevor G Quayle
Subject: Re: Newbie - Want to create a square flood light
Date: 7 Jun 2007 13:10:02
Message: <web.46683bc59713ab9c150d4c10@news.povray.org>
"TheMightyZog" <Chr### [at] HotPOPcom> wrote:
> That is awesome Trevor, thank you very much.
>
> I have been playing with it and seeing how you put it all together for the
> last hour and have learnt a lot from following what you did.
>

BTW, I just used simple trigonometry.  Given the projected through size and
the desired Radius and Falloff angles, you just need to solve for the area
light size and the offset distance required.

-tgq


Post a reply to this message

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