POV-Ray : Newsgroups : povray.general : media ignores an EVEN number of samples : Re: media ignores an EVEN number of samples Server Time
25 Apr 2024 03:52:17 EDT (-0400)
  Re: media ignores an EVEN number of samples  
From: clipka
Date: 20 May 2017 03:28:06
Message: <591ff006$1@news.povray.org>
Am 20.05.2017 um 00:47 schrieb Kenneth:

> Media (with default settings, at least) does not actually make use of an EVEN
> number of samples, but ignores that and reverts to the previous ODD value,
> visually. For example, an even value-- say 8, between 7 and 9-- shows NO change
> to media from 7 samples. I tried it with both scattering and absorption medias.

You are right in that when using sampling method 3, POV-Ray indeed
always uses an ODD minimum number of samples per interval.

However, POV-Ray actually always takes MORE samples than specified: If
the specified number is even, POV-Ray takes at least one more sample. If
the specified number is odd, POV-Ray takes at least two more.


The reason behind the odd minimum number of samples per interval with
method 3 is that POV-Ray subdivides the interval into N sub-intervals,
takes samples at the N+1 boundaries of those sub-intervals (avoiding
duplicates) and then for each of the N sub-intervals takes another
sample at the center to determine if it that sub-interval needs to be
sub-divided even more. Thus, a minimum of (N+1)+N = 2N+1 samples are
taken per interval, which is an odd number.

For some reason, N is computed as (S+1)/2 rounded down (where S is the
specified minimum number of samples), rather than S/2 rounded down,
which gives one more sub-interval than strictly needed if S is odd.

This may have to do with the fact that when there is more than one
interval, the first sample for any interval is taken at about the same
place as the last sample of the previous one [*], so that with M
intervals, of the M*(2N+1) samples taken, M-1 are actually duplicates
(give or take some jitter), so the effective total minimum number of
samples would be M*(2N+1)-(M-1) = M*2N+1, so for even S POV-Ray does not
effectively take one surplus sample per interval, but just one
additional sample in total.

[*The careful observer may notice a potential for performance
improvement here.]


> Perhaps it's some kind of now-and-then interplay between all the various
> media options like extinction, confidence, ratio, etc. OR, maybe a math
> interplay re: the number of scene lights vs. the number of media intervals--
> which the docs allude to in an arcane way (although I've never understood it).
> From the paragraph about 'ratio':
> "Note that the total number of intervals must exceed the number of illuminated
> intervals. If a ray passes in and out of 8 spotlights but you have only
> specified 5 intervals then an error occurs."

That section is only relevant for the old sampling methods 1 and 2.


Post a reply to this message

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