POV-Ray : Newsgroups : povray.newusers : Problem with Photon's : Problem with Photon's Server Time
29 Jul 2024 18:25:36 EDT (-0400)
  Problem with Photon's  
From: Bryan Heit
Date: 25 Apr 2005 09:37:38
Message: <426cf2a2@news.povray.org>
I've designed an old oil lamp, but am hjaving problems assigning photons 
to the globe.  Basically, if photon's are off the base of the lamp 
causes a shadow to form beneath the lamp (as it should), but if rendered 
with photons on this shadow is lost, as is the projection of 
yellow-orange light onto the ground.  I suspect that photons are getting 
assiged to both the metal and glass parts of the lamp.  Is this what 
happened, and if so how do I fix it?

I've attached the code below.  If you render it as-is you should get an 
image with 2 lamps - the one on the left has photon's on, the one on the 
right has photon's off.  If you only render the one with photons on 
you'll see that id doesn't cast any shadows, or illuminate the ground, 
whereas both of these happen with photons off.

Thanx

Bryan

/*===============================================================

Oil Lamp

Makes an oil lamp, with glass globe and copper base


Flame is made up of emiting media plus a point light


Using this object:
   Photon's must be on to get refractive characteristics of glass

Calling the lamp (macro):
   Oil_Lamp (Photons_On)
     Photons_On = on/off statement allowing an #if statmement to be
                  used to turn photons on or off.


===============================================================*/

//--------------------------Include Files------------------------------

#include "colors.inc"
#include "metals.inc"
#include "glass.inc"

#macro Oil_Lamp (Photons_On)

#declare Globe = lathe {
     cubic_spline
     8,
     <0.5,-1>, <0.45,0>, <0.45,0.5>, <1.25,1>, <1.25,1.5>, <0.75,3>, 
<0.45,5>, <0.45, 5.5>
     hollow on
     texture {
       pigment { Col_Glass_Old }
       finish { F_Glass3 }
             }// end texture
     #if (Photons_On = on)
     photons{
       target
       reflection off
       refraction on
             }//end photons
     #end
           }//end lathe


#declare LampBase = union {
   cylinder {
     <0,0,0>, <0,0.25,0>, 1.25
     texture {
       pigment { P_Brass3 }
       finish { F_MetalC }
             }//end finish
    }// end bottom cylinder
    difference {
      sphere {
        <0,1.2,0>, 1.66
        texture {
          pigment { P_Brass3 }
          finish { F_MetalC }
                }//end texture
         scale y*0.6
         interior { I_Glass }

            }//end sphere

       box {
         <-5,0.6,5>, <5,3,-5>
         texture {
           pigment { P_Brass3 }
           finish { F_MetalC }
                  }
           }

       sphere {
        <0,1.4,0>, 1.63
        texture {
          pigment { P_Brass3 }
          finish { F_MetalB }
                }//end texture
         scale y*0.6
               }//end sphere*/



    }//end difference

   union {
     cone {
       <0,0,0>, 0.5, <0,2.5,0>, 1.25
       texture {
          pigment { P_Brass3 }
          finish { F_MetalC }
                }//end texture
        }//end cone

     sphere {
       <0,5,0>, 1.2
       scale y*0.5
       texture {
          pigment { P_Brass3 }
          finish { F_MetalC }
                }//end texture
        }//end sphere
     torus {
       1.2, 0.1
       texture {
          pigment { P_Brass3 }
          finish { F_MetalC }
                }//end texture
        translate y*2.5
        }//end torus

     cone {
       <0,3,0>, 0.25, <0,3.5,0>, 0.5
       texture {
          pigment { P_Brass3 }
          finish { F_MetalC }
                }//end texture
        }//end cone

     torus {
       0.5, 0.05
       texture {
          pigment { P_Brass3 }
          finish { F_MetalC }
                }//end texture
        translate y*3.5
        }//end torus

     cone {
       <0,3.5,0>, 0.5, <0,3.9,0>, 0.1
       texture {
          pigment { P_Brass3 }
          finish { F_MetalC }
                }//end texture
        }//end cone

        }//end union

}//end lamp base union

#declare Flame = union {

       difference{
	sphere{0, 0.5}
	sphere{<0, -0.3, 0>, 0.35}
	hollow
	pigment { rgbt 1}
	interior
	  { media
	    { emission rgbf <3, 1.85, 0.1, 0.2>
	      density {
	        cylindrical
	        color_map{
                   [0.3 rgb 1]
                   [1 rgb <0.2, 0.2, 4>]
                          }//end color map
	       turbulence 0.15
	               } //end density
	             } //end media
	           } //end interior
	
	scale<.7, 2.5, .7>
    }//end flame difference

    light_source {
      <0,-0.53,0>
      color rgb <3,1.85,0.1>
                 }

    }//end flmae union

#declare WholeLamp = union {
   object { Globe translate y*3.5 }
   object { LampBase }
   object { Flame translate y*4.5}
   }

object {WholeLamp}

#end //end oil lamp macro


//------------------------Sample Scene---------------------------------
//

global_settings {
    photons {
      count 20000
      autostop 0
      jitter .4
    }
  }

//Setup Camera
camera {
   location <0,5,-30>
   look_at <0,4,0.01>
   angle 30
        }


//Setup Environment

plane {
   <0,1,0>, 0
    pigment { color Grey }
           }

object {
   Oil_Lamp (on)
   translate x*-3
   } //end lamp

object {
   Oil_Lamp (off)
   translate x*3
   } //end lamp


Post a reply to this message

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