Generate sobol direction numbers from text file.

This way the numbers aren't cluttering up the source file, and
this also makes it easier to play with other direction numbers.
This commit is contained in:
Nathan Vegdahl 2020-03-17 15:21:15 +09:00
parent 9c20c7a02f
commit 04a5dbff43
6 changed files with 3166 additions and 1042 deletions

View File

@ -707,8 +707,14 @@ fn get_sample(dimension: u32, i: u32, pixel_co: (u32, u32), seed: u32) -> f32 {
n as f32 * (1.0 / (1u64 << 32) as f32)
}
n if (n - 1) < sobol::MAX_DIMENSION as u32 => {
let dim = n - 1;
// Sobol sampling.
sobol::sample_owen(dimension - 1, i, hash_u32(dimension, scramble))
// We skip the first three dimensions here because it gives better
// results on many scenes for some reason. This is likely worth
// investigating in the future, as it may indicate poor sampling
// elsewhere in the rendering pipeline (and skipping the first
// two dimensions may just mask it).
sobol::sample_owen(dim + 3, i, hash_u32(dim, scramble))
}
_ => {
// Random sampling.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,43 @@
The data in this folder is from the website
http://web.maths.unsw.edu.au/~fkuo/sobol/
From these papers:
* S. Joe and F. Y. Kuo, Remark on Algorithm 659: Implementing
Sobol's quasirandom sequence generator, ACM Trans. Math. Softw. 29,
49-57 (2003)
* S. Joe and F. Y. Kuo, Constructing Sobol sequences with better
two-dimensional projections, SIAM J. Sci. Comput. 30, 2635-2654
(2008)
Copyright (c) 2008, Frances Y. Kuo and Stephen Joe
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the
distribution.
* Neither the names of the copyright holders nor the names of the
University of New South Wales and the University of Waikato
and its contributors may be used to endorse or promote products
derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff