POV-Ray : Newsgroups : povray.newusers : beam through glass Server Time
28 Jun 2024 23:30:15 EDT (-0400)
  beam through glass (Message 1 to 8 of 8)  
From: roll
Subject: beam through glass
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

From: Alain
Subject: Re: beam through glass
Date: 31 Aug 2011 20:40:55
Message: <4e5ed497@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.
>

> almost 20h on this problem.
>
>
> Tanks in advance
> Roll
>
>
>

Usualy, the best way to make a beam visible is to use scatering media.
As your beam get refracted and possibly reflected, you need to use photons.

That way, you no longer need to fake the beam's path, the media makes it 
visible, and the photons will make the path of the refracted ray visible 
along the real path. POV-Rqay will do all the math for you.

You need:

1 light_source with cylindrical and parallel to make your beam emiter. 
Use radius, falloff and tightness to controll the spread of your light.
Suggested starting values: radius 0 falloff 1 tightness 3
(a cylindrical, parllel light_source is perfect to make a laser beam)

Scatering media. ONLY use intervals 1 and adjust samples as needed.

A photons block in the global_settings section:
photons{spacing 0.1 media 100}

A photons block on your target object:
photons{target refraction on reflection on collect off}

If you use a larger media container object, give it this photons block:
photons{pass_through}

You don't need any photons block for the light_source. All 
non-shadowless light_source have this default photons block:
photons{reflection on refraction on area_light off}

That way, if you ever change the shape of your object or the direction 
of the beam, you don't have to recalculate the path.


Alain


Post a reply to this message

From: roll
Subject: Re: beam through glass
Date: 1 Sep 2011 03:35:01
Message: <web.4e5f34ebd2ff407b7088f6f40@news.povray.org>
> Usualy, the best way to make a beam visible is to use scatering media.
> As your beam get refracted and possibly reflected, you need to use photons.
>
> That way, you no longer need to fake the beam's path, the media makes it
> visible, and the photons will make the path of the refracted ray visible
> along the real path. POV-Rqay will do all the math for you.


That sounds great so far. I will try as soon as possible and let you know the
result.

greets
roll


Post a reply to this message

From: Warp
Subject: Re: beam through glass
Date: 1 Sep 2011 11:11:08
Message: <4e5fa08c@news.povray.org>
Alain <aze### [at] qwertyorg> wrote:
> You need:

  Why not use the documentation, since it exists for this exact purpose?

http://wiki.povray.org/content/Documentation:Tutorial_Section_3.6#Simple_Media_Tutorial

-- 
                                                          - Warp


Post a reply to this message

From: Cousin Ricky
Subject: Re: beam through glass
Date: 9 Sep 2011 15:25:01
Message: <web.4e6a6636d2ff407b85de7b680@news.povray.org>
"roll" <nomail@nomail> wrote:
> 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.
> [snip]

This is a nit pick, but if the beam is conical, then technically, it's not a
laser.


> almost 20h on this problem.

I second Alain's basic suggestion:  Use photon mapping and scattering media and
POV-Ray will take care of it.  (If you wish to retain a conical beam, then do
not use cylinder and parallel.)

   "Let the machine do the dirty work." --Kernighan & Plauger

For an example of how to use photons and scattering in this manner, go to
http://lib.povray.org/ and type beamtest in the search box.  Note that I set
extinction to 0.  According to the POV-Ray docs, this is physically incorrect,
but it was the key to accomplishing my goal for this module.


Post a reply to this message

From: Alain
Subject: Re: beam through glass
Date: 10 Sep 2011 13:01:05
Message: <4e6b97d1$1@news.povray.org>

> "roll"<nomail@nomail>  wrote:
>> 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.
>> [snip]
>
> This is a nit pick, but if the beam is conical, then technically, it's not a
> laser.
>

>> almost 20h on this problem.
>
> I second Alain's basic suggestion:  Use photon mapping and scattering media and
> POV-Ray will take care of it.  (If you wish to retain a conical beam, then do
> not use cylinder and parallel.)
>
>     "Let the machine do the dirty work." --Kernighan&  Plauger
>
> For an example of how to use photons and scattering in this manner, go to
> http://lib.povray.org/ and type beamtest in the search box.  Note that I set
> extinction to 0.  According to the POV-Ray docs, this is physically incorrect,
> but it was the key to accomplishing my goal for this module.
>
>

extinction 0 also slightly faster. You skip calculations for self 
shadowing and light atenuation.


Alain


Post a reply to this message

From: clipka
Subject: Re: beam through glass
Date: 17 Sep 2011 02:04:02
Message: <4e743852$1@news.povray.org>
Am 09.09.2011 21:17, schrieb Cousin Ricky:
> "roll"<nomail@nomail>  wrote:
>> 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.
>> [snip]
>
> This is a nit pick, but if the beam is conical, then technically, it's not a
> laser.

That - to do some nitpicking of my own - is untrue.

LASER is Light Amplification by Stimulated Emission of Radiation, and is 
a way of producing coherent light - that is, a stream of photons all 
having the same wavelength and phase. Those photons do not need to 
propagate in the same direction though, as long as they create a common 
wavefront.

As a matter of fact, solid-state lasers (i.e. laser diodes) typically 
produce light that spreads out quite significantly in one plane, and 
require additional optics to focus the beam to a point at infinite distance.

Which brings us to the fact that even the classic lasers that /do/ emit 
a unidirectional stream of photos can be combined with optics to produce 
a cone-shaped stream of photos.

As for the practical side, CD and DVD players even /need/ a strongly 
cone-shaped beam, focused on the data-carrying layer, to read out 
individual bits without getting distracted by impurities in the 
transparent carrier material, dirt on the surface, minor scratches, or 
dust in the air gap.


Post a reply to this message

From: clipka
Subject: Re: beam through glass
Date: 17 Sep 2011 02:09:36
Message: <4e7439a0$1@news.povray.org>
Am 17.09.2011 08:03, schrieb clipka:

> Which brings us to the fact that even the classic lasers that /do/ emit
> a unidirectional stream of photos can be combined with optics to produce
> a cone-shaped stream of photos.

Duh - someone stole a few "n"s here...


Post a reply to this message

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