Commit Graph

48 Commits

Author SHA1 Message Date
Matthew Gordon 80b2d87d22 Minor changes suggested by clippy 2025-03-28 22:14:10 -03:00
Matthew Gordon 773ca99ac1 Very inefficient first-pass at global illumination 2020-09-09 20:39:32 -04:00
Matthew Gordon 2f1285c526 Add Spectrum::reflection_from_linear_rgb() 2020-09-07 22:48:57 -04:00
Matthew Gordon 2494a30aef Cast rays for single light wavelengths instead of RGB values
Colours are wrong because Spectrum class isn't implemented.

Also there's a lot of other cleanup that needs to be done.
2020-09-05 22:45:43 -04:00
Matthew Gordon eccb444721 Make ToneMapper generic over it's input type 2020-09-01 23:33:32 -04:00
Matthew Gordon ef0fb96f9d Use Array2D for storage in ImageRgbU8 2020-09-01 22:26:50 -04:00
Matthew Gordon f5b0a35635 Replace nalgebra matrix and vector classes with own classes
Nalgebra only used to find matrix inverse now.
2020-08-28 23:08:44 -04:00
Matthew Gordon 99cf127c9f Change a bunch of generics that used with RealType to just use f64 2020-08-18 23:12:28 -04:00
Matthew Gordon 5c2fbf995a Made some minor improvements suggested by clippy 2020-08-15 00:06:06 -04:00
Matthew Gordon 699c308782 Rewrite BoundingVolumeHierarchy
New BVH has much cleaner design and is also using a much better
heuristic for dividing the scene.

Massive speedup (~28x!), presumable from having a heuristic that
actually works. This is still a simple heuristic (sort by
bounding box centres along largest dimension, and then divide into
equal halves) which can definitely be improved.
2020-08-11 23:59:03 -04:00
Matthew Gordon 4933993187 Use bunny model in test scene again 2020-07-20 21:22:54 -04:00
Matthew Gordon ea311408ba Add time parameter to allow animation 2020-06-20 19:28:40 -04:00
Matthew Gordon d96942cd78 Replace bunny with dodecahedron on test image 2020-06-20 14:57:56 -04:00
Matthew Gordon 4451d1d71f Add option to save image to PNG file 2020-06-20 14:53:17 -04:00
Matthew Gordon b8dddd7498 Pass image size as command line parameter
Instead of being hard-coded
2020-06-20 12:04:44 -04:00
Matthew Gordon 90bb7d84af Big rijiggering of types 2020-06-11 22:13:51 -04:00
Matthew Gordon 63afdfa36e Make the camera module private and just re-export partial_render_scene() 2020-04-23 23:16:50 -04:00
Matthew Gordon 36a4c6f951 Add "stanford bunny" model to repository (for testing) 2020-04-03 21:18:16 -04:00
Matthew Gordon bbeb39ba5d Replace unnecessary Arcs with Boxes. 2020-03-27 20:34:19 -04:00
Matthew Gordon ad2b9247b8 Use BoundingVolumeHierarchy to accelerate rendering 2020-02-28 23:26:56 -05:00
Matthew Gordon 0574dff685 Threads pass back small images instead of sharing large image 2020-02-28 21:42:19 -05:00
Matthew Gordon a04f51998c Make main rendering loop multithreaded again. 2020-02-28 20:53:24 -05:00
Matthew Gordon bdd05f3527 Refactor main rendering loop to use TileIterator
This removes the old multithreading code, but will be using rayon
soon.
2020-02-20 16:47:15 -05:00
Matthew Gordon 8c527d34fc Add Primitive trait 2020-01-30 17:22:53 -05:00
Matthew Gordon 12e26887c1 Make output image smaller. 2019-12-21 10:43:39 -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 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 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 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 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 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 cefbc2873b Refactor, adding Material trait that returns a BSDF 2019-11-23 20:53:45 -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 99c79ea31b Remove some busywork needlessly redrawing window. 2019-11-12 16:51:08 -05:00
Matthew Gordon 1eb3741b7d Render a basic scene 2019-11-12 08:03:29 -05:00
Matthew Gordon c059aebe11 Move OutputImage into it's own module 2019-11-08 07:52:38 -05: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