Commit graph

207 commits

Author SHA1 Message Date
Antoine Martin 2c6e0b42d2 library: core: document light_properties module 2020-03-22 00:14:25 +01:00
Antoine Martin b71f0aee5a library: core: document film module 2020-03-22 00:14:25 +01:00
Antoine Martin 07dbad95b5 library: core: document color module 2020-03-22 00:14:25 +01:00
Antoine Martin db84708392 library: core: document camera module 2020-03-22 00:14:25 +01:00
Antoine Martin ffd40148a7 library: add missing_docs warning 2020-03-20 17:53:08 +01:00
Antoine Martin db3ba1b312 library: render: scene: use iterators for cast_ray 2020-03-20 00:47:25 +01:00
Bruno BELANYI 40c2ae1bc9 library: render: scene: more like-like refractions
The refractions are now implemented using the Fresnel equations to take
into account the amount of light that is reflected off of transparent
surfaces.

For example, this leads to a small amount of discoloring at the edges of
the ball in the example scene. Indeed, this ball has a refractive index
higher than diamond (!), so its edges reflect light much more than when
looking at it dead-center.
2020-03-19 19:12:40 +01:00
Bruno BELANYI 27ac0ffe9f examples: add triangles scene
This scene showcases a transparent sphere.
2020-03-19 18:27:07 +01:00
Bruno BELANYI 552c0cb966 library: implement refraction
This necessitated to rework how light properties for a material were
given. A material can have either reflectivity or transparency. This
changes the parsing of materials, using a `LightProperty` structure at
its core.

This is does not implement the true Fresnel equations to take into
account the amount of reflection that an incident goes through when
encountering a transparent object.
2020-03-19 18:23:20 +01:00
Bruno BELANYI e00950c7e5 library: render: scene: fix spatial lighting
The spatial lighting did not take into account the object's color when
calculating the amount of diffuse and specular light that was emitted.
2020-03-19 18:22:31 +01:00
Bruno BELANYI 4278f5462b library: serialize: add coefficient module 2020-03-19 13:37:20 +01:00
Bruno BELANYI 00de0bf118 examples: colorful: use & annotate optional fields 2020-03-19 13:11:06 +01:00
Bruno BELANYI 4235d3d62f library: material: uniform: optional deserialization 2020-03-19 13:08:49 +01:00
Bruno BELANYI c4a40fab25 library: shape: sphere: optional deserialization 2020-03-19 13:08:36 +01:00
Bruno BELANYI 9857879a75 library: render: scene: optional deserialization 2020-03-19 13:03:39 +01:00
Bruno BELANYI 8778ce81b7 library: render: lights: optional deserialization 2020-03-19 13:03:39 +01:00
Bruno BELANYI e3ebd1c977 library: render: scene: add progress bar 2020-03-19 00:16:24 +01:00
Bruno BELANYI 7a78326fcf project: add indicatif dependency 2020-03-19 00:15:56 +01:00
Bruno BELANYI e11598fc9c library: render: scene: clamp colors before sum
This was a recurring bug in a previous implementation, clamping the
colors before taking the sum of a series of calculations avoid adding a
negative value to a positive one and getting a result which does not
make sense.
2020-03-18 23:20:09 +01:00
Bruno BELANYI 08d6d7c262 library: core: color: add clamp method 2020-03-18 23:18:58 +01:00
Bruno BELANYI 563a793273 library: refactorize light properties handling
Instead of having a method per property, compute them all at once and
use them throughout the rendering pipeline.
2020-03-18 22:46:33 +01:00
Bruno BELANYI 3257598913 library: render: scene: use rayon scope parallelism
The implementation was very easy to write, but is not yet optimal. It
would be better to use `join` to divide into tasks directly on the
stack. And it would be better to iterate over entire blocks of rows
instead of giving a row per-thread: this would lead to better cache-line
behaviour with the fully linear memory accesses.
2020-03-18 19:17:26 +01:00
Bruno BELANYI 923a8fe20c project: add rayon dependency 2020-03-18 18:59:55 +01:00
Bruno BELANYI ca21cf06c2 library: render: scene: use BVH 2020-03-18 18:20:46 +01:00
Bruno BELANYI eca5ec5c26 library: render: scene: deserialize w/ indirection 2020-03-18 18:20:20 +01:00
Bruno BELANYI be4da14313 library: render: object: allow use in BVH 2020-03-18 18:18:03 +01:00
Bruno BELANYI 09af312b86 examples: add colorful scene
This scene shows-off how to declare every type of lights, and results in
a pretty and colorful scene.
2020-03-18 18:06:13 +01:00
Bruno BELANYI f9c86639ce library: core: film: fix x/y ratio mix-up
The X axis is the left-right axis. The Y axis is the up-down axis.
2020-03-18 18:06:13 +01:00
Bruno BELANYI f066ea7125 executable: add scene parsing and rendering 2020-03-18 16:32:55 +01:00
Bruno BELANYI e383b77f68 project: add structopt dependency 2020-03-18 16:32:22 +01:00
Bruno BELANYI a8d23782a4 library: render: scene: add deserialization 2020-03-18 15:53:33 +01:00
Bruno BELANYI c8ca438091 library: core: scene: derive Debug and PartialEq 2020-03-18 15:53:25 +01:00
Bruno BELANYI bfa9aa22dc examples: add example YAML scene 2020-03-18 15:52:41 +01:00
Bruno BELANYI 67628ec083 library: render: object: add deserialization
By using `enum_dispatch` and deserializing the enums, you can very
easily represent the `Object` in serialized form.
2020-03-18 15:52:41 +01:00
Bruno BELANYI 02874c9c22 library: texture: enum: add deserialization 2020-03-18 15:42:37 +01:00
Bruno BELANYI 3f1a166edf library: shape: enum: add deserialization 2020-03-18 15:42:25 +01:00
Bruno BELANYI 6aa5f2536c library: material: enum: add deserialization 2020-03-18 15:42:18 +01:00
Bruno BELANYI 05fb6601b2 library: use enum_dispatch on Object related trait
This allows for easier testing (notable allowing for comparisons),
better performance (thanks to inlining instead of vtable indirection),
and should ease the deserialization of `Material`, `Shape`, and
`Texture` traits. This should allow `Object` to be deserialized easily.
2020-03-18 15:24:09 +01:00
Bruno BELANYI 3ba17fac49 project: replace typetag by enum_dispatch 2020-03-18 15:23:58 +01:00
Bruno BELANYI 4112a933ed library: render: light_aggregate: add deserialization 2020-03-18 14:52:50 +01:00
Bruno BELANYI ccc9eaf423 library: shape: triangle: add deserialization 2020-03-18 14:46:30 +01:00
Bruno BELANYI 8060262ce0 library: shape: sphere: add deserialization 2020-03-18 14:46:22 +01:00
Bruno BELANYI eff133abf3 library: texture: uniform: add deserialization 2020-03-18 14:38:26 +01:00
Bruno BELANYI 803b34641d library: material: uniform: add deserialization 2020-03-18 14:38:17 +01:00
Bruno BELANYI 7ce201ecc2 library: light: spot: add deserialization 2020-03-18 14:38:01 +01:00
Bruno BELANYI 3ef827cabf library: light: spot: fix constructors
The vector was not normalized on input in the SpotLight constructor...
2020-03-18 14:37:16 +01:00
Bruno BELANYI ebe00365d1 library: light: point: add deserialization 2020-03-18 14:36:28 +01:00
Bruno BELANYI 42abfed3fa library: light: directional: add deserialization 2020-03-18 14:35:53 +01:00
Bruno BELANYI 85f274a0b1 library: light: ambient: add deserialization 2020-03-18 14:35:19 +01:00
Bruno BELANYI 9dcce9218f library: material: uniform: fix float comparison 2020-03-18 14:34:37 +01:00