Commit graph

216 commits

Author SHA1 Message Date
Antoine Martin 0e65a75e2b library: render: mesh: fix panic when parsing OBJ 2020-03-27 17:40:12 +01:00
Antoine Martin cca40bcb8e library: render: mesh: from_slice to build Vector 2020-03-27 17:40:12 +01:00
Antoine Martin f0d36c7d7b library: render: mesh: use nalgebra::zero instead 2020-03-27 17:40:12 +01:00
Bruno BELANYI 15381d4bbd library: render: mesh: scale, rotate, & translate
The scaling factor is the same on all axis, to avoid having angles
changed which would mess with the normals too much.
2020-03-27 17:40:12 +01:00
Antoine Martin 2d624c517f library: render: mesh: make default material grey 2020-03-27 17:40:12 +01:00
Antoine Martin fe5eee0172 library: render: mesh: load basic material from OBJ 2020-03-27 17:40:12 +01:00
Antoine Martin 6ba0f328cd library: render: mesh: handle empty normals in OBJ 2020-03-27 17:40:12 +01:00
Antoine Martin 0368edbd74 library: render: mesh: add OBJ loading 2020-03-27 17:39:44 +01:00
Bruno BELANYI a0d7d5e590 library: render: scene: remove ignored test 2020-03-26 19:05:01 +01:00
Bruno BELANYI 8727ae9d87 library: use #[serde(from)] for Deserialize 2020-03-26 19:03:42 +01:00
Bruno BELANYI 0678317442 library: render: scene: deserialize meshes 2020-03-26 18:48:48 +01:00
Bruno BELANYI f03880799b library: render: deserialization: error on unknown 2020-03-26 18:37:42 +01:00
Bruno BELANYI 0f6b81e40c WIP: add Mesh, TriangleTexture, TriangleMaterial 2020-03-26 18:37:42 +01:00
Bruno BELANYI e65a2a1f48 WIP: add comment about path-tracing 2020-03-26 17:42:08 +01:00
Bruno BELANYI 998838a6fc library: use Intersected as a super trait 2020-03-26 17:42:08 +01:00
Bruno BELANYI 3039607e4f beevee: bvh: use Accelerated trait for objects
This will allow for the use of meshes inside the BVH.

Returning the reference to a triangle inside the mesh directly instead
of returning the reference to the mesh itself allows for more optimum
execution.
2020-03-26 17:42:08 +01:00
Bruno BELANYI 5c0fc9689e library: shape: add InterpolatedTriangle type
This is a triangle with added normal interpolation at its edges. This is
particularly useful when rendering mesh objects.
2020-03-25 00:27:26 +01:00
Bruno BELANYI 3b5410aef9 library: render: scene: add hemisphere sampling
This method takes a given normal, and computes a random ray in the
unit-hemisphere described by that normal.

We use cosine-weighted importance sampling because it leads to better
convergence and is a nice micro-optimisation (from four trigonometric
operations to only two).
2020-03-25 00:12:05 +01:00
Bruno BELANYI 965fda7395 examples: add background color to example scene 2020-03-25 00:09:49 +01:00
Bruno BELANYI 08063b5aa3 library: render: scene: add background color 2020-03-25 00:09:49 +01:00
Bruno BELANYI c2fd001430 library: render: object: remove index field 2020-03-25 00:09:49 +01:00
Bruno BELANYI 2e224b280d Merge branch 'add-beevee' into 'master'
Add beevee

See merge request EPITA_bruno.belanyi/image/ing2/pathtracer!4
2020-03-24 21:04:52 +00:00
Bruno BELANYI 6df2d857d4 library: use beevee's Intersected trait 2020-03-24 21:55:51 +01:00
Bruno BELANYI 21c7aea1c0 beevee: bvh: use Intersected trait for objects
This avoids having black squares around the objects because we computed
that it was the closest but the ray didn't actually hit it...
2020-03-24 21:55:51 +01:00
Bruno BELANYI 48bb3550cb library: use beevee instead of rust-bvh
I also used this opportunity to use `nalgebra::Unit` as much as
possible.
2020-03-24 21:55:48 +01:00
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