## Sray raytracer under development

My new ray tracer is starting to look good, even though there’s still quite a lot of work to do before its first public release.

Anyway, I was bored today, so I thought I’d upload a video of an early test. It’s a test of the keyframe animation system, and of the motion blur effect produced through monte carlo (distribution) ray tracing, when a non-zero shutter speed is selected.

Here’s a link to the video on youtube.

### 6 Responses to “Sray raytracer under development”

1. Akis Says:

Nuclear is an achiever.

2. smathegreek Says:

Gianni poly entypwsiako !!!
Mporeis na postareis kapoio link gia tutorials pou aforoun raytraces klp ???

• Nuclear Says:

smathegreek: I’m not sure about any tutorials, but I could suggest a book: “An Introduction to Ray Tracing” ( http://www.amazon.com/Introduction-tracing-Kaufmann-Computer-Graphics/dp/0122861604 ). Unfortunately I just noticed it’s quite expensive, but no matter, actually I can explain how to write a simple ray tracer in a few sentences. The algorithm is extremely simple and elegant.

For each pixel of the image, you start by generating a ray that starts from the view point, and passes through that pixel. Then you have to test that ray with all objects in the scene and find the closest intersection point (start by supporting only spheres and infinite planes which are the simplest objects to test for intersections). If there is no intersection, just assign black, or whatever you consider the “background” color to that pixel. Otherwise, at the closest intersection, calculate the color using the standard phong reflectance model and assign that to the pixel.

Adding reflections is trivial. At the intersection point, recursively call the ray tracing routine with a new ray which has that point as its origin, and direction equal to the reflected vector of the original ray by the normal, and just add the color it returns to the calculated direct color, multiplied by the “reflectivity” of the object. Refraction and shadows are equally trivial if you think about it.

Have fun, and let me know if you give it a try, and ask if you have any problems :)

3. giannis Says:

It looks good John ;)

Is SRay going to be an educational tool of yours, or are you heading for a production ray-tracer?

• Nuclear Says:

For the moment I’m just having fun with it, plus it’s my MSc dissertation project.
I will definitely release it when it’s close to usable, but whether I’ll carry on development and make it into something considered “production quality” in terms of features and performance, remains to be seen :)