POV-Ray : Newsgroups : povray.newusers : beam through glass : beam through glass Server Time
1 Jul 2024 03:35:57 EDT (-0400)
  beam through glass  
From: roll
Date: 31 Aug 2011 05:25:01
Message: <web.4e5dfc7835855cd87088f6f40@news.povray.org>
Hi Pov Ray community,

i have started creating a animation where a laserbeam should go through a solid,
rounded glass box. So i created a hollow cone with gaussian distributed red
glowing media in it. I overlapped it with the glass box (ior = 1.5).
=> there are surfaces with different ior in the glass box visible.
Here the object code:

//Declarations in mm
#declare scalef = 10;
#declare edgeR=0.025;
#declare su8l=10;
#declare su8b=8;
#declare su8h=0.037;
#declare capinn=0.170;
#declare capout=0.200;
#declare capl=4;
#declare groveb=0.060;
#declare fiberb=0.125;
#declare w0=0.1;                      //core radius
#declare fiberoffset=capout/2+0.2;
#declare beaml=1.9999*fiberoffset; //2*fiberoffset;
#declare beamNA=0.1;
#declare beamw = beaml * beamNA;
//declare beam
#declare lamda = 0.001;
#declare z0 = pi*w0*w0/lamda;
#declare fiberbeam = function (x,y,z) {1*exp(-2*(x*x+y*y)/pow(w0,2))}
                                               //1*exp(-(x*x+y*y)/w0)};
//fiber beam
#declare gaussbeam1 = function (x,y,z)
{1*pow(w0/(w0*sqrt(1+50*(z-1)*(z-1)/z0*z0)),2)*exp(-2*(x*x+y*y)/pow((w0*sqrt(1+50*(z-1)*(z-1)/z0*z0)),2))};

#declare gaussbeam2 = function (x,y,z)
{1*pow(w0/(w0*sqrt(1+50*z*z/z0*z0)),2)*exp(-2*(x*x+y*y)/pow((w0*sqrt(1+50*z*z/z0*z0)),2))};


//------------------------------------------------------------------------
camera {
        location scalef*<0.5,0.6,-0.6>*.8
        //location scalef*<-0.4,.9,0.1>*1
        look_at  0   angle 50 }


///////////////////////////////////////////////////////////////////////////
#declare M_Glass2 =
material {
  texture {
    pigment {rgbt <1,1,1,0.8>}
  }
  interior {
    ior 1.5
  }
}

#declare matbeam =
        material {
                   texture {
                   pigment {rgbt <1,1,1,1>}
                    } // end of texture
                   interior {
                         media{
                                emission <50,0,0>/scalef
                                //scattering {1,rgb <1,0,0> extinction 0}
                                density{
                                        function{gaussbeam1(x,y,z)}
                                        density_map {
                                                [0 rgb 0]
                                                [1 rgb 1]
                                        } // end color_map
                                } // end of density
                        } // end of media1 --
                } // end of interior
         } // end of material


////////////////////////////////////////////////
////////////////CAPILLARY
#declare round = difference {  //define round edge
                        box {
                        <-0.5,-0.5,-0.5>,  <capl+0.5,edgeR,edgeR>
                        }
                        cylinder {
                        <-1,edgeR,edgeR>,<capl+1,edgeR,edgeR>,edgeR
                        }
                  }
#declare cinn = difference{     //define inner capillary
                        box {
                        <0,0,0>,  <capl,capinn,capinn>
                        }
                        object {round}
                        object {round rotate <90,0,0> translate <0,capinn,0>}
                        object {round rotate <180,0,0> translate
<0,capinn,capinn>}
                        object {round rotate <270,0,0> translate <0,0,capinn>}

                        }
#declare capillary =            object {cinn
                                        translate
<-0.0001,(capout-capinn)/2,(capout-capinn)/2>
                                material{
                                        M_Glass2
                                }
                                hollow
                                scale <su8l,1,1>
                                translate <-su8l/2,0,-capout/2>
                                no_shadow
                                }

////////////////////////////////////////////////
////////////////BEAM body with both beams in it
#declare beam =
                cylinder{<0,0,0>,<0,0,0.99>,1
                material {matbeam}
                hollow
                scale <fiberb/2,fiberb/2,beaml>
                translate
<0,su8h+sqrt(fiberb/2*fiberb/2-groveb/2*groveb/2),-fiberoffset>
                }//----- end of beam

object {beam rotate <0,0,0> scale scalef}
object {capillary scale scalef}
///////////////////////////////////////////////////////


almost 20h on this problem.


Tanks in advance
Roll


Post a reply to this message

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