summary |
shortlog | log |
commit |
commitdiff |
tree
first ⋅ prev ⋅ next
Lukas Jiriste [Fri, 3 Jan 2025 13:13:33 +0000 (14:13 +0100)]
Detect inside of sphere
The sphere detection only ever considered the "closer" intersection
point. This only works for ray that originate outside the sphere.
Lukas Jiriste [Fri, 6 Dec 2024 12:13:36 +0000 (13:13 +0100)]
Implement manipulation (transformations)
As I have no mechanism for selecting an element so far, the testing
element is the current camera.
I am a little suspicious of the rotation orientation, but it is easily
corrected with sign in the key handling. I may think about it later.
Lukas Jiriste [Fri, 6 Dec 2024 11:42:30 +0000 (12:42 +0100)]
Use t_object (t_element) for lights and cameras
This is because manipulation (translation and rotation) has to be
implemented not just for objects but for lights and cameras also.
It would be better to create a separate union from t_object, but I
cannot think of a way that would not be quite difficult to use.
The typedef t_element can be used for generic element, whereas t_object
should be used for objects (things casting shadow) only.
The vectors for lights and cameras was also changed to vectors of
t_element so that it is easy to pass it as a t_element pointer to change
it in place.
Lukas Jiriste [Fri, 6 Dec 2024 11:18:54 +0000 (12:18 +0100)]
Fix index increment on parsing file
Lukas Jiriste [Fri, 6 Dec 2024 08:32:05 +0000 (09:32 +0100)]
Free scene memory at the end
Lukas Jiriste [Thu, 28 Nov 2024 22:30:48 +0000 (23:30 +0100)]
Convert camera FOV to radians when parsing
Lukas Jiriste [Thu, 28 Nov 2024 22:10:00 +0000 (23:10 +0100)]
Add comments to the .rt file (//)
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.
Lukas Jiriste [Thu, 28 Nov 2024 17:12:39 +0000 (18:12 +0100)]
Fix computation of radial vector of cylinder
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.
Lukas Jiriste [Thu, 28 Nov 2024 14:35:05 +0000 (15:35 +0100)]
Update Libft to newer version
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.
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.
Lukáš Jiřiště [Wed, 27 Nov 2024 09:23:58 +0000 (10:23 +0100)]
Add intensity dependence on distance
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.
Lukáš Jiřiště [Wed, 27 Nov 2024 08:04:12 +0000 (09:04 +0100)]
Initialize ray start in get_camera_ray
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.
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.
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.
Lukas Jiriste [Sat, 23 Nov 2024 12:07:09 +0000 (13:07 +0100)]
Fix some minor bugs in the RT calculations
Lukas Jiriste [Sat, 23 Nov 2024 12:04:55 +0000 (13:04 +0100)]
Add a simple scene for debugging
Lukas Jiriste [Sat, 23 Nov 2024 10:49:27 +0000 (11:49 +0100)]
Implement cylinder-ray intersection detection
This commit makes the project compilable.
Lukas Jiriste [Fri, 22 Nov 2024 19:37:00 +0000 (20:37 +0100)]
Implement camera to ray function
Lukas Jiriste [Fri, 22 Nov 2024 19:35:04 +0000 (20:35 +0100)]
Separate vector functions to separate file
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...).
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).
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.
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.
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.
Lukas Jiriste [Thu, 14 Nov 2024 10:50:19 +0000 (11:50 +0100)]
Add initial tools and structure