POV-Ray : Newsgroups : povray.newusers : Using POV-Ray to model a flash-light : Re: Using POV-Ray to model a flash-light Server Time
31 Jul 2024 06:23:07 EDT (-0400)
  Re: Using POV-Ray to model a flash-light  
From: hughes, b 
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

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