Commit Graph

252 Commits

Author SHA1 Message Date
05578a1240 Implemented smooth-shaded triangle meshes.
There are still some things to do to avoid light leakage and
other weird shading in some situations, but the basics are working!
2017-07-30 17:55:03 -07:00
e77d5b7576 Refactored triangle meshes in preparation for custom normals. 2017-07-30 16:56:28 -07:00
c75c154e46 Updated todo list. 2017-07-30 13:25:21 -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
3cb684514a Added some additional fast math functions. 2017-07-22 13:34:38 -07:00
1bb02f6604 Fix copy paste error in readme. 2017-07-20 16:49:59 -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
2dcba3aca4 Speed up ray/mesh intersection for cases with no transform motion blur. 2017-07-12 01:32:44 -07:00
972c2a90a7 Further work on accurate ray/triangle intersections.
The previous commit dealt with triangles self-shadowing.  This
commit deals with avoiding intersections with _other_ objects
very near a triangle ending up being erroneously shadowed by
it.
2017-07-10 23:37:50 -07:00
b315be0913 Fixed self-intersection bug for coordinates near zero.
This turned out to be a rather interesting one.  The water-tight
ray/triangle intersection algorithm, while very accurate for
finding if there is an intersection with a line segment, is
not as remarkably accurate for determining if that intersection
is within the interval of the ray.

This is because of the coordinate transformation it does
depending on ray direction: for triangles laying flat on one of
the axis planes near zero, that near-zero coordinate can get
transformed to a much less accurate space for testing.  In fact,
generally speaking, beause of the coordinate transform, you can
only rely on the test being as accurate as the least accurate
axis.

The ray-origin offset code was doing offsets based on the
assumption that the error on the major axes are independent, but
as this triangle intersection algorithm shows, you can't actually
depend on that being the case.  So rather than handling triangle
intersection as a special case, I've changed the intersection
position error to be a single float, representing the maximum
possible error on any axis.  This should be robust for any
geometry type added in the future, and also solves the immediate
issue in a correct way.
2017-07-10 00:52:28 -07:00
a1840ec408 Cleaned up implementation of ray/triangle intersection test. 2017-07-10 00:39:09 -07:00
f371e0643a Instrument code to count ray/node tests during BVH traversal. 2017-07-06 22:17:36 -07:00
649a6a0869 Rearrnging the operations in ray/bbox test for slight perf improvement.
The difference is extremely small, but consistent.  I'm guessing
due to better pipelining of instructions.
2017-07-06 22:10:37 -07:00
09daf617ef Implemented a non-SIMD BVH4. Perf appears to be identical to BVH. 2017-07-01 15:08:05 -07:00
a4a73713d2 Created crate for BVH node traversal order calculations.
Might move this into the main source base at some point, but
I'm not totally sure about the correctness of the table yet, so
would like to generate it for now.
2017-07-01 12:44:19 -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
4e9bfd6e79 Fix for ray origin offsets when intersection point is at 0.0.
For some reason the ulp incrementing is unreliable when starting
at zero.  It creates subnormal numbers, and that seems to be an
issue somewhere in the pipeline, ultimately leading to weird
render artifacts.  Not entirely sure why.

This fixes it by avoiding subnormal numbers in the final offset
ray origin.  Left a note suggesting investigating in more detail
at some point.
2017-06-21 01:36:08 -07:00
927a86c1fc Update LightArray to work with current code.
It's useful for checking correctness.
2017-06-20 23:28:49 -07:00
011405e131 Implemented robust ray origin calculation for bounced rays.
We take a small performance hit for this, but given that it's
making things meaningfully more correct I feel like it's more
than worth it.
2017-06-19 22:28:44 -07:00
71bdf203aa Fixed bug in mesh intersection code.
Very small triangles were being missed because of the
not-so-robust ray-triangle intersection algorithm I was using.

Switched to the algorithm from the paper "Watertight
Ray/Triangle Intersection" by Woop et al.  Happily, the new
algorithm doesn't seem to measurably slow down renders at all.
2017-06-18 20:51:53 -07:00
2c0e57341c XYZ color curve functions need more accurate exp function. 2017-06-15 22:50:27 -07:00
b5f2237676 Reformatted sub-crates with new rustfmt as well. 2017-06-15 22:21:25 -07:00
f649bec585 Reformat code with rustfmt 0.9 2017-06-15 22:00:31 -07:00
46247ec9aa Added a 'Contributing' section to the readme. 2017-06-14 19:19:02 -07:00
abc59c20ae Merge pull request #1 from GuillaumeGomez/improvement
Improve messages for image creation
2017-06-14 18:58:50 -07:00
Guillaume Gomez
ae11be1397 Improve messages for imge creation 2017-06-14 10:46:28 +02:00
851989f6a6 Added a license and licensing notes.
Also replaced some code I'm not sure where it came from or what
the license was.
2017-06-11 21:29:51 -07:00
58539520cf Fix some readme typos and improve phrasing. 2017-06-11 16:15:00 -07:00
2f91600182 Prepping repo with a readme before making repo public. 2017-06-11 16:07:12 -07:00
b8321beaad Split colorspace transform functions out into their own crate.
They are now generated by a build.rs script from nothing but the
colorspace's primaries, which makes it super easy to add more
colorspaces.  So easy that I added three more: ACES AP0, ACES AP1
and Rec.2020.

This lays the foundation for supporting output to different
colorspaces.
2017-06-11 03:03:23 -07:00
2a66485595 Supress information output when doing serialized ouput for PsychoBlend. 2017-06-10 22:34:14 -07:00
13ee6066b8 PsychoBlend: further preformance improvements, and minor fixes.
All scene data collection is now done in a single sweep of frame
changing.  Previous commits were already working towards this, and
but now it's done.  Yay!

Over-all, switching to this approach gives huge speed boosts on
large scenes with animation, rigs, dependencies, etc.  For such
scenes, frame changing is very expensive.
2017-06-10 16:11:28 -07:00
914a13f899 PsychoBlend: fixed silly copy/paste bug. 2017-06-10 01:58:20 -07:00
7236d2e666 PsychoBlend: fixed some bugs and made exporting even faster. 2017-06-10 01:38:33 -07:00
9025715335 Significant PsychoBlend improvements.
- Improved export time by quite a bit.
- Added more fine-grained status updates during export so it
  doesn't feel like it's hanging.
2017-06-09 23:57:18 -07:00
9d92bd099d PsychoBlend: rendering a cropped image using border feature now works. 2017-06-06 23:44:53 -07:00
71c320d87c Added command-line argument to render an image cropped. 2017-06-06 21:11:35 -07:00
59555f67f9 PsychoBlend: use stdin/out to transfer scene data by default.
This eliminates writing temp files to disk for any part of the
Blender/Psychopath integration.

The option to export to a file still exists, however, by
specifying an export output path.
2017-06-04 23:24:45 -07:00
a82c674308 PsychoBlend: remove unused output path. 2017-06-04 19:58:09 -07:00
ef5b573723 Some small export speed improvements in PsychoBlend. 2017-06-04 19:49:55 -07:00
a3332d4f6a Fixed a PsychoBlend bug that resulted in render not being fully displayed.
Getting the interplay between the reading the process output and
polling to see if it's finished is a tad tricky.  I think I got
it right this time.
2017-06-03 01:12:21 -07:00
f84d093f66 PsychoBlend now updates render in realtime within Blender.
Also, cancelling renders is much more responsive now, especially
during long exports.
2017-06-03 00:00:19 -07:00
3beffab507 Update to latest openexr-rs, and switch to pure Rust PNG output crate. 2017-05-28 17:51:01 -07:00
f0604a69ae Updated to latest openexr crate, and switched to 16-bit float EXR's. 2017-05-20 23:48:01 -07:00
4e2d3e64c0 Switched to using the openexr crate on crates.io. 2017-05-17 00:36:35 -07:00
edb71864e8 LDS sampling falls back on random sampling at higher dimensions.
This is more a piece-of-mind thing than anything else.  But it
also lets us make the number of LDS dimensions lower without
worrying, which in turn makes the code smaller.
2017-05-14 16:06:54 -07:00