POV-Ray : Newsgroups : povray.documentation.inbuilt : Anti-aliasing mode 3 : Anti-aliasing mode 3 Server Time
25 Apr 2024 01:15:15 EDT (-0400)
  Anti-aliasing mode 3  
From: clipka
Date: 16 Sep 2018 20:15:15
Message: <5b9ef213$1@news.povray.org>
As I'm writing this post, I'm about to finalize the integration of
UberPOV's Anti-aliasing mode 3 into POV-Ray v3.8.0-alpha.


This change affects the following command-line and INI file options:

Anti-aliasing options:

    Sampling_Method=n / +AMn             (now allows value 3)
    Antialias_Confidence=n.n / +ACn.n    (new)

General tracing options:

    Stochastic_Seed=n / +SSn             (new)


Description of Anti-aliasing mode 3:


This third, adaptive, non-recursive stochastic oversampling mode
repeatedly iterates over the pixels to be rendered, jittering each ray
randomly within the pixel on each pass, while keeping track of
statistical parameters such as average colour and mean deviation. On
subsequent passes, the algorithm ceases to oversample pixels where the
statistical parameters for the pixel itself and its immediate four
neighbors indicate that the result is "probably good enough".

What constitutes "probably good enough" is determined by a /confidence/
parameter specified by the `Antialias_Confidence=n.n` or `+ACn.n`
option, as well as a /threshold/ parameter specified by the
`Antialias_Threshold=n.n` or `+An.n` option.

The /threshold/ determines what absolute sampling error (i.e. difference
between the computed pixel colour and the theoretically correct one) you
consider acceptable, while the /confidence/ specifies how sure you want
to be that a pixel that /seems/ acceptable actually /is/ acceptable. In
effect, this determines how many pixels in the resulting image /will/
indeed be acceptable.

For example, if you specify a confidence of 0.95, then you can expect
approximately 95% of all pixels to be within the threshold (as compared
to a theoretically correct image). Of the remaining ones, many will be
off by slightly more than the threshold, while only few will be
significantly off, and extreme outlies are possible but extremely unlikely.

Recommended values are a threshold of 0.3 or lower, and a confidence of
0.9 or higher, which are the defults.

The total number of rays shot per pixel is limited by the
`Antialias_Depth=n` or `+Rn` parameter. As with the other modes the
parameter is limited to the range from 1 to 9, with the actual maximum
number of rays per pixel being 4^n.

By default, the sub-pixel jittering is different for each render, thus
giving slightly different results, with the intent that multiple renders
can be averaged to get a higher-quality image. To produce exactly the
same output each time, use the `Stochastic_Seed=n` or `+SSn` option.
(Note however that the jitter sequence is also affected by the actual
image content, and will thus always differ between the frames of an
animation.)

As oversampling mode 3 is a very generic adaptive oversampling
algorithm, its performance in pure edge anti-aliasing is generally
inferior to the other modes; however, it is ideally suited to suppress
random image noise created by other stochastic mechanisms, such as
jittered area lights, subsurface light transport, or micronormals-based
blurred reflections. It has also proven well-suited to eliminating moire
patterns.


Description of Stochastic_Seed / +SS:


By default, some stochastic mechanisms in POV-Ray intentionally give
different results for each render, with the intent that multiple renders
can be averaged to get a higher-quality image. To this end, the
corresponding pseudo-random number generators are seeded with a value
derived from the current date and time.

If the `Stochastic_Seed=n` or `+SSn` option is specified, the seed will
instead be derived from the specified value, allowing to produce exactly
the same output each time by specifying the same value.

Alternatively, the mechanism may be co-opted to prevent separate renders
started at the same time from producing identical results, by explicitly
specifying different values.

Note that even if the seed is set identical, other factors may cause
differences in the result, for example the render block size (+BSn) or
the render pattern (+RPn). Results may also differ between versions of
POV-Ray.

At present, the following features are sensitive to the stochastic seed
setting:

  - Anti-aliasing mode 3


----------------------------------------------------------------------


Differences to UberPOV (not intended for the docs):


* Threshold parameter:

UberPOV's anti-aliasing mode 3 required a threshold setting of 0.1 or
lower for good results, far lower than the default of 0.3 the other
modes are perfectly happy with. This is because UberPOV's mode 3
compared the differences of each colour channel to the threshold
individually, whereas the other modes compare the sum of all channels'
differences to the threshold instrad.

I have changed this in POV-Ray, so that mode 3 will also compare the sum
rather than the per-channel differences.


* Stochastic Seed:

UberPOV used a different seed for each thread (differing by 1), and did
not re-seed the random number generator between render blocks; as a
result, multi-threaded renders couldn't be reliably reproduced even when
explicitly setting the seed.

POV-Ray is re-seeding the random number generator for each render block,
using the specified seed + the running ID of the render block as the
actual seed. This allows to reproduce renders, provided that the same
render block size and render pattern are used.


----------------------------------------------------------------------


Additional related side notes (not intended for the docs):

The observant reader will note that the anti-aliasing mode 3's maximum
number of samples per pixel is close, but not identical, to the value
for mode 2 as specified in the docs in the table of `Antialias_Depth=n`
/ `+Rn` values.

It may be worth mentioning that the table for mode 2 is inaccurate in
that it doesn't take into account that samples at a pixel's corner or
edge are re-used for adjacent pixels where applicable. Only at the
render block border are edge or corner samples really used for one pixel
only.

So even the worst-case maximum per pixel in mode 2 is actually far
closer to 4^n than the (2^n+1)^2 given in the table.


Post a reply to this message

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