Commit graph

141 commits

Author SHA1 Message Date
Bruno BELANYI d8a4a2eaad beevee: bvh: add intersection test to BVH 2020-03-24 21:47:14 +01:00
Bruno BELANYI 45fca6f3ed beevee: bvh: remove reference to objects in BVH 2020-03-24 21:47:14 +01:00
Bruno BELANYI 69779d7dd4 beevee: aabb: add sqdist_to_point method to AABB 2020-03-24 21:47:14 +01:00
Bruno BELANYI 6d39682feb beevee: ray: make Ray's fields public 2020-03-24 21:47:14 +01:00
Bruno BELANYI 566a9b198d beevee: bvh: add build implementation 2020-03-24 21:47:14 +01:00
Bruno BELANYI 8b3cbccb75 beevee: add psqselect dependency 2020-03-24 21:47:14 +01:00
Bruno BELANYI a405af8f88 beevee: aabb: bounded: add centroid method 2020-03-24 21:47:14 +01:00
Bruno BELANYI eddad707eb beevee: ray: add Ray implementation 2020-03-24 21:47:14 +01:00
Bruno BELANYI 0ce49bb3a3 beevee: aabb: add Bounded trait implementation 2020-03-24 21:47:14 +01:00
Bruno BELANYI 58ee42d21d beevee: aabb: add AABB implementation 2020-03-24 21:47:14 +01:00
Bruno BELANYI ca28281b67 beevee: add Axis enum implementation 2020-03-24 21:47:14 +01:00
Bruno BELANYI 9c56134c67 beevee: add library to workspace
This is designed to be the new BVH for the raytracer.
2020-03-24 21:47:14 +01:00
Bruno BELANYI 01d2c2d973 project: move to Cargo workspace 2020-03-24 21:47:09 +01:00
Bruno BELANYI b5835b2726 Merge branch 'fix-refraction' into 'master'
Fix refraction

See merge request EPITA_bruno.belanyi/image/ing2/pathtracer!2
2020-03-24 20:39:48 +00:00
Bruno BELANYI 8e09f45f69 library: render: move helpers to utils module
Those helper functions are used by `Scene` to render the scene, but
they have no use being in the same file. Instead make it a crate-public
module of `render`.
2020-03-23 16:51:06 +01:00
Bruno BELANYI c0c332e3fa examples: triangles: fix ball diffraction index
The ball was intended to be a glass ball, so an index of 1.5
2020-03-23 16:49:55 +01:00
Bruno BELANYI 70c0e0cdf3 library: render: scene: handle refraction cleanly
The refraction information was incorrect in the previous implementation.
We never updated the medium information when going out of a transparent
material. It is now handled using a small structure holding both the old
index, and new_index.

We can now handle any number of successive medium changes, with the
associated change of indices correctly.

This implementation assumes that any ray going into an object is going
to come out in the same medium that it was originally travelling in
before entering said object. This is an acceptable approximation to me.
2020-03-23 16:49:55 +01:00
Bruno BELANYI 6af36d814f library: render: scene: cleanup refracted calculation 2020-03-23 16:49:55 +01:00
Bruno BELANYI 16066a3c7d library: render: scene: normalize vectors 2020-03-23 16:49:55 +01:00
Bruno BELANYI fccf3caef1 library: render: scene: clean-up ReflTrans handling 2020-03-23 16:49:55 +01:00
Bruno BELANYI b29e6d1613 library: render: scene: fix reflection handling
The reflection will be calculated even if it ends up not contributing to
the final color of an object. This allows for a more systematic use of
coefficients without applying them twice, like it was done for the
refraction transparency handling...
2020-03-23 16:49:55 +01:00
Bruno BELANYI 61db9c0cd4 Merge branch 'doc' into 'master'
Document public APIs

See merge request EPITA_bruno.belanyi/image/ing2/pathtracer!1
2020-03-23 12:06:13 +00:00
Bruno BELANYI ef8a418479 library: texture: do not expose sub-modules 2020-03-23 12:44:17 +01:00
Bruno BELANYI db4b8b05ba library: shape: do not expose sub-modules 2020-03-23 12:44:17 +01:00
Bruno BELANYI bef61b43b8 library: material: do not expose sub-modules 2020-03-23 12:44:17 +01:00
Bruno BELANYI f8102ddb3b library: light: do not expose sub-modules 2020-03-23 12:44:17 +01:00
Antoine Martin 0d59f49ea7 library: document root module 2020-03-23 12:44:17 +01:00
Antoine Martin 64125dbc43 library: document render module 2020-03-23 12:44:17 +01:00
Antoine Martin a9fd726a0d library: document shape module 2020-03-23 12:44:17 +01:00
Antoine Martin ce1b8eeaaa library: document texture module 2020-03-23 12:43:22 +01:00
Antoine Martin 94ab40413a library: document serialize module 2020-03-23 12:42:36 +01:00
Antoine Martin 614217d33e library: document material module 2020-03-23 12:42:36 +01:00
Antoine Martin 2aed964101 library: document light module 2020-03-23 12:41:39 +01:00
Antoine Martin 04deae1d88 library: document core module 2020-03-22 00:14:25 +01:00
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