Commit Graph

52 Commits

Author SHA1 Message Date
2fddcae0fd Reduced the size of a hot return value.
Gives a small performance boost.
2019-06-28 22:22:41 +09:00
aed0f2ede1 Implemented a SIMD version of the BVH4.
It does indeed appear to be faster with this style of traversal!
2019-06-28 21:57:29 +09:00
5dd8eb919b Changed ray batch data access to be through methods.
This is (potentially) just temporary.  It's to make it a bit easier
to play with data layout to see how that affects performance.
2019-06-25 17:31:51 +09:00
eef29c2b2f Type alias for the ray index type.
Makes things easier to play with.
2019-06-23 19:26:30 +09:00
630a79aca5 Initial implementation of ORST traversal.
This is a "just get it working" implementation.  Performance
optimizations still need to be done.
2019-06-23 18:40:52 +09:00
28a07de456 Improve module path usage and remove extern crate declarations where possible. 2018-12-16 13:02:49 -08:00
178c0bd6cb Third step transitioning to Rust 2018. 2018-12-16 12:17:21 -08:00
8deb1e87bb First step transitioning to Rust 2018. 2018-12-16 12:02:20 -08:00
c73db2edbe Fix/silence a bunch of clippy warnings in the main crate. 2018-12-15 23:26:12 -08:00
498c1ea8d9 Running latest rustfmt. No functional change. 2018-10-30 22:31:25 -07:00
c002514ddf Run latest rustfmt. No functional changes. 2018-08-09 00:43:21 -07:00
6d21a30840 Formatting with newer cargo fmt.
No meaningful code change, only formatting.
2018-06-24 21:18:10 -07:00
c990672dfe Fix compiler warnings. 2018-03-04 13:06:22 -08:00
97d3304149 Run new rustfmt on codebase. 2018-03-04 13:00:55 -08:00
461b3c377e Improved light tree sampling and changed surface closure API.
Thanks to a discovery by Petra Gospodnetic during her GSOC
project, I was able to substantially improve light tree sampling
for lambert surfaces.  As part of this, the part of the surface
closure API relevant to light tree sampling has been adjusted to
be more flexible.

These improvements do not yet affect GTR surface light tree
sampling.
2017-08-23 19:09:26 -07:00
0481d931b9 Surface closures and light sampling now take both shading and geometric normals.
This will allow them to appropriately handle weirdness that comes
from the shading normal and geometric normal being different.
2017-07-30 19:17:32 -07:00
c0a26819c6 Bunch of code quality improvements based on running clippy.
None of them change behavior, just make the code cleaner.
2017-07-22 17:21:11 -07:00
5d0e77f5db Improved SAH split code for light tree.
The SAH split would happily repeatedly split on the same axis
as long as the surface area was reduced as much as splitting
on the other axes.  This resulted in sliver-like bounding boxes
for some scenes, which is terrible for the light tree.

The SAH splitting code now accounts for the diagonal of the
bounding box, favoring smaller ones.  This seems to work well,
fixing the issue without introducing any apparent performance
regressions.
2017-07-12 23:49:12 -07:00
f371e0643a Instrument code to count ray/node tests during BVH traversal. 2017-07-06 22:17:36 -07:00
09daf617ef Implemented a non-SIMD BVH4. Perf appears to be identical to BVH. 2017-07-01 15:08:05 -07:00
554f73eacb Tighter memory layout for LightTree. 2017-06-29 21:11:00 -07:00
e48bff3011 Finished light tree arity configurability.
Turns out going higher arity makes a huge positive difference
is sampling quality.  Currently have 32-arity set as the default,
as it seems to be worth it for the better sampling.
2017-06-29 02:28:30 -07:00
47c2bf4ed9 Almost have configurable arity for light tree building.
Just need to fill in a couple of functions with non-temp code.
2017-06-29 00:29:23 -07:00
b891cc943b Light tree can now be traversed with arbitrary arity.
Next up is building with configurable arity.
2017-06-28 23:20:03 -07:00
27c635982e Adjusting light tree implementation in prep for configurable arity. 2017-06-28 22:51:20 -07:00
927a86c1fc Update LightArray to work with current code.
It's useful for checking correctness.
2017-06-20 23:28:49 -07:00
f649bec585 Reformat code with rustfmt 0.9 2017-06-15 22:00:31 -07:00
922e33ec3f Reformat code with latest rustfmt and custom config. 2017-05-14 13:43:51 -07:00
172e2f19ef Removed BVH4 and the related bitstack from AccelRay.
I couldn't make the BVH4 faster than the BVH, and the bitstack
was bloating the AccelRay struct.  Removing the bitstack gives
a small but noticable speedup in rendering.
2017-05-12 21:07:40 -07:00
b698a52f6c Split some more things out into sub-crates.
Also translated the Halton generator to rust and made it a crate
where the code is generated by a build.rs file.
2017-05-11 22:57:59 -07:00
dcf25b92af Fiddled with BVHNode to make it 32 bytes instead of 40 bytes.
This helps reduce the total size of BVHs since both BBoxes and
and BVHNodes are now 32 bytes and can be properly packed together.
2017-05-08 19:47:10 -07:00
d8e31750a8 Small optimization in BVH traversal. 2017-04-26 01:03:16 -07:00
c92a8c4da0 During BVH construction, merge BBox time samples based on a threshold.
If the average surface area of all the time samples is close enough
to the surface area of their union, just take the union and use that.
This both makes the BVH smaller in memory (time samples don't
propigate up the tree beyond their usefulness) and makes it
faster since traversal can avoid interpolating BBoxes when there's
only one BBox for a node.
2017-04-23 23:15:31 -07:00
b135e8beb8 Fixed bug in new BVH4 traversal code. 2017-04-22 22:32:36 -07:00
a940630a27 Reduced max bvh tree depth.
Reduced from 64 to 42.  This still allows each BVH to hold 4.4
trillion elements, but it guarantees that the accel ray's
traversal bitstack can accommodate at least two nested max-depth
trees.
2017-04-22 12:51:35 -07:00
fdf2b4babf Print stats for BVH and BVH4 traversal, and working on speeding up BVH4 traversal. 2017-04-22 11:18:29 -07:00
725bbca6a1 Eliminated some unnecessary left drift in BVH4 code.
IMO this is much easier to read.
2017-04-16 17:27:29 -07:00
92fd83a766 Actually using the None match arm in BVH4 traversal now.
It seems to maybe be just a hair faster.  But, also, it sets the
code up to try some more optimizations.
2017-04-16 17:22:51 -07:00
2c4f103db5 Factored some calculations into the outer loop of BVH4 traversal.
Provides a small but noticable speed boost.
2017-04-16 00:51:13 -07:00
a6d8de43d7 Make BVH4 calculate and store its node count.
Useful for debugging.
2017-04-14 22:14:52 -07:00
44e3ee8b4b Fixed nasty bug in BVH4 building.
In practice it worked fine, but only by accident.  NaN's were
being passed to the lerp_slice function, which led to the
correct result in this case but is icky and dependant
on how lerp_slice is implemented.
2017-04-14 20:25:12 -07:00
7f761a9489 Added custom aligned allocations to MemArena.
Used in BVH4.
2017-04-13 23:06:56 -07:00
8b1e3a3cdb Added some dev printing info. 2017-04-13 22:50:47 -07:00
573c5da5ab Got BVH4 working. Woo hoo! 2017-04-13 22:44:34 -07:00
53a14996c9 Completed first attempt at implementing BVH4.
Completely untested, so almost certainly non-functional.  But it
compiles!
2017-04-12 23:33:34 -07:00
e0c6dfbd76 Beginnings of BVH4 implementation.
- Created a traversal-order table.
- Created a function to help index into that table.
2017-04-11 23:10:54 -07:00
a2d7f9e149 Added BBox4 and BVH4 types.
BVH4 is just a skeleton (duplicated BVH) right now.  But BBox4
is complete (pending testing).
2017-04-11 14:22:11 -07:00
d9564bc005 Refactor and rework of BVH.
The BVH building code is now largely split out into a separate
type, BVHBase.  The intent is that this will also be used by
the BVH4 when I get around to it.

The BVH itself now uses references instead of indexes, allocating
and pointing directly into the MemArena.  This allows the nodes
to all be right next to their bounding boxes in memory.
2017-04-10 23:41:38 -07:00
6623443e2e Improved .psy file parsing error messages.
Biggest improvement: it gives you line numbers.  But also progress
on better descriptions.
2017-04-10 14:03:01 -07:00
d3b3a50a4d LightTree and Assemblies use MemArena now. 2017-04-10 00:03:49 -07:00