|
|
 |
| GRAPHICS |
| Ray-tracing |
 |
One of the things I always wanted to implement was a ray-tracing algorithm.
So I started with that.
First, ray-casting with triangles (click to enlarge):

In the above image, the green triangles are a bit jagged.
So I added anti-aliasing (that, unfortunately, adds a lot of time to calculations).
The two images below show 2x2 and 4x4 anti-aliasing.
It turns out, that usually 2x2 or 3x3 anti-aliasing is the best trade-off between quality and speed.


Next, I added spheres:

And an optional background:

But still, all of the above were based on simple ray-casting and the images aren't so terrific.
So, I decided to add shadows as the next step; and this starts to be a true ray-tracing algorithm.
First, light intensity was changed depending on the angle to the source of light.



Next, calculate shadows:


And add ambient light so that shadows aren't so dark:

And we can show multiple sources of light:

Rotary surfaces:


Top
|
|
|
 |