Java Ray Tracer project for
Introductory programming
December 2003
Table of contents
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.
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:
- Build a scene of objects, light source and camera
- Compute image
- Save Image
A basic algorithm for computing the image using ray tracing could be the following:
- Divide the film I in a number of reference points
- 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"
There are the following general demands for the report:
-
The report must contain a foreword telling who has made the assignment,
what the assignment contains, where the assignment is made (ITU), during
wich period and with wich instructors and main instructor. Futhermore a short
statement on whether the project went as planned is required. The foreword
must at most be one page.
-
The document "Projektaftale" is used as front page for the assignment.
Furthermore there is the following basic requirements to the contents of the report:
-
A brief review of the ray tracing theory necesarry for the assignment.
-
A section on program design
-
A section on program implementation
-
A section on testing and evaluation.
The implemented ray tracer must, as minimum, be designed to show planes and spheres using Phong illumination.
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.
- Make a graphical user interface (GUI) for your program
- Expand on the material properties to include texture, refraction, etc.
- Improve the viewing quality by reducing anti-aliasing.
- Add more types of objects (eg. triangles, ellipsoids and boolean objects)
- Find your own add-on
- 23. of October 16.00-19.00 in room 0.10. Poster presentation of the project.
- 17. of November. Deadline for handing in the project agreement.
- 24. of November. Start of project.
- 19. of December 12.00. Deadline for handing in the project.
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:
- 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.
- After logging on click on Project Base.
- Click on "new project".
- 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
- Click "Save project agreement (common part)" and subsequently
click "approve" in the project agreement - common part field.
- In the field "Participants - individual information " fill in
the fields as follows:
- Project type: "4-week project".
- Size in ECTS: "7.50".
- Project period: "2003-11-24 -- 19 December before 12.00".
- Examination language: <Select the language that you prefer for the
exam.>
- Subject areas: <Select the fields that you would like to cover.>
- Qualifications: <Write the technical courses that you have followed.
E.g. Introductory programming>
- Click "Save individual information" and subsequently click "approve"
under your individual information.
- 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.
- In the field "Supervisor" enter Jakob Raundahl, click "add
supervisor", select "choose" to the left of Jakob Raundahl and
click "add supervisor".
- Finally, click "invite" on Jakob Raundahl.
- 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.
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.
- 1- person groups does a 10 minute presentation, followed by a 10-15 minute examination, summing to 20-25 minutes.
- 2- person groups does a 15 minute presentation, followed by a 10-15 minute examination, summing to 25-30 minutes.
- (3-4)- person groups does a 20 minute presentation, followed by a 15-20 minute examination, summing to 35-40 minutes.
A list of groups will appear later.
Jakob Raundahl, email:raundahl@itu.dk, room 3.20