42/miniRT.git
12 months agoFix shadow casting
Lukáš Jiřiště [Wed, 27 Nov 2024 09:08:03 +0000 (10:08 +0100)]
Fix shadow casting

The shadows did not work because the obstruction detection used a
function that expects ray with normalized direction vector. But the
obstruction detection did not normalize its ray because the check for
whether the obstruction is between the object and the light was easier.
The fix is normalizing the ray vector and using distance.

12 months agoInitialize ray start in get_camera_ray
Lukáš Jiřiště [Wed, 27 Nov 2024 08:04:12 +0000 (09:04 +0100)]
Initialize ray start in get_camera_ray

12 months agoSolve plane shadow acne
Lukas Jiriste [Tue, 26 Nov 2024 19:16:04 +0000 (20:16 +0100)]
Solve plane shadow acne

This commit makes it so an object does not use itself for shadow
calculation. This only works properly for objects, that are not concave.

12 months agoChange plane light diffusion
Lukas Jiriste [Tue, 26 Nov 2024 19:10:26 +0000 (20:10 +0100)]
Change plane light diffusion

In the previous commit I noted that plane may not interact with light,
if the normal has the wrong sign. This commit changes but now a plane is
illuminated through itself - it diffuses light that is on the other side
than the camera.
This could be excused arguing that it is an infinitely thin piece so it
should emit light on both sides, but I would rather it would only
emit light on the side it is illuminated on.

12 months agoImplement Lambertian diffuse lighting (kind of)
Lukas Jiriste [Tue, 26 Nov 2024 18:55:06 +0000 (19:55 +0100)]
Implement Lambertian diffuse lighting (kind of)

This implementation has its problems. The one I can think of now is that
planes are only reflecting, when their normal points in the direction of
the light.

12 months agoFix some minor bugs in the RT calculations
Lukas Jiriste [Sat, 23 Nov 2024 12:07:09 +0000 (13:07 +0100)]
Fix some minor bugs in the RT calculations

12 months agoAdd a simple scene for debugging
Lukas Jiriste [Sat, 23 Nov 2024 12:04:55 +0000 (13:04 +0100)]
Add a simple scene for debugging

12 months agoImplement cylinder-ray intersection detection
Lukas Jiriste [Sat, 23 Nov 2024 10:49:27 +0000 (11:49 +0100)]
Implement cylinder-ray intersection detection

This commit makes the project compilable.

12 months agoImplement camera to ray function
Lukas Jiriste [Fri, 22 Nov 2024 19:37:00 +0000 (20:37 +0100)]
Implement camera to ray function

12 months agoSeparate vector functions to separate file
Lukas Jiriste [Fri, 22 Nov 2024 19:35:04 +0000 (20:35 +0100)]
Separate vector functions to separate file

12 months agoBring the project closer to compileability
Lukas Jiriste [Fri, 22 Nov 2024 11:55:04 +0000 (12:55 +0100)]
Bring the project closer to compileability

Fix Makefile includes and links.
Comment line prototypes out of main.c.
Rearrange the functions in main.c (I really should just write the
declarations into the header file...).

12 months agoImplement the color calculation
Lukas Jiriste [Thu, 21 Nov 2024 21:47:22 +0000 (22:47 +0100)]
Implement the color calculation

Also reimplement the t_color as typedef of t_vec3 so that I can use the
vec* operations on color. The t_color now signifies the linear RGB and
needs to be converted to (and from) sRGB upon printing (reading).

12 months agoImplement most of ray intersection detection
Lukas Jiriste [Thu, 21 Nov 2024 16:00:49 +0000 (17:00 +0100)]
Implement most of ray intersection detection

Implement finding the intersection of ray with plane and sphere and use
the intersection closest intersection to camera for color finding.
Cylinder will be implemented at another time.
Also change what qualifies as an object; Now objects have to interact
with light. Light sources and cameras are not objects anymore.

12 months agoAdd the structures used for defining the scene
Lukas Jiriste [Thu, 21 Nov 2024 12:18:22 +0000 (13:18 +0100)]
Add the structures used for defining the scene

Add the structures that are needed for the scene representation.
Also change the functions in main a little to accommodate some of these
changes.

12 months agoAdd some functions and structure
Lukas Jiriste [Fri, 22 Nov 2024 08:27:42 +0000 (09:27 +0100)]
Add some functions and structure

These functions were taken from fract-ol project, which uses the
minilibx library.

12 months agoAdd initial tools and structure
Lukas Jiriste [Thu, 14 Nov 2024 10:50:19 +0000 (11:50 +0100)]
Add initial tools and structure