Commit Graph

112 Commits

Author SHA1 Message Date
f649bec585 Reformat code with rustfmt 0.9 2017-06-15 22:00:31 -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
71c320d87c Added command-line argument to render an image cropped. 2017-06-06 21:11:35 -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
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
322627641a Broke render job out into its own method.
The left-drift of having it inline was getting cumbersome.
2017-05-14 14:51:55 -07:00
922e33ec3f Reformat code with latest rustfmt and custom config. 2017-05-14 13:43:51 -07:00
993ba719d7 Fixed bug that was causing spurious NaN pixels.
It was because sometimes the PDF's for a sample could be zero,
leading to a divide by zero.  PDF = 0.0 is now checked for.
2017-05-14 12:45:43 -07:00
567b658b6c Removed blue noise dithered sampling. 2017-05-14 12:37:01 -07:00
d71fd3b5c8 Implemented blue noise dithered sampling. Temporary.
After implementation, it does appear to make rendering slower
by a noticable bit compared to what I was doing before.  At very
low sampling rates it does provide a bit of visual improvement,
but by the time you get to even just 16 samples per pixel its
benefits seem to disappear.

Due to the slow down and the minimal gains, I'll be removing
this in the next commit.  But I want to commit it so I don't
lose the code, since it was an interesting experiment with
some promising results.
2017-05-14 12:25:01 -07:00
04e8a6ca73 Added a Rust port of Leonhard Grünschloß's Sobol sampler.
The Halton sampler appears to be better, but it was fun to add
this anyway!
2017-05-11 23:56:12 -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
96db00b10a Refactored some parts of Renderer to take up less memory and be faster.
Specifically, LightPath is now significantly smaller, and
resultingly faster to process.

Also finally fixed the bug where without light sources the light
from the sky wouldn't affect surfaces.
2017-05-11 20:23:19 -07:00
a3a19e53ef Some misc small optimizations. 2017-05-11 01:22:37 -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
8b14e46bc1 Added more detailed render stats. 2017-04-22 10:31:27 -07:00
0296fd2d34 Fixed a bunch of problems that came up when running debug build.
The worst offender was an obvious and nasty bug in the bitstack
implementation.  Hooray for debug asserts!
2017-04-14 21:37:29 -07:00
57aa9be496 First steps towards using the memory arena allocator.
Changed Camera to us the memory arena allocator, and worked out a
bunch of stuff through doing that.
2017-04-09 17:31:17 -07:00
4a86c4122a Laying some groundwork for a simple shading system. 2017-03-14 00:27:25 -07:00
f4445417dc Reorganizing the module tree.
Enough things had accumulated that it seemed to make sense to
group some stuff together.  So here it is.
2017-02-14 00:14:08 -08:00
d504ca5e6a Got DistantDiscLights working! Yay!
This involved fixing a bug in PsychoBlend.  It was including
translation in how it was transforming the sun lights' direction
vector.
2017-02-13 00:03:34 -08:00
3cbb816d4b Added DistantDiskLight (a.k.a. sun light) parsing and data structures.
Also created a proper World struct in the process, to store all
infinite-extent type stuff.

Note that I goofed and did a new rustfmt pass but forgot to
commit before making these changes, so there's a lot of
formatting changes in this too.  *sigh*
2017-02-12 20:29:08 -08:00
0e8d708ff0 Made samples per bucket configurable. 2016-10-16 14:55:00 -07:00
c71b00ca31 LightTree now works with lights in hierarchical instancing. 2016-08-21 00:19:43 -07:00
97b5ef77f8 Code cosmetics: organize and alphabetize crate/mod/use statements. 2016-08-20 18:10:55 -07:00
c997c55739 Separate timing of rendering and image writing in print out. 2016-08-20 16:25:12 -07:00
cf49cdbb02 Moved int hash functions into own file, and use in quick_select(). 2016-08-14 16:03:17 -07:00
08576b9934 Cleaned up console output. 2016-07-31 12:27:06 -07:00
ec75f11206 Render buckets in hilbert curve order.
Provides a slight speed-up.
2016-07-16 14:53:03 -07:00
5bc97f69b8 Actually use the background color from the scene file. 2016-07-16 13:54:41 -07:00
8cd445813a Removed some dead code. 2016-07-16 13:36:34 -07:00
c2eb421fd8 Actually use seed in renders.
This is important for animations, where you don't want the same
noise pattern every frame.
2016-07-10 17:56:42 -07:00
e4f9a54e48 Leave console output on a newline. 2016-07-10 17:47:28 -07:00
5b461220a5 PsychoBlend now exports meshes as meshes, and Psychopath renders to PNGs. 2016-07-10 17:42:28 -07:00
e8ee371423 Silence some warnings. 2016-07-10 16:46:14 -07:00
da46878243 Print render progress and auto-determine bucket size.
The bucket size is automatically determined based on a target
number of samples per bucket.
2016-07-10 16:40:30 -07:00
5df583c2d0 Multiple light sources are now handled. 2016-07-10 00:10:49 -07:00
0880a0f19d Make renderer actually use the material system properly.
The intersection code still isn't using any kind of shading,
and materials aren't parsed by the parser, but the renderer
class itself is using them.
2016-07-07 19:51:19 -07:00
543f2719e4 Fixed bugs in global illumination.
It was a stupid thing in the Lambert closure.  It was returning
the wrong direction vector.
2016-07-04 11:54:46 -07:00
e56ac418da Beginnings of global illumination.
There are still some obvious bugs in it that I haven't tracked down,
so the renders aren't correct yet.
2016-07-03 01:18:50 -07:00
6e8f0894fd Image struct can now dole out buckets in a thread-safe way.
This avoids the whole-image locking that was being done before,
which was causing a lot of thread contention.
2016-07-02 16:27:19 -07:00
02a0740cac More proper use of light sources. 2016-07-01 00:00:38 -07:00
f927dd0d46 Silencing a bunch of compiler warnings. 2016-06-29 15:23:07 -07:00
f1df7a3b1a Slight tweak to how ray offsets are done. 2016-06-29 15:00:44 -07:00
52acee33af Implemented rectangular area lights.
Also added Cornell Box test scene.
2016-06-29 14:30:42 -07:00
fd195576d1 First renders with lighting. Yay!
The lighting is super crappy, and pretty much hacked in.  Will
need to redo this properly soon.  However, this verifies that
certain other parts of the code are (mostly) working properly.
2016-06-27 23:16:39 -07:00
6f6807009b Prepping for adding lighting.
The part of the renderer responsible for light transport has been
split out into a LightPath struct.  Also moving over to spectral
rendering, although it's a bit silly at the moment.
2016-06-26 23:08:24 -07:00
d14e2c93b7 Converted Image over to store renders in XYZ colorspace. 2016-06-18 18:08:35 -07:00
18245b725c All final intersections are now done in world space.
BVH traversal still happens in local space, but final actual
surface intersection calculations are done in world space by
transforming the triangle into world space.  This is to improve
numerical consistency between intersections.
2016-06-09 01:04:12 -07:00
5ec1f534cf Implemented bucketed rendering. 2016-06-05 01:27:55 -07:00
a681ba461e Implemented basic multi-threaded rendering.
It's a bit inefficient because a thread is spawned for each pixel.
Need to implement bucketing.
2016-06-03 21:03:04 -07:00
039943e0cb Auto-formatting code with new version of rustfmt. 2016-06-02 22:43:35 -07:00
56b5267b7a Fixed incorrect rendering angle.
The problem was in how the camera rays were generated.
2016-05-28 13:05:16 -07:00
99dc371a75 Beginnings of a mesh parser. Also cleaned up some unused imports. 2016-05-25 08:16:05 -07:00
f6891173eb Moved ray tracing responsibilities to the Tracer.
This is still pretty WIP, but it at least gets the functionality
back to where it was before.
2016-03-13 13:01:10 -07:00
e96798ab6b Lazily committing a bunch of stuff.
Includes:
- More scene parsing code.  Making good progress!
- Making the rendering code actually use the Scene and Assembly
  types.
- Bare beginnings of a Tracer type.
2016-03-12 00:33:11 -08:00
38d33ed144 More work on scene parsing.
Using Nom to help with parsing the contents of leaf nodes.
2016-03-10 23:58:19 -08:00
907d15f643 Started creating an interface for surfaces.
Testing it out by making a bogus TriangleMesh surface type.
2016-01-03 00:09:23 -08:00
d7f6142749 Image output now does proper sRGB correction. 2016-01-02 23:21:42 -08:00
a14a93f5a1 BVH now no longer directly references the objects it indexes.
Everything is done with indices anyway, so there was no reason
for it to store an internal reference to the object data.  This
gets rid of the type parameter and lifetime parameter on the BVH
struct itself, which will also make it easier to bundle it with
the data it indexes, which will be important later on.
2016-01-02 22:55:20 -08:00
470618fa6a Created a Renderer type to be in charge of rendering. 2016-01-02 22:34:36 -08:00