POV-Ray : Newsgroups : povray.newusers : How to create a beam inside a glass? : Re: How to create a beam inside a glass? Server Time
30 Jul 2024 00:27:05 EDT (-0400)
  Re: How to create a beam inside a glass?  
From: Bob Hughes
Date: 22 May 2005 11:35:06
Message: <4290a6aa$1@news.povray.org>
You'll need to watch out for coincident surfaces. Those parts which align 
perfectly to previous parts, such as what happens in the A and B objects 
when together without scaling them to be slightly different. Take note of 
the scale 0.999 I added to B.

Here it is again with some changes. I'm not all that good with photons 
myself, so this could probably be done better by others, but at least it 
shows refraction and reflection of the beam in the glass now. I added 
reflection to the finish of the objects, otherwise you would never see that. 
:^)


global_settings {
//  assumed_gamma 1.9
  max_trace_level 10
  photons {
    adc_bailout       0.01
    spacing           0.1
    gather            20, 100
    media             1, 1
    jitter            0.4
    max_trace_level   5
    autostop          0.5
    radius            0.0
    expand_thresholds 0.2, 35.0
  }
}


//Camera
camera {
         location <0,0,67>
         angle 120
         up 1*y
         right 1.333*x
         look_at <0,0,66>
         translate <-27.5,0,0>
         }

background { color rgb <0.1, 0.5, 1> }

//Scattering

#declare Scattering =
   material
   {
      texture
      {
         pigment
         {
            color rgbt <0.531233, 0.531233, 0.531233, 1>
         }
      }
      interior
      {
         media
         {
            variance 1.0/128.205128
            scattering
            {
               1 ,  rgb <0.03, 0.03, 0.03> // isotropic scattering
               extinction 0.25
            }
         }
      }
   }


#declare Scattering_1 =
   material
   {
      texture
      {
         pigment
         {
            color rgbt <0.0, 0.0, 0.0, 1.0>
         }
      finish {
       reflection {0.1,0.9 fresnel}
      }
      }
      interior
      {
         ior 1.55
         media
         {
            variance 1.0/128
            scattering
            {
               1 ,  rgb <0.5, 0.5, 0.5> // less scatter now
               extinction 0.5 // more extinction here
            }
         }
      }
   }


#declare Scattering_2 =
   material
   {
      texture
      {
         pigment
         {
            color rgbt <0.0, 0.0, 0.0, 1.0>
         }
      finish {
       reflection {0.1,0.9 fresnel}
      }
      }
      interior
      {
         ior 1.438
         media
         {
            variance 1.0/128
            scattering
            {
               1 ,  rgb <0.5, 0.5, 0.5> // less scatter now
               extinction 0.5 // more extinction here
            }
         }
      }
   }


//Checker

#declare Checkered_1 =
   material  // Checkered_1
   {
      texture
      {
         pigment
         {
            checker
               color rgb <0.882353, 0.882353, 0.882353>
               color rgb <0.952941, 0.952941, 0.952941>

         }
         finish
         {
            ambient 0.1
         }
         scale  6.0
      }
   }


//Lights

light_source {   // Light001
  <0.0, 0.0, 0.0>
  color rgb <1.000, 1.000, 1.000>
  media_interaction off
  photons {
   reflection off
   refraction off
  }
  translate  <2, 2, 0>
}


light_source {<0, 0, 90>
    color rgbt <10,0,0>
    spotlight
    falloff 0.268  // outer radius (in deg)
    radius     0.238
    tightness  0.000
    point_at <0,.5,68>
    photons {refraction on reflection on}
    media_attenuation on
    translate <-27.5,-0.25,0>
}

box{<-5,-5,-80>, < 5, 5, 80>
    material {
    Scattering
  }
  hollow
    translate -27.5*x
    photons {
     target 1
     reflection on
     refraction on
     collect on
    }
}


//Plane
plane { // Plane001
  y,-2
  material {
    Checkered_1
  }
  photons {
    target 1
    collect off
  }

}

//Object

#declare A = merge {object{cylinder {55*z,65*z,0.4}}
                    object{box {<-0.4,-0.25,55>,<0.4,0.25,65>}
                           translate 0.25*y  }}


#declare B = difference{box {<-0.5,-0.5,55>,<0.5,0.5,65>}
                        object {A scale 0.999}}

object {A
        translate <-27.5,0,0>

        material {
    Scattering_1
  }
  hollow
  photons {
   target 1
    reflection on
    refraction on
    collect on
  }
        }

object { B
         translate <-27.5,0,0>

         material {
    Scattering_2
  }
  hollow
  photons {
   target 1
    reflection on
    refraction on
    collect on
  }
 }


Post a reply to this message

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