# Raytracing

## Raytracing and POV-Ray - the details

This page explains more in detail how the images on my website are generated. Some knowledge about the basics of computer graphics is required to understand it, a rough introduction into this can be found in the introduction for newbies.

### displaying three-dimensional scenes

The images i create display setups of three-dimensional objects, usually referred to as scenes. These scenes do not exist in the real world, they are virtual if you want so, meaning they purely exists inside the computer.

To display such a scene - we say to render it - you can follow several approaches. The most self-evident and also probably the most common technique is to draw or to project the scene geometry on the image plane. When we define the way we want to look at the scene (the camera) and look though it as though a pinhole camera, the position where each element of the scene geometry should become visible on the image can be described by a mathematical equation.

The relation between a point in the scene and its image in the image plane is a linear transform. Therefore straight lines in the scene are transformed into straight lines in the image. As a consequence it is quite simple to draw any geometry consisting purely of polygons this way.

But drawing polygons on the screen is not enough for a realistic render. To correctly determine where foreground polygons cover the background geometry for example there are already additional tricks required (z-buffering). Higher degrees of realism like shadows, reflection and refraction are even more difficult. None the less this technique is used by most computer games and interactive 3d applications. Graphic cards offering hardware accelerated 3d make use of this rendering method as well.

line render scanline (polygon) render raytracing

### raytracing

The most important other technique available to render three-dimensional scenes is raytracing. This method uses a completely different approach. To calculate the image a light ray is sent out from the camera for every pixel of the image. The way this light ray takes through the scene is then calculated using the basic rules or ray optics. This makes it possible to realistically simulate most lighting effects.

Apart from offering a high degree of realism without complicated tricks raytracing also has the advantage that arbitrary geometries can be displayed. Curved surfaces can be raytraced without an approximation by a triangle mesh - all that is required is a way to calculate the intersection of a line (the ray) with the object surface.

### a note on render speed

Raytracing has the reputation of being comparatively slow - without justification in many cases. There are several reasons why you can get this impression when using a raytracer:

• Raytracing offers effects like shadows and reflection without any additional tricks - it would be biased to compare this to a technique not capable of such effects.
• Although you can directly render curved surfaces with a raytracer it is still much faster to render a triangle mesh in most cases - even in a raytracer.
• scanline rendering techniques often make use of hardware acceleration (in most cases through libraries like OpenGL and DirectX).
• Some effects like soft shadows, focal blur, blurred reflection and anti-aliasing are relatively computationally intensive in raytracing.
• In raytracing the primary factor for the render speed is the number of pixels in the rendered image - the complexity of the scene on the other hand is of minor importance. In a scanline renderer this is just the other way round.

A short introduction on how images can be generated using this technique with POV-Ray can be found in the POV-Ray introduction.

These links lead to external resources. I am not responsible for their content, they are just meant to show things I found interesting.

#### Raytracing introductions

 The Recursive Ray Tracing Algorithm by Jamis Buck
 A good introduction into raytracing http://www.geocities.com/jamisbuck/raytracing.html

 FuzzyPhoton by Siddhartha Chaudhuri
 Another introduction into the raytracing technique http://fuzzyphoton.tripod.com/

 Ray Tracing News Guide by Eric Haines
 A news site about new techniques in raytracing, not much updated recently http://www.acm.org/tog/resources/RTNews/html/index.html

 3D computer graphics by Wikipedia
 Wikipedia entry about 3D computer graphics http://en.wikipedia.org/wiki/3D_computer_graphics

 Rendering by Diego Krota
 A short and understandable introduction to rendering techniques http://www.geocities.com/SiliconValley/Way/2419/rendering.html

 An Introduction to Raytracing by Myles Strous
 An intro into Raytracing and POV-Ray, transcript of a printed article http://www.melbpc.org.au/pcupdate/2011/2011article11.htm