Caves Travel Diving Graphics Mizar Texts Cuisine Lemkov Contact Map RSS Polski
Trybiks' Dive Graphics Ray tracing YAC Software
  Back

Introduction

Ray tracing

Ray casting

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):

Previous Next Close


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.

Previous Next Close


Previous Next Close


Next, I added spheres:

Previous Next Close


And an optional background:

Previous Next Close


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.

Previous Next Close


Previous Next Close


Previous Next Close


Next, calculate shadows:

Previous Next Close


Previous Next Close


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

Previous Next Close


And we can show multiple sources of light:

Previous Next Close


Rotary surfaces:

Previous Next Close


Previous Next Close


More to come shortly...

Top