POV-Ray : Newsgroups : povray.newusers : Using POV-Ray to model a flash-light Server Time
4 Nov 2024 23:20:08 EST (-0500)
  Using POV-Ray to model a flash-light (Message 1 to 6 of 6)  
From: Goran Arbanas
Subject: Using POV-Ray to model a flash-light
Date: 6 Nov 2002 14:15:42
Message: <3dc96a5e$1@news.povray.org>
Hello,

Could you please tell me whether what we are trying to do could be
accomplished by POV-Ray?

We would like to model a flash-light consisting of a parabolic mirror and a
light source at the focus of this paraboloic mirror.

We would like to be able to accurately measure the intensity of light
arriving at a plane perpendicular to the the axis of symettry of the
flash-light, which plane is some fixed distance away from the flash light.
Ideally, we would like to see a diagram of light intensity arriving at this
plane, or if that is not possible, some visual presentation of this light
intensity by which it could be straightforward to accurately measure the
intensity at any given point within 10% accuracy.

Here is a simple scene which corresponds to our setup, but the resulting
image does not provide us with the required accuracy for measuring the
intensity:

camera {
location <0, 0, 0>
look_at <0, 0, 7> // 7 is the distance between the plane and the light
source at <0,0,0>
}
// Define a parabola along Z-axis with focus at <0, 0, 0>
// and focal length of 1/(4*a), i.e. a*x^2 - z- 1/(4*a) = 0
quadric {
<0.5, 0, 0>, <0, 0, 0>, <0, 0, -1>, -0.5
texture {
finish {Mirror}
}
}
// Define a plane on which to measure the light
plane { z, 7.0
pigment { color Blue }
finish { Dull }
}
// Define a light source
light_source { <0, 0, 0> color White}

Any suggestions are welcome, as I have been using POV-Ray for only a day.

Thank you for providing this excellent software free of charge.

Goran


Post a reply to this message

From: hughes, b 
Subject: Re: Using POV-Ray to model a flash-light
Date: 6 Nov 2002 21:01:06
Message: <3dc9c962@news.povray.org>
In a very rough manner it can be done, although it won't be much good if you
want to gauge the reality of a flashlight model's beam intensity. POV-Ray is
not a optics program when it comes to the science of optics and light
simulation.
However, if it's not true science you're after then using photons and
eval_pigment should be all you need. Just keep in mind there is no
comparison to reality except for a faked kind.
I wrote up a quick (well, took me an hour) example that shows the value in
the message stream text:

/* how to test flashlight beam on wall for brightness */

/* use appropriate output name for each scene rendered or you'll overwrite
them */

// first scene
// cmd:+fn +oC:\images\flashlit.png
// second scene
// cmd:+fn +oC:\images\flashli.png


// which scene? 1 or 2
#declare Scene=1;

#case(1)
/* setup scene */
global_settings {
 photons {
  spacing 0.02
  // autostop 0
 }
}

camera {
location <0, 0, 0>
look_at <0, 0, 1>
}

// I used a different paraboloid here
quadric {
<0.5, 0.5, 0>, <0, 0, 0>, <0, 0, -1>, 0
clipped_by {
 plane {z,2} // wide end opening
 plane {-z,-0.2} // narrow end opening
 }
texture {
 pigment {rgb 0.5}
 // a little imperfection for realism
  normal {dents 0.05 turbulence <0.2,0.2,0.4> scale <0.3,0.3,0.9>}
  // surface finish
finish { ambient 0 diffuse 0 specular 0.99 roughness 0.003
 reflection {0.95}
 }
}
 photons {
  target
  reflection on
  refraction off
   collect off
  }
}

// Define a plane on which to measure the light
plane { z, 7.0
pigment { color blue 1 }
finish {
 // specular highlights, other finish characteristics might be important
  ambient 0.1 diffuse 0.2 specular 0.1 roughness 0.09
  }
 photons {
  target
  reflection off
  refraction off
   collect on
  }
}

// Define a light source
light_source { <0, 0, 1>, <0.7, 0.8, 0.9>
 fade_distance 3
 fade_power 1
 photons {
  reflection on
  refraction off
  }
}

#break
#case (2)
/* testing scene */

// Find light intensity (pigment of plane)
#include "functions.inc"

#declare Image=
 pigment {
  image_map {
   png "flashlit.png"
   once
  }
   translate -0.5
   scale <4/3,1,1>
 }

plane {z,1
 pigment {Image}
 finish {ambient 1 diffuse 0}
}

camera {
 orthographic
 location 0
 look_at z
 right 4/3*z
 up y
}

#declare Point=<0.1,0.2,0>;
#declare Intensity = eval_pigment(Image, <Point.x, Point.y, Point.z>);
#debug concat("\n Light beam intensity at point ",
 str(Point.x,1,-1),",",
  str(Point.y,1,-1),
  " is ",
   str(Intensity.gray,1,-1), "\n")

#break
#end


Post a reply to this message

From: hughes, b 
Subject: Re: Using POV-Ray... cmd:
Date: 6 Nov 2002 21:17:25
Message: <3dc9cd35$1@news.povray.org>
Sorry, just after posting my reply I realized you are new to POV-Ray and
might not have any idea what those lines with // cmd: are about. You can put
those into the command line field of POV-Ray for Windows 3.5 (I don't use
other platforms/versions) by right-clicking on the words of either line and
selecting Copy "" to command line.

Also, read the scene help about photons, at section 6.10, and eval_pigment,
at section 7.7.3.

P.S. I hadn't actually written that thing for an hour, I spent a lot of that
time trying to figure out that quadric until I just made my own paraboloid
instead.  :-)


Post a reply to this message

From: hughes, b 
Subject: Re: I left out important line too, sorry!
Date: 7 Nov 2002 01:05:01
Message: <3dca028d@news.povray.org>
I just can't win when I'm doing this stuff immediately to help people.
Hopefully I'm not to late to say that the #switch directive was left out
before.

Oh well, gives me a chance to post this new scene file which writes and
reads the results.


/* how to test flashlight beam on wall for brightness */


/* use appropriate command for each rendering or you'll overwrite the image
*/

// create scene
// cmd:+fn +oC:\images\flashlite.png

// write file
// cmd:-f

// read file
// cmd:-f


// which scene? 1 or 2, any other number to read file
#declare Scene=0;

#switch (Scene)
#case(1)
/* setup scene */
global_settings {
 photons {
  spacing 0.02
  // autostop 0
 }
}

camera {
location <0, 0, 0>
look_at <0, 0, 1>
}

// I used a different paraboloid here
quadric {
<0.5, 0.5, 0>, <0, 0, 0>, <0, 0, -1>, 0
clipped_by {
 plane {z,2} // wide end opening
 plane {-z,-0.2} // narrow end opening
 }
texture {
 pigment {rgb 0.5}
 // a little imperfection for realism
  normal {dents 0.05 turbulence <0.2,0.2,0.4> scale <0.3,0.3,0.9>}
  // surface finish
finish { ambient 0 diffuse 0 specular 0.99 roughness 0.003
 reflection {0.95}
 }
}
 photons {
  target
  reflection on
  refraction off
   collect off
  }
}

// Define a plane on which to measure the light
plane { z, 7.0
pigment { color blue 1 }
finish {
 // specular highlights, other finish characteristics might be important
  ambient 0.1 diffuse 0.2 specular 0.1 roughness 0.09
  }
 photons {
  target
  reflection off
  refraction off
   collect on
  }
}

// Define a light source
light_source { <0, 0, 1>, <0.7, 0.8, 0.9>
 fade_distance 3
 fade_power 1
 photons {
  reflection on
  refraction off
  }
}

#break
#case (2)
/* testing scene */

// Find light intensity (pigment of plane)

#include "functions.inc"

#declare Image=
 pigment {
  image_map {
   png "flashlite.png"
   once
  }
   translate -0.5
   scale <4/3,1,1>
 }

plane {z,1
 pigment {Image}
 finish {ambient 1 diffuse 0}
}

camera {
 orthographic
 location 0
 look_at z
 right 4/3*z
 up y
}


#declare I=0.1; // increment

#fopen FlashLight "c:\\images\\flashlight.txt" append

#declare X=-4/3/2;

#while (X<=+4/3/2)

#declare Y=-1/2;

#while (Y<=+1/2)

#declare Point=<X,Y,0>;

#declare Intensity = eval_pigment(Image, <Point.x, Point.y, Point.z>);

 #write (FlashLight
  concat(
 str(Point.x,1,-1),
 ",",
 str(Point.y,1,-1),
 ",",
 str(Intensity.gray,1,-1),
 ",\n" // last comma so data can be read later
 )
 )

#declare Y=Y+I;

#end

#declare X=X+I;

#end

#fclose FlashLight

#break

#else // if not 1 or 2


/* Scene!=1|2 */

#fopen FlashLight "c:\\images\\flashlight.txt" read

 #while (defined (FlashLight))

 #read (FlashLight, Px, Py, Il)

 #debug concat(str(Il,1,-1),"\n") // anything else could be done here

 #end

#end // switch


Post a reply to this message

From: Warp
Subject: Re: Using POV-Ray to model a flash-light
Date: 7 Nov 2002 10:15:59
Message: <3dca83af@news.povray.org>
Goran Arbanas <gor### [at] verizonnet> wrote:
> We would like to model a flash-light consisting of a parabolic mirror and a
> light source at the focus of this paraboloic mirror.

  In order for the light to be reflected from the mirror you need to use
the photon mapping feature. The POV-Ray documentation should explain its
usage in detail.

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

From: Goran Arbanas
Subject: Re: I left out important line too, sorry!
Date: 7 Nov 2002 18:59:07
Message: <3dcafe4b$1@news.povray.org>
Thank you for expanding so much effort to educate me, and I apologize for
introducing the confusion with the mirror shape.

While playing with the scene you generously provided, I found it helpful to
decrease the intensity of the light source in order to get a better
understanding of the central white spot one gets when using the light source
of intensity close to 1.

Thanks again,

Goran


"hughes, b." <omn### [at] charternet> wrote in message
news:3dca028d@news.povray.org...
> I just can't win when I'm doing this stuff immediately to help people.
> Hopefully I'm not to late to say that the #switch directive was left out
> before.
>
> Oh well, gives me a chance to post this new scene file which writes and
> reads the results.
>
>
> /* how to test flashlight beam on wall for brightness */
>
>
> /* use appropriate command for each rendering or you'll overwrite the
image
> */
>
> // create scene
> // cmd:+fn +oC:\images\flashlite.png
>
> // write file
> // cmd:-f
>
> // read file
> // cmd:-f
>
>
> // which scene? 1 or 2, any other number to read file
> #declare Scene=0;
>
> #switch (Scene)
> #case(1)
> /* setup scene */
> global_settings {
>  photons {
>   spacing 0.02
>   // autostop 0
>  }
> }
>
> camera {
> location <0, 0, 0>
> look_at <0, 0, 1>
> }
>
> // I used a different paraboloid here
> quadric {
> <0.5, 0.5, 0>, <0, 0, 0>, <0, 0, -1>, 0
> clipped_by {
>  plane {z,2} // wide end opening
>  plane {-z,-0.2} // narrow end opening
>  }
> texture {
>  pigment {rgb 0.5}
>  // a little imperfection for realism
>   normal {dents 0.05 turbulence <0.2,0.2,0.4> scale <0.3,0.3,0.9>}
>   // surface finish
> finish { ambient 0 diffuse 0 specular 0.99 roughness 0.003
>  reflection {0.95}
>  }
> }
>  photons {
>   target
>   reflection on
>   refraction off
>    collect off
>   }
> }
>
> // Define a plane on which to measure the light
> plane { z, 7.0
> pigment { color blue 1 }
> finish {
>  // specular highlights, other finish characteristics might be important
>   ambient 0.1 diffuse 0.2 specular 0.1 roughness 0.09
>   }
>  photons {
>   target
>   reflection off
>   refraction off
>    collect on
>   }
> }
>
> // Define a light source
> light_source { <0, 0, 1>, <0.7, 0.8, 0.9>
>  fade_distance 3
>  fade_power 1
>  photons {
>   reflection on
>   refraction off
>   }
> }
>
> #break
> #case (2)
> /* testing scene */
>
> // Find light intensity (pigment of plane)
>
> #include "functions.inc"
>
> #declare Image=
>  pigment {
>   image_map {
>    png "flashlite.png"
>    once
>   }
>    translate -0.5
>    scale <4/3,1,1>
>  }
>
> plane {z,1
>  pigment {Image}
>  finish {ambient 1 diffuse 0}
> }
>
> camera {
>  orthographic
>  location 0
>  look_at z
>  right 4/3*z
>  up y
> }
>
>
> #declare I=0.1; // increment
>
> #fopen FlashLight "c:\\images\\flashlight.txt" append
>
> #declare X=-4/3/2;
>
> #while (X<=+4/3/2)
>
> #declare Y=-1/2;
>
> #while (Y<=+1/2)
>
> #declare Point=<X,Y,0>;
>
> #declare Intensity = eval_pigment(Image, <Point.x, Point.y, Point.z>);
>
>  #write (FlashLight
>   concat(
>  str(Point.x,1,-1),
>  ",",
>  str(Point.y,1,-1),
>  ",",
>  str(Intensity.gray,1,-1),
>  ",\n" // last comma so data can be read later
>  )
>  )
>
> #declare Y=Y+I;
>
> #end
>
> #declare X=X+I;
>
> #end
>
> #fclose FlashLight
>
> #break
>
> #else // if not 1 or 2
>
>
> /* Scene!=1|2 */
>
> #fopen FlashLight "c:\\images\\flashlight.txt" read
>
>  #while (defined (FlashLight))
>
>  #read (FlashLight, Px, Py, Il)
>
>  #debug concat(str(Il,1,-1),"\n") // anything else could be done here
>
>  #end
>
> #end // switch
>
>


Post a reply to this message

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