|
|
On Fri, 17 Sep 1999 15:47:37 +0200, Marc Schimmler wrote:
>I wonder if there are any publications available about the method used
>in the media feature of POVRAY. I hope that I might be able to predict
>the behaviour of media in a better way. Until now it's only guessing.
>Understanding the algorithm might help.
This is sort of covered in the "Sampling Parameters" section of the
documentation, but it can't hurt to go over it again in more detail.
Okay, the sampling algorithm is like this:
We start with a ray. Because of the nature of rays, we're guaranteed
that the entirety of this ray is either in or out of each media block
in the scene. That is, a given ray cannot enter or leave a medium.
For spotlights and cylinder lights, we can determine which parts of
the ray pass through the light cones. To aid in computing media
interactions with spotlights, we break the ray into chunks at the
points where it intersects the light cones, creating "lit" and
"unlit" chunks. "Unlit" is a misnomer, of course, if you also have
point light sources. Those chunks are further split into intervals,
so that the ratio of lit to unlit intervals is the ratio specified
in the media statement, and the total number of intervals is the
number specified.
Now, we build a list of which media a ray interacts with. Then, for
each medium, and for each interval (as computed above), we compute
one or more samples. We always compute as many samples as the
specified minimum. More samples are computed if necessary to bring
the variance and confidence within this interval within the bounds
specified in the media statement.
So what can we learn from this?
One thing we can learn is that if there is a particular region of the
media that we want to be sampled more, perhaps because it contains an
important detail, it can help to enclose it in a hollow transparent
object, separate from the media container if need be. For example,
if you have a complex multiple-density media using spheres and boxes
and cylinders inside a single container, it helps to add transparent
hollow objects that contain those individual densities. The reason
this works is because POV spawns a new ray whenever it hits an object,
whether or not that object has any effect on the current ray. Since
each ray is treated separately, this has the effect of forcing more
evaluations in the enclosed regions. Remember to increase your
max_trace_level.
Likewise, if you have light beams that don't come from spotlights or
cylinder lights (for example, one that shines through a crack in
the wall or through a window) you should bound them with invisible
objects to increase the sampling density in their vicinity and create
artificial intervals. If the effect is localized and you can't see
the effects of the light on the outside of the container (the typical
"moonlight through a window" scene) consider using a spotlight instead
of a point light, even if the "natural" light source is a point. To
prevent fading at the edges, remember to specify a tightness of zero
for the spotlight.
Bounds don't have to be solid CSG-able objects. They can be as
simple as patches, discs, or triangles - just hitting one is enough to
spawn a new ray. Remember that even patches and triangles used for
this purpose should be hollow, even if that doesn't seem to make
sense intuitively. And all of this advice about patch objects goes
out the window if your container has a nondefault IOR. Never put
a transparent patch inside such an object, because it will always
mess up the refraction calculations.
Another thing we can learn is that we probably don't exploit the
available features enough. The default values for intervals and
samples aren't very useful. In particular, the default 1,1 for
samples means that the confidence and variance parameters never get
used - there will always be exactly one sample per interval, for a
maximum of ten samples per ray if you're using the default intervals.
So the first thing to do is specify more or better samples.
If your lights are primarily spotlights, or if the media effects
you're looking for are mainly in the form of spotlight beams, boost
the ratio so you won't waste intervals on unlit parts of the scene.
If, however, the spotlights shouldn't get so much emphasis, decrease
the ratio. The default of .9 is pretty high if you're only using
the default intervals of 10 - consider that a ray that intersects
a single spotlight will end up having two unlit intervals to cover
the entire space outside the spotlight cone (or one, if the ray
either starts or ends inside the cone) and eight (or nine) to cover
the (usually much smaller) space inside.
Post a reply to this message
|
|
|
|
On Fri, 17 Sep 1999 21:16:46 +0200, Marc Schimmler
<mar### [at] icauni-stuttgartde> wrote:
>If you ask me it wouldn't hurt if this goes into to manual as a further
>explanation (how about it Alan?).
Oh, I think Ron might be persuaded to allow his explanation to be added to
the docs :) I'd better save his article to file before I lose track of it a
few months from now.
--
Alan ---------------------------------------------------------------
http://www.povray.org - Home of the Persistence of Vision Ray Tracer
news.povray.org - where POV-Ray enthusiasts around the world can get
together to exchange ideas, information, and experiences with others
Post a reply to this message
|
|
|
|
On Fri, 17 Sep 1999 17:11:19 -0700, Alan Kong wrote:
>On Fri, 17 Sep 1999 21:16:46 +0200, Marc Schimmler
><mar### [at] icauni-stuttgartde> wrote:
>
>>If you ask me it wouldn't hurt if this goes into to manual as a further
>>explanation (how about it Alan?).
>
> Oh, I think Ron might be persuaded to allow his explanation to be added to
>the docs :) I'd better save his article to file before I lose track of it a
>few months from now.
Works for me, but let me edit it first. Some of my suggestions can lead to
media containers becoming visible if you don't use them carefully, and I'd
like to note that. And someone else who understands media should probably
read it and see which parts I messed up. :)
Post a reply to this message
|
|