Commit Graph

450 Commits

Author SHA1 Message Date
04a5dbff43 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.
2020-03-17 15:21:15 +09:00
9c20c7a02f Improve Owen scrambling and add Cranley-Patterson rotation.
- Updated constants for Owen scrambling, based on better optimization
  criteria.
- Increased randomness for the higher bits in the Owen scrambling.
- A simple and efficient implementation of Cranley-Patternson rotation
  for the Sobol sampler.
2020-03-17 12:26:02 +09:00
d49a1c4921 Clean up the sampling code a little.
All of the samplers were using the same scramble value, so I
factored it out and documented its intent.
2020-03-16 10:14:09 +09:00
5114d428da Use the seed value in random value generation.
I forgot to add this in.  It wasn't noticable, since the QMC
sequences did use the seed, and we probably don't ever get to
the random values for 15+ light bounces.  But it seems worth
fixing anyway!
2020-03-16 09:57:01 +09:00
deaacd73fb Reuse same hash function for ints and floats.
The code was simply duplicated before, for no real reason.
2020-03-16 09:50:10 +09:00
420e078b70 Some cleanup of the comments in the last commit. 2020-03-15 22:37:34 +09:00
047e66d9aa Reworked Sobol sampler implementation.
This produces identical results, but generates the direction
vectors from the original sources at build time.  This makes
the source code quite a bit leaner, and will also make it easier
to play with other direction vectors in the future if the
opportunity arises.
2020-03-15 22:01:06 +09:00
42a6c1e9cd Use proper wrapping arithmetic in the golden ratio sampler. 2020-03-15 18:10:03 +09:00
ffc77ee1d5 Implement optimization for sobol sampler.
This significantly increases the sobol sampler's speed, especially
for higher sample counts.
2020-03-15 18:05:39 +09:00
c9f24e2728 Silence code style warning on generated Halton sampler code. 2020-03-15 17:17:39 +09:00
9b4781c81d Multiple improvements to sampling.
1. Use better constants for the hash-based Owen scrambling.
2. Use golden ratio sampling for the wavelength dimension.

On the use of golden ratio sampling:
Since hero wavelength sampling uses multiple equally-spaced
wavelengths, and most samplers only consider the spacing of
individual samples, those samplers weren't actually doing a
good job of distributing all the wavelengths evenly.  Golden
ratio sampling, on the other hand, does this effortlessly by
its nature, and the resulting reduction of color noise is huge.
2020-03-15 14:47:40 +09:00
e0cb436209 Minor sampling refactoring. 2020-03-13 14:51:14 +09:00
a3ea90afdc Fixed broken Owen scrambling.
The previous implementation was fundamentally broken because it
was mixing the bits in the wrong direction.  This fixes that.

The constants have also been updated.  I created a (temporary)
implementation of slow but full owen scrambling to test against,
and these constants appear to give results consistent with that
on all the test scenes I rendered on.  It is still, of course,
possible that my full implementation was flawed, so more validation
in the future would be a good idea.
2020-03-12 20:20:56 +09:00
9ba51cd43a Improvments to the owen scrambling. 2020-03-11 23:22:07 +09:00
db9efc6a55 Removed unsafe code from sobol sampler and improved its documentation. 2020-03-11 21:30:14 +09:00
b081424ba6 Implemented Owen scrambling for the Sobol sampler.
This gives better variance than random digit scrambling, at a
very tiny runtime cost (so tiny it's lost in the noise of the
rest of the rendering process).
2020-03-11 18:29:46 +09:00
8d16719cd2 Use a different function for giving pixels unique ids. 2020-02-22 11:59:08 +09:00
4a6284be40 Switch to sobol sampler.
The important thing here is that I figured out how to use the
scrambling parameter properly to decorrelate pixels.  Using the
same approach as with halton (just adding an offset into the sequence)
is very slow with sobol, since moving into the higher samples is
more computationally expensive.  So using the scrambling parameter
instead was important.
2020-02-22 09:18:45 +09:00
3d9eb23e1c Run rustfmt. 2020-02-22 07:36:44 +09:00
0b493b09ca Handle LDS permutation a little differently.
This produces identical results, but makes it easier to play
with other types of sequences.
2020-02-22 07:34:51 +09:00
022c913757 Split out memory arena into an external crate. 2019-12-27 10:43:03 +09:00
85503aec3b Updated examples to new yet-to-be-implemented scene format.
Will use these as basic test-cases.
2019-11-23 17:45:29 +09:00
df6aaeb527 Added parser for signed integers.
Not used at the moment, but was simple to add while I was in the
headspace for it, and it will likely be useful in the future.
2019-11-23 10:41:19 +09:00
e23fe4bb36 Fix deprecation warnings from rustc. 2019-11-23 10:21:16 +09:00
6e555456ba Updated Nom to 5.x
This makes the code a lot simpler and cleaner, among other things.
2019-11-23 10:13:29 +09:00
e586442a0a Cleaned up floating point ulp code.
The logic is much clearer now, and the code is more compact.
2019-10-30 21:05:01 +09:00
1aeb3ed7ff Updated example scenes to work again.
I had forgotten to update them when I changed how color input
worked.
2019-10-30 15:09:21 +09:00
c753890bb0 Fix/silence various clippy warnings. 2019-08-01 14:18:26 +09:00
ecbdf5d609 Make bilinear patch splitting a little smarter.
This way it doesn't just keep splitting on the same axis
repeatedly, creating narrow, long patches..
2019-08-01 13:49:44 +09:00
95e7d6bdea Silence some silly clippy warnings on generated code. 2019-08-01 13:43:32 +09:00
0c99ce8227 Playing around with surface patch implementation. Trying out ideas. 2019-07-31 22:46:06 +09:00
4999b31bf5 Bare beginnings of adding bilinear patches.
Mainly as a simple test-case for split-and-dice.
2019-07-31 06:45:45 +09:00
f021def789 Do better chromatic adaptation for input RGB colors. 2019-07-26 16:01:56 +09:00
f42eedfd08 Make better use of the types in the glam crate.
Appears to give a tiny performance boost.
2019-07-25 11:36:52 +09:00
e3179d5b2e Fix stupid bug with sphere lights introduced in the traversal rewrite. 2019-07-23 08:52:53 +09:00
88e7365bc4 Switched from in-tree float4 lib to glam. 2019-07-22 22:30:37 +09:00
5c5a01ecee Implemented basic SurfaceClosure compression for storing per-vertex.
This is really simple, and doesn't account for things like constant
parameters yet.  It's just to get things rolling.
2019-07-13 11:15:04 +09:00
41c2174d59 Updated MicropolyBatch for new traversal code etc. 2019-07-09 17:05:42 +09:00
4adc81b66b Minor code pretty-ing in the Jakob spectral upsampler. 2019-07-09 16:24:02 +09:00
70721be8e0 Moved separate functions in halton sampler inline into the match.
Doesn't really have much impact, but makes me feel better for some
reason.
2019-07-07 17:39:34 +09:00
103775f0e9 Some cleanup and improvements to the trifloat sub-crate. 2019-07-07 16:27:44 +09:00
e31ec6eb4e Added a new trifloat type that uses 48 bits and is signed. 2019-07-07 14:02:09 +09:00
152d265c82 Switched all uninitialized memory to use MaybeUninit. 2019-07-06 13:46:54 +09:00
452a29a95c
Merge pull request #11 from cessen/orst_traversal
ORST traversal
2019-07-06 09:55:50 +09:00
646139efda Factor out ray computations that are shared for all triangles. 2019-07-06 09:19:53 +09:00
4b612e2d1a Leaf triangle intersection now loops over triangles per ray.
This is the inverse of what was being done before, which was to
loop over all of the rays for each triangle.  At the moment, this
actually appears to be a tiny bit slower, but it should allow
for future optimizations testing against multiple triangles at once.
2019-07-06 09:01:24 +09:00
4f7335db8c Misc optimizations that add up to a nice speed boost. 2019-06-29 14:20:32 +09:00
c4b8971805 Clean up compiler warnings. 2019-06-29 12:43:24 +09:00
2a0ca001e2 Optimized ray stack task duplication with memcopy. 2019-06-29 12:39:28 +09:00
68fba19fc6 Removed a timer from a hot loop, and fixed node-test stat.
Gives I small performance boost, and now ray/node tests are
actually reported correctly.  Yay!
2019-06-29 09:46:39 +09:00