POV-Ray : Newsgroups : povray.general : Possible Bugs using Light Groups in POV-Ray 3.6 Server Time
6 Nov 2024 02:23:25 EST (-0500)
  Possible Bugs using Light Groups in POV-Ray 3.6 (Message 1 to 2 of 2)  
From: rben
Subject: Possible Bugs using Light Groups in POV-Ray 3.6
Date: 26 Sep 2004 10:05:00
Message: <web.4156cc5da7995bcd497bbfc0@news.povray.org>
I've encountered 2 possible bugs while using POV-Ray 3.6.

1) I have a model of a pencil where I've used some 30 planes to clip, and
thus "sharpen", the front of the pencil.  This works great until the model
is placed in a light group.  When that happens, the clipped portion of the
model is rendered black rather than with the wood texture that it should
have.  The model works fine if it's not inside a light group.  I've added
the code for the model at the end of this post.

2) Light sources that are part of composite objects that are used within
light groups don't appear to give off light.  Below is the code that
demonstrates this problem.  When you run it, you will see the spotlight
shining on the ground plane.  Uncomment the light group and run it again
and you'll see that it doesn't work anymore.

#version 3.5;

#include "colors.inc"
#include "finish.inc"

global_settings {
  assumed_gamma 1.0
  ambient_light .3
}

// ----------------------------------------

camera {
  location  <0.0, 0.5, -4.0>
  direction 1.5*z
  right     x*image_width/image_height
  look_at   <0.0, 0.0,  0.0>
}

sky_sphere {
  pigment {
    gradient y
    color_map {
      [0.0 rgb <0.6,0.7,1.0>]
      [0.7 rgb <0.0,0.1,0.8>]
    }
  }
}

#declare m = 1;
#declare cm = m/100;
#declare km = 1000*m;
#declare mm = cm/10;

//light_source {  <0, 0, 0> color White   translate <-30, 30, -30> }

// ----------------------------------------
#local SL_R = 30*cm;
#local SL_L = 50*cm;
#local SL_T = 2*cm;

#local SL_Bulb_Offset = 20*cm;

#declare SearchLight = union {
  union {
    light_source {
      SL_Bulb_Offset*x                     // light's position (translated
below)
      color rgb <1,1,1> / 3      // light's color
      spotlight               // this kind of light source
      point_at <SL_Bulb_Offset*2, 0, 0>      // direction of spotlight
      radius 30
      tightness 0
      falloff 35
      looks_like {
        sphere {SL_Bulb_Offset*x, SL_R/2
          hollow
          no_shadow
          texture {
            pigment {White}
            finish {Luminous}
          } // texture
        }
      }
    }
    // Body of Search Light
    difference {
      cylinder {-20*cm*x, SL_L*x, SL_R}
      cylinder {0, SL_L*x, (SL_R - SL_T) translate SL_T*x pigment {White}}
      pigment {Gray50}
    }
    translate SL_R*y
  }
}


///////////// Light Groups /////////////////////////////////////////////
//light_group {
   light_source {  <-100, 100, -100>  color White   }

  object {SearchLight rotate -90*z}


plane { y, -1 pigment { White } } // this plane gets shadows from both
spheres!

//}

///////////////////////////////////////////////////////
// Pencil Model
///////////////////////////////////////////////////////
// Persistence of Vision Ray Tracer Scene Description File
// File: Pencil.inc
// Vers: 3.5
// Desc: Pencil Model
// Date: 9/7/2004
// Auth: Ray Benjamin

#ifndef (__pencil__)

#declare __pencil__ = 1;

#ifndef (inch)
  #declare inch = 1;
  #declare in = inch;
#end
#ifndef (foot)
  #declare foot = 12;
  #declare ft = foot;
#end

#ifndef (cm)
  #declare cm = 0.393701*inch;
  #declare m = 100*cm;
  #declare km = 1000*m;
  #declare mm = cm/10;
#end

#declare Pencil_T = 4*mm;

// Eraser Crimp
#declare Eraser_Crimp_L = 1.4*cm;
#declare Eraser_Crimp_T = .025*mm;
#declare Eraser_Crimp_R = Pencil_T;
#declare Eraser_Crimp_Ring_R = .35*mm;
#declare T_Eraser_Crimp = texture {
  T_Chrome_2C
  finish {
    irid { .25 thickness .25 turbulence .5 }
  }
}

#declare Eraser_Crimp = difference {
  union {
    cylinder {0, Eraser_Crimp_L*x, Eraser_Crimp_R}
    #declare Eraser_Crimp_Ring = torus {Eraser_Crimp_R Eraser_Crimp_Ring_R
rotate 90*z}
    #local Eraser_Rings = union {
      object {Eraser_Crimp_Ring translate 0*mm*x}
      object {Eraser_Crimp_Ring translate 1*mm*x}
    }
    object {Eraser_Rings translate 3.25*mm*x}
    object {Eraser_Rings translate 1*cm*x}
  }
  #local Eraser_Crimp_Cyl_R = .17*mm;
  #local Eraser_Crimp_Cylinder = cylinder {0, 4.5*mm*x Eraser_Crimp_Cyl_R
translate <4.75*mm,Eraser_Crimp_R,0>}
  #local Count = 0;
  #local Angle = 0;
  #local Delta = 12;
  #while (Count < 30)
    object {Eraser_Crimp_Cylinder rotate Angle*x}
    #local Count = Count + 1;
    #local Angle = Angle + 12;
  #end // while
  object {Eraser_Crimp_Cylinder}
  texture {T_Eraser_Crimp}
}

#declare Eraser_L = 6*mm;
#declare Eraser_R = Pencil_T - Eraser_Crimp_T*2;
#declare T_Eraser = texture {
  pigment { rgb <.9,.5,.5> }
  finish {
    diffuse .5
    roughness 1
  }
}
texture {
  pigment {
    bozo
    color_map {
      [0 Clear]
      [.7 Clear]
      [.85 rgbf <.7,.7,.7,.5>]
      [1.0 rgbf <1,1,1,.9>]
    } // color_map
    turbulence .1
    scale 4*mm
  }
  finish {
    diffuse .5
    roughness 1
  }
}
// Eraser
#declare Eraser = object {
  Round_Cylinder_Merge(<0,0,0>, <Eraser_L,0,0>, Eraser_R, .85*mm)
  texture {T_Eraser}
}

// Eraser Assembly

#declare Eraser_Assembly = union {
  object {Eraser_Crimp}
  object {Eraser translate Eraser_Crimp_L*x}
}

#declare Eraser_Assembly_L = Eraser_Crimp_L + Eraser_L;

// Pencil Lead

#declare Pencil_L = 6.5*inch - Eraser_Assembly_L;
#declare Paint_T = Pencil_T - .1*mm;
#declare Pencil_Lead_R = .06*inch;
#declare Pencil_Tip_L = .5*inch;

#declare T_Pencil_Lead = texture {
  pigment {Gray15}
  finish {
    diffuse .5
    roughness .3
  } // finish
} // texture

// Pencil Sharpener - used to cut away pencil at tip to "sharpen" it.

#declare Pencil_Sharpener = union {
  #local Blade = plane {-y,0}
  #local AngleZ = 20;
  #local AngleZ_Delta = 5;
  #local AngleX = 0;
  #local AngleX_Delta = 3;

  #while (AngleX < 360)
    object { Blade rotate AngleZ+rand(R1)*AngleZ_Delta*z rotate AngleX*x}
    #local AngleX = AngleX + rand(R1)*AngleX_Delta;
  #end // while

  plane {x, 0 translate 3*mm*x rotate -2*z}
}

// Cutout for Lead

#declare Lead_Cylinder = cylinder {-Pencil_L/2*x Pencil_L/2*x Pencil_Lead_R
}

#declare Pencil_Lead = difference {
  cylinder {-Pencil_L/2*x Pencil_L/2*x Pencil_Lead_R texture
{T_Pencil_Lead}}
  object {Pencil_Sharpener translate -Pencil_L/2*x}
  cutaway_textures
  bounded_by {
    object {Lead_Cylinder}
  }
}

// Create the lettering for the pencil
#declare Pencil_Lettering_Decal = height_field {
  png               // the file type to read (tga/pot/pgm/ppm/png/sys)
  "PencilLetteringHF.png"     // the file name to read
  smooth        // smooth surface normal
  water_level .01 // truncate/clip below N (0.0 ... 1.0)
  texture { T_Gold_2C }
  scale <7*cm,.02,4*mm>
  rotate -90*x
  translate <0,-Pencil_T,-Pencil_T>
}

// create a TrueType text shape
#declare Pencil_Lettering = text {
  ttf             // font type (only TrueType format for now)
  "crystal.ttf",  // Microsoft Windows-format TrueType font file name
  " BENJAMIN    DreamWriter  2048   FINE (0.5)",      // the string to
create
  1,              // the extrusion depth
  0               // inter-character spacing
  translate <0,-.5,0>
  scale .125
  texture {T_Gold_2B}
  translate <-Text_Space("Crystal.ttf"," BENJAMIN    DreamWriter  2048
FINE (0.5)",.125,0)/2+2*cm,0,-Pencil_T>
}


// Pencil Color
#local P_Pencil = rgb <1,221/255, 63/255>;

// Make the Wood portion of the Pencil

#macro Make_Pencil_Wood(WoodTexture)
  difference {
      union {
        // Paint

        difference {
          object {Hexagon scale <Pencil_L/2,Pencil_T,Pencil_T>}
          object {Hexagon scale <Pencil_L/2*1.1,Pencil_T-.1*mm,Pencil_T -
..1*mm>}
          pigment { P_Pencil }
        } // diff
        // Wood
        object {Hexagon scale <Pencil_L/2,Pencil_T-.1*mm,Pencil_T - .1*mm>
texture {WoodTexture rotate 90*y}}
        // lead
      } // union

      object {Pencil_Sharpener translate -Pencil_L/2*x}
      //object {Pencil_Lettering_Decal }
      cutaway_textures
      bounded_by {
        cylinder {-Pencil_L/2*x, (Pencil_L/2+Eraser_Assembly_L)*x Pencil_T +
..03}
      }
  } // difference
#end

// Macro to make actual pencil given the wood texture
// Should add length, paint color, lettering color to parameters
#macro Make_Pencil(WoodTexture)
  union {

    difference {
      object {Make_Pencil_Wood(WoodTexture)}
      object {Lead_Cylinder}
      object {Pencil_Lettering translate <1*cm,0,-.01>}  // Plain Lettering
    }

    object {Pencil_Lead}
    //
    object {Eraser_Assembly translate Pencil_L/2*x}

    //cylinder {-Pencil_L/2*x, (Pencil_L/2+Eraser_Assembly_L)*x Pencil_T +
..03 pigment {rgbf <1,0,0,.5>}}

    translate (Pencil_T)*y
  }
#end

#declare Old_Pencil = Make_Pencil(T_Wood6)
#declare New_Pencil = Make_Pencil(T_Wood19)

//////-----------------------------------------------
#end // ifndef __pencil__


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Possible Bugs using Light Groups in POV-Ray 3.6
Date: 28 Sep 2004 18:16:05
Message: <4159e2a5$1@news.povray.org>
In article <web.4156cc5da7995bcd497bbfc0@news.povray.org> , "rben" 
<ray### [at] comcastnet> wrote:

> I've encountered 2 possible bugs while using POV-Ray 3.6.

Please read

From: Alan Kong <ako### [at] povrayWWWSPAMCOMorg>
Newsgroups: povray.announce.frequently-asked-questions
Subject: bug reporting
Date: Wed, 10 Jul 2002 20:32:49 -0700
Message-ID: <fpupiu02i1198jbb38i3o06hv6is1a3uar@4ax.com>
Xref: news.povray.org povray.announce.frequently-asked-questions:50

and provide a minimal but complete scene.  Your scene is too complex to say
what you are doing wrong.

    Thorsten

____________________________________________________
Thorsten Froehlich
e-mail: mac### [at] povrayorg

I am a member of the POV-Ray Team.
Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

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