Review Index:

Ray Tracing and Gaming - Quake 4: Ray Traced Project

Manufacturer: General

Introduction to Ray Tracing

Guest author Daniel Pohl shares with us his insight into using raytracing for game rendering and how the increasing power of multi-core processors are helping bring it to a reality.

Imagine playing a computer game in the quality seen in the movies of the 'Lord of the Rings'-series; absolute realistic lighting, details like in real life, believable skins and much more.

('Lord of the Rings'-Movie: Rendered image with ray tracing - Copyright Newline Cinema)

One technique that was used creating the images for those movies is called 'ray tracing'. This is an alternative rendering technology compared to what actual graphic cards on modern PCs and consoles do. For many years ray tracing has only been used for offline-rendering and the generation of pictures for movies often took many days to calculate.  Real-time ray tracing has been made possible with the OpenRT Ray tracing library. Through using many PCs over an Ethernet network interactive frame rates could be rendered in high resolution. Now, four years later CPUs have progressed a lot and ray tracing works in small resolutions on a single PC in real-time, but more on this later.

OpenRT is a ray tracing library developed by the Computer Graphics Group of Saarland University. The syntax of the API is nearly identical to OpenGL. A free Linux test version for programmers can be downloaded.

Ray tracing

So, how does ray tracing work? The algorithm is quite simple.

A basic ray tracing scenario.

  1. From a virtual camera (denoted by the eye), primary rays are shot through every pixel on the screen.
  2. For every ray the intersection hitpointprimary with the object closest to the camera is calculated. In the example this is the green sphere.
  3. The shader program of the green sphere is called.
  4. In this example the material of the green sphere should be totally reflective, so the shader shoots a reflection ray from hitpointprimary into the reflected direction.
  5. The reflection ray hits an object and hitpointreflected is calculated. In the example it is the red triangle.
  6. The shader program of the red triangle is called.
  7. A shadow ray is shot from hitpointreflected into the direction of the light source (not shown in the figure).
  8. There is an object between the point on the triangle and the light source.
  9. Nothing is added to the triangle shader color, therefore the point represents shadow.
  10. The triangle shader returns its color, which is added to the frame buffer.
  11. A shadow ray is shot from hitpointprimary into the direction of the light source.
  12. There is no object between hitpointprimary on the triangle and the light source.
  13. Through the attributes of the light source a color values is calculated and added to the frame buffer.

For efficient ray tracing a space acceleration structure (e.g. a BSP is used, which holds all geometry of the 3D scene. Using this technique the blue cube from the figure above was not touched for the calculation of the final color.

Next Page - Quake 3: Ray Traced

Video News

No comments posted yet.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Lines and paragraphs break automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote><p><br>
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

This question is for testing whether you are a human visitor and to prevent automated spam submissions.