42/miniRT.git
11 months agoFix index increment on parsing file
Lukas Jiriste [Fri, 6 Dec 2024 11:18:54 +0000 (12:18 +0100)]
Fix index increment on parsing file

11 months agoFree scene memory at the end
Lukas Jiriste [Fri, 6 Dec 2024 08:32:05 +0000 (09:32 +0100)]
Free scene memory at the end

12 months agoConvert camera FOV to radians when parsing
Lukas Jiriste [Thu, 28 Nov 2024 22:30:48 +0000 (23:30 +0100)]
Convert camera FOV to radians when parsing

12 months agoAdd comments to the .rt file (//)
Lukas Jiriste [Thu, 28 Nov 2024 22:10:00 +0000 (23:10 +0100)]
Add comments to the .rt file (//)

12 months agoFix cylinder rendering
Lukas Jiriste [Thu, 28 Nov 2024 22:03:25 +0000 (23:03 +0100)]
Fix cylinder rendering

I thought that the ray forms and acute angle with a vector from
point of entry to cylinder center, but that was not true.
Instead the projections to the plane orthogonal the rotational axis have
this property. So in this commit I implement the test for it.

12 months agoFix computation of radial vector of cylinder
Lukas Jiriste [Thu, 28 Nov 2024 17:12:39 +0000 (18:12 +0100)]
Fix computation of radial vector of cylinder

12 months agoImplement .rt and args parsing, move test scene
Lukas Jiriste [Thu, 28 Nov 2024 16:58:18 +0000 (17:58 +0100)]
Implement .rt and args parsing, move test scene

Add rt_grammar and rt_parsing_table as they describe the grammar used to
parse the .rt file. Their contents are available to he program through
the file parsing_info.h where they are encoded (using xxd -i).

The test_scene is added for testing as the "default scene" had to be
erased from main for parsing to be enabled.

Other changes involve the parsing implementation directly.

12 months agoUpdate Libft to newer version
Lukas Jiriste [Thu, 28 Nov 2024 14:35:05 +0000 (15:35 +0100)]
Update Libft to newer version

12 months agoFix issues with translation
Lukáš Jiřiště [Wed, 27 Nov 2024 09:39:12 +0000 (10:39 +0100)]
Fix issues with translation

This was the same issue as was fixed in a2872aa. Ray was expected to
have normalized direction, but did not.

12 months agoAdd more complex scene to demonstrate miniRT
Lukáš Jiřiště [Wed, 27 Nov 2024 09:26:15 +0000 (10:26 +0100)]
Add more complex scene to demonstrate miniRT

I wanted to have a scene now, but .rt parsing needs to be implemented
yet.

12 months agoAdd intensity dependence on distance
Lukáš Jiřiště [Wed, 27 Nov 2024 09:23:58 +0000 (10:23 +0100)]
Add intensity dependence on distance

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