Fix "light acne" inside sphere
authorLukas Jiriste <ljiriste@student.42prague.com>
Fri, 3 Jan 2025 23:08:21 +0000 (00:08 +0100)
committerLukas Jiriste <ljiriste@student.42prague.com>
Fri, 3 Jan 2025 23:08:21 +0000 (00:08 +0100)
commit313a764d3a43564d5dd84d412f84ef896469d9a2
tree7229727a17140defac0e4c95ce0751807359e479
parent475ddb1fd6107ff6bb95f4994558f1279a529f02
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.
src/scene.c