You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -143,7 +143,7 @@ This method was popular in early static computer graphics —think of those icon
143
143
This project, **miniRT**, aims to build a simple yet functional ray tracer from scratch in C, exploring the fundamentals of vector calculations and rendering.
<span><strong>Ray-tracing process:</strong> The ray goes from the camera through a pixel of the window and is tested for intersection with the objects. When a ray hits an object, the ray tracer works out how much light is reflected back along the ray to determine the pixel's color.<sup><a href="#footnote1">[1]</a></sup></span>
149
149
</p>
@@ -195,7 +195,7 @@ Where:
195
195
-**$\vec{n} $:** The normal vector of the plane, which is perpendicular to the surface.
<span>A plane is defined by a point <i>a</i>, which determines its location, and a normal <i>n</i>, which defines its orientation. The point <i>p</i> is any point on the plane, such as the intersection of a ray with the plane.<sup><a href="#footnote1">[1]</a></sup></span>
201
201
</p>
@@ -223,7 +223,7 @@ $$
223
223
- If the denominator $(\vec{d} \cdot \vec{n} )$ is zero (*t* is undefined or infinite), it means the ray is **parallel** to the plane and does not intersect it.
<span> A sphere is defined by its center <i>c</i> and radius <i>r</i>, which determine its size and position. The point <i>p</i> represents any point on the sphere's surface (potential intersection point).<sup><a href="#footnote1">[1]</a></sup></span>
As explained [above](https://github.com/alx-sch/42_miniRT/blob/main/README.md#quadratic-intersections-in-ray-tracing), this solves into:
435
+
As explained [above](https://github.com/Busedame/miniRT/blob/main/README.md#quadratic-intersections-in-ray-tracing), this solves into:
<span>A cylinder is defined by a point on its axis and a vector representing its direction (e.g., <i>(0,0,0)</i> as the point and <i>(0,1,0)</i> as the orientation vector along the y-axis in the figure above), a radius, and a height given by $\Vert y_1 - y_0 \Vert$. The point <i>p</i> can be any point on the cylinder's surface.<sup><a href="#footnote1">[1]</a></sup></span>
Please note that this function calculates the intersection of a ray with an infinite cylinder, not yet considering the cylinder's height and end caps. So far, it only detects intersections with the cylinder's lateral surface:
For each object, the appropriate intersection function (`plane_ix`, `sphere_ix`, `cyl_ix`, see in [find_intersection.c](https://github.com/alx-sch/42_miniRT/blob/main/src/4_find_intersection.c])) is called based on the object's type. These functions check if the ray intersects the object and update the intersection data (`ix`) if the intersection is the closest one found so far.
936
+
For each object, the appropriate intersection function (`plane_ix`, `sphere_ix`, `cyl_ix`, see in [find_intersection.c](https://github.com/Busedame/miniRT/blob/main/src/4_find_intersection.c)) is called based on the object's type. These functions check if the ray intersects the object and update the intersection data (`ix`) if the intersection is the closest one found so far.
937
937
938
938
While the origins of the camera rays are known, the following chapter will explain how to calculate the direction of each camera ray.
939
939
@@ -950,7 +950,7 @@ Following the camera ray (or primary ray) for a given pixel is the first step in
<span><strong>Top:</strong> In orthogonal viewing, each pixel is a separate camera ray, all running parallel to one another. This results in objects being the same size, regardless of their distance. Used in technical drawings and CAD. <br><strong>Bottom:</strong> Perspective viewing is more in line with how we perceive the world: Camera rays have a single point of origin. This way, objects have a vanishing point and appear smaller the farther they are away. Used in realistic 3D rendering. <br> Sources: Diagrams left <sup><a href="#footnote1">[1]</a></sup>; diagrams right<sup><a href="#footnote2">[2]</a></sup> </span>
956
956
</p>
@@ -965,13 +965,13 @@ A **pinhole camera model** can be used to describe how a 3D scene is projected o
965
965
- The **view frustum** is a truncated pyramid extending from the camera's position toward the viewport. The rectangular screen at the base of the frustum defines the visible scene.
If the origin of the shadow ray (the intersection between the camera ray and the object) is not moved slightly above the surface, an effect called "shadow acne" can be observed. Because computers cannot represent floating-point numbers with perfect precision, the hit point falls within a small margin of error around the surface. This means that some calculated hit points end up slightly below the surface. As a result, the shadow ray incorrectly intersects the object itself, causing it to cast a shadow on its own intersection point.
<span>The same scene without any shadowing <strong>(a)</strong>; shadowing without ensuring that the shadow ray-object intersection occurs in front of the light source <strong>(b)</strong>; shadowing without offsetting the shadow ray origin, resulting in shadow acne <strong>(c)</strong>, correct shadowing <strong>(d)</strong>. Note that no shading has been applied yet and shadows are still rendered as black.</span>
1262
1262
</p>
1263
1263
@@ -1284,7 +1284,7 @@ To improve this, we can use the Phong Reflection Model, which simulates how ligh
<span>The same scene with: ambient light and diffuse shading <strong>(a)</strong>, specular highlighting <strong>(b)</strong>, and light fading <strong>(c)</strong>, resulting in a fully shaded render.</span>
0 commit comments