Matthew Gordon
d6b5c87759
Create Real trait to replace nalgebra::RealField
...
Real inherits RealField, but I want to add more to it.
2020-02-10 16:52:09 -05:00
Matthew Gordon
a15eeccdfb
Fix code formatting. No change of functionality.
2020-02-07 17:05:07 -05:00
Matthew Gordon
23e8a878c5
Move algebra_utils.rs into util module
2020-02-07 17:04:42 -05:00
Matthew Gordon
49bef6f0f4
Add Point3Normalizer
2020-02-07 17:00:46 -05:00
Matthew Gordon
259505e93f
Add RealFieldNormalizer
2020-02-06 17:36:36 -05:00
Matthew Gordon
c3f3fffc0e
Move axis_aligned_bounding_box to util module
2020-02-06 17:06:46 -05:00
Matthew Gordon
65b5e3c45d
Create util module and move Interval struct to it
2020-02-06 16:49:11 -05:00
Matthew Gordon
8c527d34fc
Add Primitive trait
2020-01-30 17:22:53 -05:00
Matthew Gordon
a0de9c18ba
Implement HasBoundingBox trait for Plane
2020-01-30 16:43:48 -05:00
Matthew Gordon
89aed89b85
Add derive(Debug) for BoundingBox
2020-01-30 16:43:21 -05:00
Matthew Gordon
1044fc3986
Implement HasBoundingBox for Tirangle
2020-01-29 16:50:26 -05:00
Matthew Gordon
e67204b96e
Make BoundingBox::from_points accept any IntoIterator<Point3<T>>
...
...instead of only Vec<Point3<T>>
2020-01-29 16:49:30 -05:00
Matthew Gordon
e5d7a1098d
Add more methods for constructing BoundingBoxes
2020-01-29 08:09:58 -05:00
Matthew Gordon
30a5a9dd0f
Add Interval::expand_to_value(); other minor changes
2020-01-12 12:13:31 -05:00
Matthew Gordon
25ac0bad7f
Fixed bug with empty intervals
2020-01-12 10:45:39 -05:00
Matthew Gordon
75611d47d3
Add HasBoundingBox trait with implementation for Sphere
2020-01-10 17:15:35 -05:00
Matthew Gordon
abf71658b6
Add axis_aligned_bounding_box::BoundingBox::union()
2020-01-10 17:00:09 -05:00
Matthew Gordon
da2208f3f8
Add Interval::union()
2020-01-10 16:46:17 -05:00
Matthew Gordon
5f6733fdb0
Move some declarations around within struct, no change in functionality
2020-01-10 16:21:38 -05:00
Matthew Gordon
ffcfa0009c
Move import that was only used in tests into test module
2020-01-10 16:21:28 -05:00
Matthew Gordon
5e0e2bad06
Make build and test work with stable rust (nightly needed for benchmarks)
2020-01-10 16:16:27 -05:00
Matthew Gordon
4ee7338711
Add axis_aligned_bounding_box module
2019-12-31 22:17:15 -05:00
Matthew Gordon
5c8903107a
Add IntersectP trait
...
Like Intersect, but the intersect() function only returns a bool,
not a Optional<IntersectionInfo>.
2019-12-31 22:16:06 -05:00
Matthew Gordon
6639ed813b
Remove some old code that was already commented out
2019-12-31 22:15:13 -05:00
Matthew Gordon
a785eb796f
Only enable benchmark when benchmarking, not as regular test
2019-12-31 22:14:24 -05:00
Matthew Gordon
1653174ef6
Make triangle a submodule of raycasting.
2019-12-21 15:29:52 -05:00
Matthew Gordon
c35735f117
Move Plane into it's own submodule
2019-12-21 15:19:16 -05:00
Matthew Gordon
91579745cb
Move Sphere to a submodule
2019-12-21 15:06:48 -05:00
Matthew Gordon
4e7565638a
Move raycsating module into subdirectory
2019-12-21 10:50:59 -05:00
Matthew Gordon
08484306fd
Move load_obj() into submudule
2019-12-21 10:43:39 -05:00
Matthew Gordon
12e26887c1
Make output image smaller.
2019-12-21 10:43:39 -05:00
Matthew Gordon
1b9cf2cbca
Add benchmark
2019-12-21 10:43:33 -05:00
Matthew Gordon
7cdcdb145a
Remove unused function.
2019-12-21 10:08:00 -05:00
Matthew Gordon
e1de889d3a
Quick-and-dirty multithreading
...
Not the best multithreading scheme and needs error handling, but
it works.
2019-12-21 10:07:53 -05:00
Matthew Gordon
3618636c42
First quick pass at loading OBJ files.
2019-12-21 09:11:30 -05:00
Matthew Gordon
199b33f944
Remove unused function
2019-12-12 13:01:02 -05:00
Matthew Gordon
777580be17
Fix triangle intersection passing when triangle is behind ray
2019-12-12 08:57:46 -05:00
Matthew Gordon
9096ff67b6
Remove some debug prints that I committed by accident
2019-12-12 08:56:31 -05:00
Matthew Gordon
365b6063e0
Tweak test scene
2019-12-12 08:45:15 -05:00
Matthew Gordon
c05eba391b
Add more tests for triangle intersection and fix a couple of bugs
...
Still not working properly.
2019-12-12 07:51:26 -05:00
Matthew Gordon
9eca3a4cfe
Replace Vector3 with Point3 where appropriate
2019-12-07 11:09:07 -05:00
Matthew Gordon
a7e1f1c134
Add type alias for the return type of Material::bsdf()
2019-12-07 10:58:04 -05:00
Matthew Gordon
52da1bc952
Clean up a long if-else sequence. No change in functionality.
2019-12-07 10:58:04 -05:00
Matthew Gordon
c0d0f81335
Replace ClampingToneMapper::new() with derive(Default)
2019-12-07 10:58:04 -05:00
Matthew Gordon
d98144ab74
Minor cleanup and tidying; no change in functionality.
2019-12-07 10:58:04 -05:00
Matthew Gordon
2b3d350fbb
Add intersection test for triangle; not quite working yet though
2019-12-07 09:28:11 -05:00
Matthew Gordon
6f1663f616
Fix issue with noise in refrections
...
The BSDF for Reflective material had rounding issues that would
sometimes make the reflection strength NaN.
2019-11-30 11:26:18 -05:00
Matthew Gordon
d19d5200b0
Add another light to test scene, to fill shadows in a little
2019-11-29 22:30:31 -05:00
Matthew Gordon
8b0b8c59ba
Add ReflectiveMaterial material type
...
Although there's still some issues with rendering the reflections.
2019-11-29 22:30:08 -05:00
Matthew Gordon
5cd80ae05c
Add sample funtion to Material trait, with default implementation
2019-11-29 22:27:43 -05:00
Matthew Gordon
dcee4fb716
Add missing normalization of tangent vectors
...
This was required to get reflection working but also fixes
issues with the PhongMaterial parameters.
2019-11-29 22:25:50 -05:00
Matthew Gordon
dbbd855c73
Add Phong material
2019-11-27 17:05:51 -05:00
Matthew Gordon
0a7963097c
Add (co)tangent to IntersectionInfo and redid sphere intersection
2019-11-27 17:02:23 -05:00
Matthew Gordon
015625ff20
Add utility function to create change-of-basis matrices
2019-11-27 17:00:44 -05:00
Matthew Gordon
e7bcc9cc62
Add diffuse strength term to LambertianMaterial
2019-11-26 07:17:27 -05:00
Matthew Gordon
430053c134
Fix bug rendering images with dimensinos not multiples of tile size
2019-11-26 07:03:45 -05:00
Matthew Gordon
d9912c42dd
Fix bug where non-square images would not be completely rendered
2019-11-26 06:59:26 -05:00
Matthew Gordon
86ef364ed2
Render image a tile at a time, so user can see progress
2019-11-25 09:04:20 -05:00
Matthew Gordon
20d3e9ba8d
Add some more objects to the test scene
2019-11-25 08:34:04 -05:00
Matthew Gordon
5a0646aaa2
Bias shadow rays to fix noise in image
2019-11-23 22:08:50 -05:00
Matthew Gordon
77cf877210
Factor out Sampler struct and add shadow casting
...
There are now bad rendering artifacts which I believe are caused
by precision issues.
2019-11-23 21:36:59 -05:00
Matthew Gordon
cefbc2873b
Refactor, adding Material trait that returns a BSDF
2019-11-23 20:53:45 -05:00
Matthew Gordon
9b8eea6f20
Implement Add, Mul, Copy, Clone and Debug for ColourRgbF
2019-11-23 20:50:31 -05:00
Matthew Gordon
f58afb2ded
Apply tone mapping to image, not colours
...
Apply tone mapping and conversion from floats to bytes only on
final image. This will allow better tone mapping operators later
and for now removes NormalizedAsFloat trait constraints that were
creeping through everything.
2019-11-19 21:32:47 -05:00
Matthew Gordon
f13b585bfe
Shapes can now be colours other than gray
2019-11-19 07:43:00 -05:00
Matthew Gordon
f193fbf84b
Added some named colours, mostly to make testing easier.
2019-11-17 20:26:57 -05:00
Matthew Gordon
ad7d0b5f17
Started materials module.
2019-11-17 20:26:39 -05:00
Matthew Gordon
86e0b04a46
Add some code for dealing with colours.
2019-11-15 09:02:00 -05:00
Matthew Gordon
f4bbe75cf8
Sort modules in lib.rs. No change in functionality.
2019-11-14 07:16:11 -05:00
Matthew Gordon
98373a1935
Add missing file that should have been in earlier commit
2019-11-13 17:48:34 -05:00
Matthew Gordon
d2fb84191e
Add retro (towards camera) direction to IntersectionInfo
...
Not tested or used yet.
2019-11-13 17:47:40 -05:00
Matthew Gordon
c144780fce
Fix failed intersection when ray origin is insode sphere
...
Added unit test which detected a false miss when the sphere centre
is behind the ray origin but the ray origin is inside the sphere.
2019-11-13 17:45:33 -05:00
Matthew Gordon
3c24a084b9
Add another ray-sphere intersection unit test
2019-11-13 17:28:43 -05:00
Matthew Gordon
700de75337
Reworked ray-sphere intersection which was failing tests
2019-11-13 17:25:57 -05:00
Matthew Gordon
d9af6dad94
Added Phong integrator (actually only computing lambertion yet)
2019-11-12 22:11:06 -05:00
Matthew Gordon
4f60719523
Correctly render multiple objects instead of just rendeing one
2019-11-12 17:25:10 -05:00
Matthew Gordon
99c79ea31b
Remove some busywork needlessly redrawing window.
2019-11-12 16:51:08 -05:00
Matthew Gordon
9d47821062
Change memory layout of Image, so it's not drawn upside-down by SDL
2019-11-12 16:47:56 -05:00
Matthew Gordon
2ec0c133a8
Fixed an unused variable warning
2019-11-12 16:47:29 -05:00
Matthew Gordon
95631d3708
Fixed some unused imports warnings
2019-11-12 16:46:58 -05:00
Matthew Gordon
1eb3741b7d
Render a basic scene
2019-11-12 08:03:29 -05:00
Matthew Gordon
e9900af986
Some cleanup and added unit test for pixel ray generation
2019-11-12 07:31:02 -05:00
Matthew Gordon
041c940931
Add Plane struct
2019-11-11 22:18:49 -05:00
Matthew Gordon
10c8992cf4
Fix bug where camera would iterate past bottom of image.
2019-11-11 16:48:40 -05:00
Matthew Gordon
326caf151a
Start camera module
2019-11-11 12:11:10 -05:00
Matthew Gordon
c059aebe11
Move OutputImage into it's own module
2019-11-08 07:52:38 -05:00
Matthew Gordon
eaf9ba7b2f
Create raycasting module
2019-11-08 07:38:24 -05:00
Matthew Gordon
192857eead
Add Sphere struct, Intersect trait, and sphere-ray intersection
2019-11-08 07:25:15 -05:00
Matthew Gordon
78ea2b2e64
Add another unit test for Ray struct
2019-11-08 07:24:50 -05:00
Matthew Gordon
3244181a08
Add some missing "pub" qualifiers
2019-11-08 07:23:01 -05:00
Matthew Gordon
76a7299fb9
Add more unit tests for Ray
2019-11-06 17:32:47 -05:00
Matthew Gordon
9ebfae5898
Add Ray constructor that ensures direction vector is normalized
2019-11-06 17:32:02 -05:00
Matthew Gordon
ff046808da
Throw out my own vector functions and add Ray type with nalgebra
2019-11-06 12:56:43 -05:00
Matthew Gordon
5a44984779
Add Point2D and Point3D
2019-10-24 21:08:58 -04:00
Matthew Gordon
7bc7b3520a
Implement Mul for f64 * Vector3D
2019-10-24 21:00:34 -04:00
Matthew Gordon
423be7700d
Implement Mul for Vector3D * scalar
2019-10-24 20:56:52 -04:00
Matthew Gordon
14bae21b80
Implement Mul for f64 * Vector2D
2019-10-24 20:51:51 -04:00
Matthew Gordon
0cb1157df0
Implement Mul for Vector2D * scalar
2019-10-24 20:42:58 -04:00
Matthew Gordon
7e5c9d5231
Add Sub trait for Vector2D; add Vector3D with Add and Sub traits.
2019-10-24 20:32:46 -04:00
Matthew Gordon
daee8af0ea
Start adding vector types
2019-10-23 22:21:32 -04:00
Matthew Gordon
c81eec9174
Did some refactoring and improved error handling
2019-10-23 21:05:17 -04:00
Matthew Gordon
bc4759dfaa
Set up SDL so I can draw the image being rendered in a window
2019-10-21 01:40:58 -04:00