summary |
shortlog | log |
commit |
commitdiff |
tree
first ⋅ prev ⋅ next
Lukas Jiriste [Tue, 14 Jan 2025 15:45:21 +0000 (16:45 +0100)]
Make scene.c completely Norm compliant
Lukas Jiriste [Tue, 14 Jan 2025 14:15:56 +0000 (15:15 +0100)]
Rename parsing.c to parse.c for consistency
Lukas Jiriste [Tue, 14 Jan 2025 14:14:46 +0000 (15:14 +0100)]
Make parsing.c completely Norm compliant
Lukas Jiriste [Mon, 13 Jan 2025 18:56:41 +0000 (19:56 +0100)]
Fix some of Norm non-compliant formatting
Lukas Jiriste [Mon, 13 Jan 2025 18:48:43 +0000 (19:48 +0100)]
Update Libft for Norm compliance
Lukas Jiriste [Fri, 10 Jan 2025 14:38:10 +0000 (15:38 +0100)]
Switch parsing order
This is done so cycling through lights and cameras starts with
the topmost element one (instead of the bottommost one).
Lukas Jiriste [Wed, 8 Jan 2025 14:38:37 +0000 (15:38 +0100)]
Add switching between cameras
The key 'c' and 'x' cycle through cameras. A second camera is now in the
test scene to demonstrate this.
Lukas Jiriste [Wed, 8 Jan 2025 14:32:01 +0000 (15:32 +0100)]
Fix vec_normalize
The function multiplied the given vector by its norm instead of dividing
it by it.
Lukas Jiriste [Wed, 8 Jan 2025 14:16:07 +0000 (15:16 +0100)]
Add a way to select lights for manipulation
The 'l' and 'k' keys are used to cycle through lights. When no light is
selected, either of the keys selects the last one selected.
Lukas Jiriste [Wed, 8 Jan 2025 13:10:37 +0000 (14:10 +0100)]
Add resizing of objects
Lukas Jiriste [Wed, 8 Jan 2025 12:29:14 +0000 (13:29 +0100)]
Fix inverted directions of manipulation
Lukas Jiriste [Wed, 8 Jan 2025 12:17:25 +0000 (13:17 +0100)]
Add switch between absolute and relative axes
Lukas Jiriste [Wed, 8 Jan 2025 11:54:34 +0000 (12:54 +0100)]
Name object manipulation magic numbers
Lukas Jiriste [Tue, 7 Jan 2025 14:36:22 +0000 (15:36 +0100)]
Implement clicking on an object to select
The selected object can then be manipulated the same way as the
(current) camera. It also uses the axes of the current camera (relative
coordinates), which may or may not be desirable.
The object is selected by left mouse button and deselected by right
mouse button or escape.
Lukas Jiriste [Sat, 4 Jan 2025 12:39:49 +0000 (13:39 +0100)]
Add more elements to the test_scene
Now cylinder and sphere have lights inside and the scene is enclosed in
another sphere.
The cylinder from inside is curious. The bases have very dark edges,
which looks obviously wrong, but it is direct consequence of only
tracing rays from object to lights. Proper ambient lighting would fix
this (but is outside of the scope of miniRT).
Lukas Jiriste [Sat, 4 Jan 2025 12:36:28 +0000 (13:36 +0100)]
Fix not rendering the inside of objects correctly
The optimization of seeing whether the circumsphere would interact with
a ray contains a check for whether the circumsphere CENTER is behind the
ray origin instead of its furthest point. This is now rectified which
fixes the rendering when inside an object.
Lukas Jiriste [Fri, 3 Jan 2025 23:34:44 +0000 (00:34 +0100)]
Stop cylinder from filtering "wrong" intersections
Lukas Jiriste [Fri, 3 Jan 2025 23:08:21 +0000 (00:08 +0100)]
Fix "light acne" inside sphere
Consider how the color tracing part works. Until now the ray toward
light was ignoring the object from which it is originating. Then the
closest intersect was found for every other object. Then the closest one
was picked and compared to the distance of the object to light source.
Not ignoring the current object causes acne, because the ray origin may
be on either side of the surface. But it would be quite exhausting to
built the detection to every singe detection function. So instead the
functions return a vector of all intersections of an object with a ray
and the later functions can choose which one is the best.
So now the obstruction finding function may chose to ignore the closest
intersection if it is suspiciously close and of the same object.
Lukas Jiriste [Fri, 3 Jan 2025 15:18:48 +0000 (16:18 +0100)]
Try to implement sphere self obstruction inside
The sphere was completely lit inside by the lights outside.
I cannot stop ignoring at least parts of the objects else planes would
render with shadow acne.
So I tried to ignore the object if it obstructs itself very close from
the rendered place - this should prevent shadow acne.
The sphere however ignores the distant intersection when the close one
needs to be ignored. This manifests as "light acne" - some part are
correctly in shadow, while others cause the object to be ignored and
light passes through.
Lukas Jiriste [Fri, 3 Jan 2025 13:17:58 +0000 (14:17 +0100)]
Fix "translucence" of surfaces
The surfaces "glow" instead of reflect light. In other words the lights
and shadows that are seen from one side of a (eq.) plane are seen from
the other (unilluminated) side.
This commit makes it so the light only reflects.
The sphere needs to get self-obstruction implemented. On he inside it
does not cast its own shadow for now.
The test_scene now contains a green light inside the sphere to test the
interior rendering.
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