POV-Ray : Newsgroups : povray.general : Area Light Setup : Re: Area Light Setup Server Time
20 Apr 2024 09:17:36 EDT (-0400)
  Re: Area Light Setup  
From: Bald Eagle
Date: 24 Jan 2023 23:15:00
Message: <web.63d0aba910df5b0e1f9dae3025979125@news.povray.org>
Try this.

It works by specifying a vector that extends from the origin to the far corner
of your area light "panel".  Set "the Translate parameter to off while you do
this.   When done, set Translate to on, and it will translate and rotate your
area light to the proper position.

I _think_ I got this all correct.




#macro Area_light_source (DiagonalVector, Location, LightColor, Size1, Size2,
RotateY, Translate)

 #local Rotate = transform {rotate y*RotateY}

 //#local DiagonalVector = DiagonalVector*<1, 1, -1>;

 union {
  cylinder {0, DiagonalVector Line texture {pigment {rgb 0.5} finish {emission
1}} }
  #local ProjectZ = vdot (DiagonalVector, z);
  #local ProjectY = vdot (DiagonalVector, y);
  #local ProjectX = vdot (DiagonalVector, x);
  //cylinder {0, x*ProjectX Line pigment {rgb x}}
  //cylinder {0, z*ProjectZ Line pigment {rgb z}}

  #declare PanelColor = <176, 176, 139>/255;
  #declare PanelPigment = srgb PanelColor;
  #declare DotColor = <213, 213, 0>/255;
  #declare DotPigment = srgb DotColor;
  #declare CenterColor = <117, 117, 203>/255;
  #declare CenterPigment = srgb CenterColor;

  #local Axis1 = vtransform (x*ProjectX, Rotate);
  #local Axis2 = vtransform (y*ProjectY+z*ProjectZ, Rotate);


  union {
   triangle {0, x*ProjectX, DiagonalVector}
   triangle {0, DiagonalVector, y*ProjectY+z*ProjectZ}
   texture {pigment {PanelPigment} finish {emission 1}}
  }

  #declare PanelNormal = vnormalize (vcross (DiagonalVector, x*ProjectX));

  cylinder {0, PanelNormal*30 Line/2 texture {pigment {rgb 1} finish {emission
1}} translate DiagonalVector/2 no_shadow}

  #for (Columns, 0, Size1)
   #for (Rows, 0, Size2)
    sphere {0, Line*3 texture {pigment {DotPigment} finish {emission 1}}
translate <ProjectX/Size1*Columns, ProjectY/Size2*Rows, ProjectZ*(Rows/Size2)>}
   #end
  #end

  sphere {0 Line*4 texture {pigment {rgb CenterPigment} finish {emission 1}}
translate DiagonalVector/2 no_shadow}

  union {
   cylinder {0, x*ProjectX Line*2 texture {pigment {rgb x} finish {emission 1}}
}
   cylinder {0, y*ProjectY+z*ProjectZ Line*2 texture {pigment {rgb y} finish
{emission 1}} }

  }

  no_shadow
  //translate -PanelNormal*3
  #if (Translate)
   translate Location-DiagonalVector/2
   rotate y*RotateY
  #end
 }



 object {
  light_source
  {
   #if (Translate)
    Location,
   #else
    DiagonalVector/2
   #end
   LightColor
   area_light
   Axis1, Axis2, Size1, Size2
   adaptive 1
  }
  #if (Translate)
   rotate y*RotateY
  #end
 }

#end

//use: Area_light_source (DiagonalVector, Location, LightColor, Size1, Size2,
RotateY, Translate)
   Area_light_source (<10, 5, -5>,    y*10,     1,          4,     3,     0,
no)


Post a reply to this message


Attachments:
Download 'arealight.png' (79 KB)

Preview of image 'arealight.png'
arealight.png


 

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