POV-Ray : Newsgroups : povray.newusers : Problem with Photon's Server Time
25 Nov 2024 17:48:22 EST (-0500)
  Problem with Photon's (Message 1 to 4 of 4)  
From: Bryan Heit
Subject: Problem with Photon's
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

From: Alain
Subject: Re: Problem with Photon's
Date: 25 Apr 2005 19:36:01
Message: <426d7ee1$1@news.povray.org>
Bryan Heit nous apporta ses lumieres en ce 2005-04-25 09:37:
> 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
> 
I think that the problem in in the lathe you used. Even if you used the hollow option,
it's 
effectively "solid", in that it don't have any open space inside of it.
Try using a difference of your lathe with itself scaled <0.9,1.01,0.9>(smaller
diameter, very 
slightly taller to remove coincident surfaces). You can also make the lathe come back
to make the 
inside empty.
Another thing, if all elements of a CSG object share the same texture and finish, it's
preferable to 
assing your texture once to the whole object, not to each of it's elements. It makes
smaller, easier 
to read and maintain code, it also save memory when rendering, possibly gaining some
little speed. 
You can always use some textures for individual elements if you want to have some that
have a 
different texture.

Alain


Post a reply to this message

From: Warp
Subject: Re: Problem with Photon's
Date: 25 Apr 2005 20:08:52
Message: <426d8694@news.povray.org>
Bryan Heit <bjh### [at] nospamucalgaryca> wrote:
> #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

  Do you understand what 'hollow' is for?

-- 
                                                          - Warp


Post a reply to this message

From: Bryan Heit
Subject: Re: Problem with Photon's
Date: 25 Apr 2005 20:34:48
Message: <426d8ca8@news.povray.org>
Alain wrote:

> I think that the problem in in the lathe you used. Even if you used the 
> hollow option, it's effectively "solid", in that it don't have any open 
> space inside of it.
> Try using a difference of your lathe with itself scaled 
> <0.9,1.01,0.9>(smaller diameter, very slightly taller to remove 
> coincident surfaces). You can also make the lathe come back to make the 
> inside empty.

This has made the globe look much nicer.  Even better, I can switch  to 
a quadratic spline to speed things up.  Unfortunately, it does not solve 
the problem of the lamp projecting light onto the ground, or casting 
it's own shadow.

> Another thing, if all elements of a CSG object share the same texture 
> and finish, it's preferable to assing your texture once to the whole 
> object, not to each of it's elements. It makes smaller, easier to read 
> and maintain code, it also save memory when rendering, possibly gaining 
> some little speed. You can always use some textures for individual 
> elements if you want to have some that have a different texture.

I usually do this, but as you can probably tell from my code I 
guestimagted the shape of the lamp, and haven't had a chance to clean up 
the code yet.

> 
> Alain


Post a reply to this message

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