POV-Ray : Newsgroups : povray.text.scene-files : light reflector, test for brightness variations Server Time
22 Dec 2024 18:50:01 EST (-0500)
  light reflector, test for brightness variations (Message 1 to 1 of 1)  
From: hughes, b 
Subject: light reflector, test for brightness variations
Date: 11 Dec 2002 21:32:16
Message: <3df7f530@news.povray.org>
/* how to test flashlight beam on wall for brightness (see Goran Arbanas,
Nov 6, 2002 at povray.newusers group) */

/* 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=1;

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

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

// the reflector
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
  }
}

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

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

#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.