Raytracer


Abstract

Raytracing is a technique which generates a three dimensional picture from a textual description of the spacial arrangement of different kinds of figures. The textual presentations describes the spacial ordering of the figures, the number and placement of light sources, as well as the view point of the observer.

The program calculates each pixel by following the path of the light starting from the eye of the observer. Each figure which intersects the beam is considered in its reflection behaviour. Each figure has an individually definable surface with its own colour, texture, and reflection.

The Raytracer is implemented in Oberon-2 and is extensible. One may introduce arbitrary additional figures. A new figure has to supply two procedures. One which calculates the resulting direction of the light beam after a reflection, and second a procedure which returns the beams hit position within the figures texture.

An example

SOURCE DEFINITION

CALCULATED PICTURE

World.Define
    World.Title "Example1.Bmp"
    World.LookAt <0.0 0.0 50.0>
    World.Observer <0.0 -500.0 170.0>
    World.ViewUp <0.0 0.0 1.0>
    World.Eye 57.0
    World.View 150 150
    World.Background (0.0 0.0 0.3)
    World.Ambient (0.2 0.2 0.2);
    World.Lamp <200.0 -400.0 200.0> (1.0 1.0 1.0) 8000.0
    World.Surface "Metall"
    World.Sphere <0.0 -50.0 120.0> 120.0
    World.Surface "Oberon"
    World.Polygon
      <220.0 220.0 0.0>
      <-220.0 220.0 0.0>
      <-220.0 -220.0 0.0>
      <220.0 -220.0 0.0> ~

Contact

Programmer: Klaus Mittmannsgruber
Email: klaus.mittmannsgruber@jk.uni-linz.ac.at

Supervisor: Dipl.-Ing. Markus A. Hof
Email: hof@ssw.uni-linz.ac.at

Download

Documentation and sources are available via ftp.