Commit Graph

501 Commits

Author SHA1 Message Date
339568ec0c Remove stale comments. 2020-09-10 22:42:20 +09:00
7066c38189 Implement an experimental packed HDR RGB 32-bit storage format. 2020-09-10 22:36:20 +09:00
80f9c3cc2d Implement interpolation of surface closures between micropoly vertices. 2020-05-01 16:08:37 +09:00
946a1860e0 Remove hierarchical instancing.
After thinking about this and after some discussion with other
people, I now believe that hierarchical instancing isn't actually
that useful in practice for rendering.

Single-level instancing is still supported, of course.
2020-05-01 16:08:37 +09:00
66dcbc2e7f Re-implemented nicer error reporting.
We lost this in the initial move to streaming parsing.  All
errors now (again) print out a line number and an error message.
2020-05-01 16:08:37 +09:00
46d0ef3b28 More parsing code cleanup and better error messages. 2020-05-01 16:08:37 +09:00
331b0229b0 More parsing code cleanup and some better error messages.
Still more to do, but this is some decent progress.
2020-05-01 16:08:37 +09:00
c1f8d21814 Refactored data tree code to present a slightly nicer API. 2020-05-01 16:08:37 +09:00
6b188c4451 Parse errors now use Strings for error messages.
This allows the error messages to be more informative by including
dynamically determined information.

Also made a utility function for ensuring that nodes get closed.
2020-05-01 16:08:37 +09:00
4f564d1474 All parsing is now streaming! But lots left to do.
In particular, parsing error messages are now either terrible or
non-existent.  But it compiles and works for correct inputs!
2020-05-01 16:08:37 +09:00
5196e8e2c2 Remove more trailing zeros from example scenes that I missed last time. 2020-05-01 16:08:37 +09:00
e3e5c1412f WIP refactor to make psy parsing all streaming.
Does not build right now.
2020-05-01 16:08:37 +09:00
9d5bc63fa5 Created a separate reader type for streaming data tree reading. 2020-05-01 16:08:37 +09:00
3eca7eae25 Take data reading out of the data tree parser.
It's now the responsibility of the caller to feed the parser
data as needed.
2020-05-01 16:08:37 +09:00
9c8dd4d882 Initial just-get-it-working port of scene paring code to streaming data tree.
It doesn't actually stream yet, just loads the whole parse into
memory, but done via the new streaming code.
2020-05-01 16:08:37 +09:00
7f1b1d2382 Fixed silly bug in data tree parser. 2020-05-01 16:08:37 +09:00
1f4947e895 Data tree parser: only read more data when needed.
Before this, it would eagerly load more data on every call, which
defeats the whole point.
2020-05-01 16:08:37 +09:00
ccd7e141fb First implementation of a streaming parser for the data tree format. 2020-05-01 16:08:37 +09:00
ce10522914 Remove unnecessary trailing zeros from the example files. 2020-05-01 16:08:37 +09:00
2998bbe7ce WIP refactor for new scene data layout.
All rendering code is commented out for now.  It will need to be
largely rewritten after this refactor is done, most likely.

This commit gets the basic new scene parsing working, with the basic
new data structures.
2020-05-01 16:08:37 +09:00
7f9f576093 Added back bicubic patch export to Psychoblend.
It's a useful primitive for testing microgeometry code.
2020-05-01 16:08:37 +09:00
4207c77e27 Some code tidying in Psychoblend.
Specifically:
1. Factored out color exporting.
2. Switched floating point writing to use .format() with 6 digits
   of precision.  The main gain here is that numbers like 1.0
   don't print with a bunch of useless trailing zeros.
2020-05-01 16:08:37 +09:00
26b5ee3b55 Further updates to the .psy format.
The importance change here is bundling object data and its
instances together.  This makes it possible to process the
scene data (e.g. for splitting, dicing, and de-instancing)
without having to cache arbitrary amounts of scene data.

In other words, this should allow for much more efficient
scene processing down the line.
2020-05-01 16:08:37 +09:00
99b6ddfa54 Run clippy on Sobol sampler, and fix/silence warnings. 2020-05-01 16:07:19 +09:00
78acaa7b63 Make Sobol SIMD code work on all x86-64 platforms.
Before this it needed SSE 4.1, which is not strictly present on
all x86-64 platforms.  This will still compile the faster path if
SSE 4.1 is available, but has an alternate path as well for all
x86-64 platforms.
2020-05-01 15:32:18 +09:00
fd75a72655 More code tidying of the Sobol sampler.
In particular, clearer and more concise documentation.
2020-05-01 10:42:02 +09:00
45241784fb Code tidying on the Sobol sampler.
Also swapped the sample index and dimension paramater in the function
signature.  This feels more intuitive.
2020-04-30 22:46:47 +09:00
1f75e7854e Properly hash all four scramble values in the 4d Sobol sampler. 2020-04-25 18:12:35 +09:00
72adbedbb4 Accelerate the Sobol sampler with SIMD on x86_64. 2020-04-24 23:32:43 +09:00
0dfe916523 Preparing for SIMD accelerated Sobol sampling.
This implements the 4-wide API, and moves the renderer over to it.
But the actual implementation is still scalar.
2020-04-24 21:05:29 +09:00
78b5cf4c53 Faster lk hash for the sobol sampler.
This gets about the same quality as the previous hash, but in
much fewer operations.
2020-04-24 10:47:53 +09:00
2c68e18bd6 Use golden ratio sampling for wavelength again.
Now that the Sobol sequence can be decorrelated, this doesn't
introduce sampling correlation problems anymore, so it's mostly
just a win.
2020-04-23 14:46:21 +09:00
3ffaf7bee5 Forgot to use a wrapping multiply instead of a straight multiply. 2020-04-23 13:52:04 +09:00
29fcc69ae1 Move seed hashing into the lk_scramble function. 2020-04-23 13:36:04 +09:00
c0a8c955c4 Make LightPath::new() harder to mis-use. 2020-04-23 08:32:44 +09:00
b776bf56b8 Improved lk scrambling function.
This actually gets very close to the behavior of a full per-bit
hash, except that you still need a fairly random seed.
2020-04-23 08:31:03 +09:00
22b7151919 Use independent Sobol sequences for different sets of dimensions.
This reduces correlation artifacts, while preserving good convergence
for the most part.
2020-04-22 18:48:12 +09:00
aecff883ab Misc optimizations on the Sobol sampler.
The biggest one is avoiding a bunch of bit reversals by keeping
numbers in bit-reversed form for as long as we can.

Also reduced the hashing rounds: just 2 rounds seems to be enough
for a reasonable amount of statistical independence on both the
scrambling and shuffling.  I tested both independently, keeping
the other with no scrambling/shuffling respectively.  This makes
sense because in normal contexts 3 is enough, but in this case
both act as input to yet another hash which is effectively doing
more rounds.
2020-04-22 16:21:50 +09:00
660576ec2b Make Sobol seeding more robust.
This way incremental seeds can be passed (e.g. 0, 1, 2, etc.) and
still get statistically independent Sobol sequences.
2020-04-22 14:19:57 +09:00
085d1d655e A single unified Sobol implementation.
This version of Sobol implements both Owen scrambling and index
permutation, allowing for multiple statistically independent
Sobol sequences.
2020-04-19 01:11:43 +09:00
f36b71184a Use better seeding for slow version of Owen scramble as well. 2020-04-17 13:18:37 +09:00
b74a58cb72 Improvement for sampling at low sample counts. 2020-04-17 11:04:33 +09:00
c4e1bedd43 Improve Owen scrambling by seeding with add instead of xor.
Also removed some unnecessary complexity from the implementation,
and use different constants.
2020-04-17 10:42:35 +09:00
8deb305850 Use a much better approximation of the probit function.
For 32-bit floating point, it can essentially be considered exact.
2020-03-27 21:19:24 +09:00
e46fc5a4d6 Cleaning up Sobol sampling code.
In particular, removing some things I tried when the golden ratio
sampling was causing problems, but that are now no longer needed.
2020-03-21 09:00:43 +09:00
3916043f33 Removed golden ratio sampling.
Turns out it causes interference with the Sobol sampler.

Also tweaked some other things about sampling after removing
golden ratio sampling, to make things better.
2020-03-19 19:49:45 +09:00
e014df2b1a Fix rare panic in Sobol sampler.
Due to the undefined behavior of shifting a number by its
bit-width, the Sobol sampler would panic when sample index
`1 << 15` was requested.

This fixes it without introducing any additional checks or
operations.
2020-03-19 09:59:19 +09:00
7daa133e15 Only use 16 bit integers for generating Sobol samples.
This limits the number of samples per dimension to 2^16, but that
should be more than enough for any rendering situation.  And this
reduces the direction numbers table size by a factor of 4.

This commit also takes advantage of the reduced bit space to
provide even better Owen scrambling, by utilizing the unused
16 bits for better mixing.
2020-03-19 08:58:42 +09:00
9e14e164e7 More improvements to Sobol sampling.
- Added an additional scramble round to the Owen scrambling, with
  new optimized constants.
- Reordered the dimensions of the direction numbers to improve 2d
  projections between adjecent dimensions.  Only did this for
  dimensions under ~40.
2020-03-18 12:05:42 +09:00
de5a643a2a Implement Sobol sampler that does both Owen and Cranley-Patterson.
This seems to work well in practice, and only takes one more addition
operation.
2020-03-17 20:00:09 +09:00