POV shadowless spotlight bug (with fix)

POV shadowless spotlight bug (with fix)

Post by Jeff Epl » Mon, 06 Oct 1997 04:00:00



Hi.

Does the `shadowless' attribute work properly with `spotlight' ?  It
doesn't seem to work properly here, using
        Persistence of Vision(tm) Ray Tracer Version 3.00e.Linux.gcc
        Persistence of Vision(tm) Ray Tracer Version 3.01.Linux.gcc.pvm

If the `shadowless' attribute appears before `spotlight', then I get a
spotlight which casts a shadow.  If the `shadowless' attribute appears
after `spotlight', then I get a non-spotlight but shadowless light.

To see the effect, uncomment one or the other of the `shadowless'
keywords below:

plane { y, 0 pigment { color rgb 1 } }
sphere { <0,2,0>, 1 pigment { color rgb 1 } }
camera { location <0,1,-6> look_at <0,1,0> }
light_source {
        <10, 10, 0>
        color rgb 1
//      shadowless        
        spotlight
        point_at <0,2,0>
        radius 20
        falloff 20
//      shadowless

Quote:}

For POV source gurus: (gurii?)

A glance at parse.c indicates that this is because Object->Light_Type is
a single value, and you just can't combine FILL_LIGHT_SOURCE with
SPOT_SOURCE or CYLINDER_SOURCE.  Too bad.

The following changes, expressed in Unix "diff(1)" format, seem to allow
me to do what I wish to do, by moving the `shadowless' attribute to a
separate variable.  This seems correct since `shadowless' is not
mutually exclusive with a spotlight or cylinder light...  Anyhow, here's
the diff, if it gets mangled in transport I will be happy to send a
mime'd version by email:

--- lbuffer.c   1997/10/05 00:47:15     1.1

     for (Light = Frame.Light_Sources; Light != NULL; Light = Light->Next_Light_Source)
     {
-      if ((!Light->Area_Light) && (Light->Light_Type!=FILL_LIGHT_SOURCE))
+      if ((!Light->Area_Light) && !(Light->Light_Fill))
       {
         Status_Info(".");

   {
     for (Light = Frame.Light_Sources; Light != NULL; Light = Light->Next_Light_Source)
     {
-      if ((!Light->Area_Light) && (Light->Light_Type!=FILL_LIGHT_SOURCE))
+      if ((!Light->Area_Light) && !(Light->Light_Fill))
       {
         for (Axis = 0; Axis < 6; Axis++)
         {
--- lighting.c  1997/10/05 00:47:15     1.1

   {
     /* Test for shadows. */

-    if ((opts.Quality_Flags & Q_SHADOW) && (Light->Light_Type != FILL_LIGHT_SOURCE))
+    if ((opts.Quality_Flags & Q_SHADOW) && !(Light->Light_Fill))
     {
       block_light_source(Light, *Depth, Light_Source_Ray, Eye_Ray, P, Colour);

      * calculate it's contribution to the object's overall illumination.
      */

-    if ((opts.Quality_Flags & Q_SHADOW) && (Light_Source->Light_Type != FILL_LIGHT_SOURCE))
+    if ((opts.Quality_Flags & Q_SHADOW) && !(Light_Source->Light_Fill))
     {
       /* If this surface point has already been tested use previous result. */

         do_diffuse(Finish,&Light_Source_Ray,Layer_Normal,Colour,Light_Colour,Layer_Pigment_Colour, Attenuation);
       }

-      if (Light_Source->Light_Type!=FILL_LIGHT_SOURCE)
+      if (!(Light_Source->Light_Fill))
       {
         if (Finish->Phong > 0.0)
         {
--- parse.c     1997/10/05 00:47:15     1.1

      END_CASE

      CASE (FILL_LIGHT_TOKEN)
-       Object->Light_Type = FILL_LIGHT_SOURCE;
+       Object->Light_Fill = 1;
      END_CASE

      CASE (SPOTLIGHT_TOKEN)
--- point.h     1997/10/05 00:47:15     1.1

 #define POINT_SOURCE       1
 #define SPOT_SOURCE        2
-#define FILL_LIGHT_SOURCE  3
+/* #define FILL_LIGHT_SOURCE  3 */ /* Obsoleted by Light_Source->Light_Fill */
 #define CYLINDER_SOURCE    4

   DBL Coeff, Radius, Falloff;
   DBL Fade_Distance, Fade_Power;
   LIGHT_SOURCE *Next_Light_Source;
-  unsigned char Light_Type, Area_Light, Jitter, Track;
+  unsigned char Light_Type, Light_Fill, Area_Light, Jitter, Track;
   int Area_Size1, Area_Size2;
   int Adaptive_Level;
   int Atmospheric_Attenuation;
--

poverty, n.:
        An unfortunate state that persists as long
        as anyone lacks anything he would like to have.