1
$\begingroup$

Im not a professional computer graphics programmer, I'm just learning. All the tutorials I've seen so far about ray tracing have one thing in common, that in order to get good visual results they need to cast thousands of rays in random directions from each pixel of the final input and bounce them around.

My question is: Why not cast only 4 and say "These 4 lines form a parallelepiped(a rectangle extruded into the 3rd dimension) and every line inside this parallelepiped is considered a ray that contributes to the final color of this pixel.

At the first iteration, a parallelepiped will hit a triangle called "T1" (assuming all your meshes are made out of triangles) and change the geometry(on geometry shaders) of triangle T1. The triangle T1 will be split into 2 polygons: 1 that was hit by light, and one that hasnt been. These polygons can then be diveded into an array of triangles Lets call this array "T2". This way, only 1 little triangle inside the T2 array will contain all the light and there woudnt be any point inside the little triangle that is not hit by light. Lets call this little triangle T3. All you have to do now, is reflect the triangle T3 to start the second iteration. The difference is that now, at the second iteration, you will have to reflect all the little triangles T3 from every triangle T1 that has been hit by light at iteration 1.

With this technique, you would arrive at the nth iteration with a list of triangles that have all the light in the scene. All you need now is to convert those triangles to actual pixels on the screen and add them to the final color. It just seems faster to me to work with the geometric equation of a line 4 times, than to work with thousands of rays.

What do you think?

$\endgroup$
33
  • $\begingroup$ "These 4 lines form a parallelepiped(a rectangle extruded into the 3rd dimension) and every line inside this parallelepiped is considered a ray that contributes to the final color of this pixel." Because parallelepipeds are not rays. Ray tracing is used because ray/thing intersection tests are cheap compared to doing volume/thing. tests. They also result in a single point, not a bunch of points that you then have to average together. $\endgroup$ Commented Oct 20, 2022 at 15:30
  • $\begingroup$ Checking if 4 points are inside a triangle, or if a triangle is inside 4 points, or if only some of the points are inside a shape seems way more easier than to check if thousands of rays are inside a triangle. Dont you think? $\endgroup$ Commented Oct 20, 2022 at 15:36
  • $\begingroup$ "Checking if 4 points are inside a triangle" That's not how parallelepiped collision checks work. And actually computing the collision area is much harder. Also, one of the advantages of raytracing is that it's not limited to triangles. $\endgroup$ Commented Oct 20, 2022 at 15:38
  • $\begingroup$ Yes it is, because that parallelepiped stops extruding once it hits the triagle, and thus, the triangle can only intersect with 1 side of the parallelepiped. So the triangle only hits a polygon. $\endgroup$ Commented Oct 20, 2022 at 15:40
  • 1
    $\begingroup$ what you are describing sounds a lot like how the reyes rasterizing algorithm used by pixar used to work. $\endgroup$
    – joojaa
    Commented Oct 23, 2022 at 19:04

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.