Java Ray Tracer project for

Introductory programming

December 2003


Table of contents


Introductory information

Welcome to the homepage of the Java Ray Tracer Project.

This project is an opportunity for students, with an interest in computer graphics, to use their "Basic Programming" skills to make a fun 4-week project. The course "Basic Programming" or equivalent is the only prerequisit for this project. People with different skills and different goals can all make this project. All groups are required to make a basic ray tracer, but whether focus should be on adding features to the ray tracer or making a nice user interface is up to the individual group.

Each group are required to do a project agreement. Each group will have to describe its work done in a report, and this report is defended at a project exam.


The assignment


Introduction

When an eye or a camera sees an object, it is recording the light reflected by (or refracted through) the object. The reflected light originates from a light source. The principle behind ray tracing is to trace a ray from an eye point e through a point p in a grid I and calculate the light in the closest intersection between the ray and any object in the scene. If this is done for every point in I, then I will be a ray traced image of the scene, as seen from an observer in e looking through the "window" specified by the size of I. This principle is illustrated below.

A general algorithm for a ray tracer could look like this:

  1. Build a scene of objects, light source and camera
  2. Compute image
  3. Save Image
A basic algorithm for computing the image using ray tracing could be the following:

  1. Divide the film I in a number of reference points
  2. Do the following for each reference point:
    • Determine the parameters for a line, which passes through the eye point and the reference point.
    • Do the following for each object in the scene:
      • Determine if there is a point of intersection between the object and the line
      • If there is an intersection point, and this point is closer to the camera than any previous points of intersection, then register this point of intersection.
    • Set the colour of the reference point to be the colour of the object at the registered point of intersection.

Calculating the light intensity at the point of intersection

The angle between the normal to the object and the direction to the lightsource determines the amount of light which is reflected. This principle is the foundation of the most simple shading model and is illustrated below.

l is the lightsource, p is the intersection point and theta is the above mentioned angle. .

If we let pI denote the light intensity in the point p, lI the intensity of the lightsource and fk the object's reflection coefficient, we get the following equation for the light intensity:

Of course we also have to check if the ray from the light source is obstructed by another (or the same) object, in which case there is no direct light contribution from that light source (it is in shadow). The following picture shows these two basic steps: calculating shadow and reflection.

I also suggest you read this excellent tutorial on Ray Tracing:, which includes relevant formulas for intersections:

"Practical Ray Tracing"

The report

There are the following general demands for the report:

Furthermore there is the following basic requirements to the contents of the report:

The implemented ray tracer must, as minimum, be designed to show planes and spheres using Phong illumination.

Extra assignments

As mentioned in the introduction, it is possible for the group to put an individual focus into an area of specific interest. The following can serve as inspiration.


Administrative information

Important dates

Signing up for the project

The easiest way to sign up for the project is to go to the presentation of the project on 10. of November, where you can get help to find a group and fill out the project agreement. Be aware that at least two participants are required in a group unless otherwise is agreed on with the teacher. We recommend at least 3 persons in a group.

This section describes in detail how to sign up for the project. These instruction are given for the english version of the system. Do the following steps:

  1. Go to the electronic project base https://adm.it-c.dk/. If you do not have a password get one by clicking on the "get password" link. Follow the instructions and await the password in your e-mail.
  2. After logging on click on Project Base.
  3. Click on "new project".
  4. In the field "Project agreement- common part" click "fill in " and fill in the fields as follows:
    • Project title(danish): "Java Ray Tracer."
    • Project title (english): "Java Ray Tracer."
    • Non disclosure agreement: "No"
    • Liability: "Collective."
    • Language (report): <Select the language that you prefer for your report.>
    • Problemformulation: "Implentation of a simple Ray Tracer in Java. The Ray Tracer should be able to simulate reflective materials and use a phong shading model."
    • Method: "Basic ray tracing theory. Program design using UML diagrams."
    • A report containing:
      • A short review on basic ray tracing theory.
      • Program design.
      • Implementation details.
      • Testing and concluding remarks
  5. Click "Save project agreement (common part)" and subsequently click "approve" in the project agreement - common part field.
  6. In the field "Participants - individual information " fill in the fields as follows:
    • Project type: "4-week project".
  7. Click "Save individual information" and subsequently click "approve" under your individual information.
  8. Add each menber of the group by entering the name of him/her, clicking "add participant" and filling out the form as described in 6.
  9. In the field "Supervisor" enter Jakob Raundahl, click "add supervisor", select "choose" to the left of Jakob Raundahl and click "add supervisor".
  10. Finally, click "invite" on Jakob Raundahl.
  11. The project agreement will be sent back to you ASAP by me. As soon as you recieve it follow the instructions to sent it to the study board. Note that you have to sent it to the study board before 17. of November.

 

Project exam

The time for examination will be given later.

When the projects are handed in an exam plan will be made ASAP

Each group must defend their report at an oral examination. Based on the report an the oral examiation a character based on the 13-scale is given for each participant in the group.

Project groups

A list of groups will appear later.

Supervisor

Jakob Raundahl, email:raundahl@itu.dk, room 3.20