POV-Ray : Newsgroups : povray.advanced-users : Intensity Mapping : Re: Intensity Mapping Server Time
3 Jul 2024 05:41:47 EDT (-0400)
  Re: Intensity Mapping  
From: clipka
Date: 17 Dec 2008 21:55:00
Message: <web.4949bac567084438abad780@news.povray.org>
"Colin" <nomail@nomail> wrote:
> How do I read the brightness into a matrix of integer values corresponding to
> the pixel locations?

Ah, so having the values in a bitmap image doesn't help you, and you actually
need them as a 2-dimensional array instead?

Hm...

(a) Get POV-ray to render an orthographic image anyway. Use a second POV-ray
"render" to load that image as a pigment bitmap, use this pigment as a pigment
function, and voila - there you have that function you need. You can decide
yourself whether you want to make an array of it, or just use that function to
get the values at specific locations.

(b) This one gets a bit trickier: Build your own "photon tracer" from building
blocks provided by POV-ray. Do as follows:
- #declare a union of your reflector object and a plane where you want to
measure light intensity
- #declare a 2-dimensional array to count your photons
- think of an algorithm that gives you a (very large) series of
evenly-distributed directions to shoot photons from the light source (random
directions generated with vrand_on_sphere might do, but less noisy approaches
might yield more accurate results with less photons to shoot)
- loop through this series of diection, shooting a photon for each direction as
follows:

- remember the light source posotion and photon direction as the "current
location" and "current direction"
- repeat the following until... um, well, until you're done with this photon:

- call trace() with the current location & direction and your reflector/plane
union; this will trace a ray from the current location in the current direction
and get the nearest intersection point with the reflector or plane, plus the
surface normal at that point.
- if you do not get any intersection point, you're done.
- otherwise, if that intersection point is on your "measuring plane", compute
the array co-ordinates from the intersection point, and count up the
corresponding array entry. As you won't get exact hits, you may want to kind of
assign "fractions of a photon" to the nearest four array entries. You're done
for this photon.
- otherwise (i.e. if you do get an intersection point but it's not on the
measuring plane), take the intersection point as you new current location, and
mirror the current direction according to the surface normal you got from
trace(). (You may also want to reduce the photon "weight" depending on
reflector material). Note that you're *not* done in this case.
- make sure you add some iteration limit to this loop, or you may get stuck in
an endless one.

- When you're done with a photon, proceed with the next direction from your
series, starting at the light source again.

- When you're done with all directions, evaluate your results.

You may also want to count "lost" photons that escape your setup without hitting
the measurement plane, and "stuck" photons that never seem to make it out of the
reflector.


Post a reply to this message

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