README.md aktualisiert

This commit is contained in:
Turingon 2024-02-29 14:10:37 +00:00
parent 311be99d95
commit 297085e741

View file

@ -79,10 +79,14 @@ A diffuse object is any object that is not emitting light, takes on the colours
<img src="https://upload.wikimedia.org/wikipedia/commons/b/bd/Lambert2.gif" width="480"/>
We generate random reflection vectors and get the following (this is the first time a shadow can be observed, left one is mine, right one from the book - note the stripe is probably a consequence of fast inverse square and of using 32-bit floats instead of 64-bit ones):
I generated random reflection vectors and got the following (this is the first time a shadow can be observed, left one is mine, right one from the book - note the stripe is probably a consequence of fast inverse square and of using 32-bit floats instead of 64-bit ones):
<img src="https://media.discordapp.net/attachments/929667122404155445/1212496739668598875/image.png?ex=65f20c95&is=65df9795&hm=d8db91eee8a0f62250c1c64628e7d214aa39c504b94ffa13a554335addfb0905&=&format=webp&quality=lossless&width=1148&height=655" width="480"/><img src="https://raytracing.github.io/images/img-1.07-first-diffuse.png" width="480"/>
A problem that occurs on this image is the **shadow acne** problem: A ray will attempt to accurately calculate the intersection point when it intersects with a surface. Unfortunately for us, this calculation is susceptible to floating point rounding errors which can cause the intersection point to be ever so slightly off. This means that the origin of the next ray, the ray that is randomly scattered off of the surface, is unlikely to be perfectly flush with the surface. It might be just above the surface. It might be just below the surface. If the ray's origin is just below the surface then it could intersect with that surface again. Which means that it will find the nearest surface at t=0.00000001 or whatever floating point approximation the hit function gives us. The simple fix yields this image:
<img src="https://raytracing.github.io/images/img-1.09-no-acne.png" width="480"/>
<img src="https://raytracing.github.io/images/img-1.09-no-acne.png" width="480"/>
To make the shadows look more realistic, I had to implement the Lambertian reflections: basically, most of the reflected rays will be close to the sphere normal and the probability density is dependent on cos(phi), where phi is the angle from the normal. It was very easy to implement and yields the following:
<img src="https://raytracing.github.io/images/img-1.10-correct-lambertian.png" width="480"/>