A 3D ray tracer implemented from scratch in Java, developed as a joint Software Engineering course project by Noa Aizen and Noga Jacobs. It uses no graphics libraries: rays, intersections, lighting and pixels are all computed by the project's own code.
- Geometry: ray intersection for spheres, planes, triangles, polygons and circles
- Lighting: ambient, directional, point (distance attenuation) and spot lights
- Shading: Phong model with diffuse, specular, shininess and emission
- Shadows: hard shadows, lighter shadows behind transparent objects, and optional soft shadows
- Global effects: recursive reflection and transparency, with a depth limit and a contribution cutoff
- Image quality: anti-aliasing (multiple rays per pixel) and adaptive super sampling that subdivides only pixels whose samples differ
- Performance: multithreaded rendering with a shared pixel work queue and a progress indicator
- Scenes: fluent Java builder API, plus basic XML scene loading
- Tests: JUnit 5 tests for the math core and intersection algorithms
Cameracasts a ray through each pixel (or several rays per pixel, when sampling is enabled).RayTracerBasicfinds the closest intersection among the scene's geometries.- Local effects add emission and, for each light, diffuse and specular terms, scaled by a shadow-ray transparency factor.
- Global effects trace reflected and transmitted rays recursively, up to 10 levels, stopping early when the contribution drops below 0.001.
ImageWriterwrites the final colors to a PNG.
| Package | Responsibility |
|---|---|
primitives |
Point, Vector, Ray, Color, Material, and floating-point helpers |
geometries |
Intersectable base class, the Geometries composite, and the shapes |
lighting |
Ambient, directional, point and spot lights |
renderer |
Camera, RayTracerBasic, ImageWriter, and Pixel (thread work distribution) |
Scene, parser |
Scene with its SceneBuilder, and the XML scene descriptor |
Design patterns used: Builder (SceneBuilder), Composite (Geometries), Template Method (findGeoIntersections → findGeoIntersectionsHelper), and fluent setters.
| Without improvements | Soft shadows and anti-aliasing |
|---|---|
![]() |
![]() |
| Reflection | Transparency and shadow | Spot light | Soft shadows |
|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
There is no build tool yet. The project targets Java 17, and the JUnit 5 jars are in lib/. In IntelliJ IDEA:
- Open the folder as a project.
- Mark
src/as Sources Root andunitTests/as Test Sources Root. - Add
lib/as a project library. - Run a test class. Renders are written to
images/.
unitTests/ contains 53 JUnit 5 test methods:
- Math core:
VectorTestandPointTest. - Geometry:
SphereTest,PlaneTest,TriangleTest,PolygonTests,TubeTestandGeometriesTests, covering normals and intersections with equivalence-partition and boundary cases. - Camera:
CameraTestsandIntegrationTestscheck ray construction and intersection counts. - Rendering: the rendering tests generate images for visual inspection. They do not assert on pixel values.
src/ primitives, geometries, lighting, renderer, Scene, parser
unitTests/ JUnit 5 tests
lib/ JUnit 5 jars
docs/images/ showcase renders
images/ render output (git-ignored)
This project was developed as an academic Software Engineering project and some components remain incomplete:
- Tube and Cylinder ray intersections are not implemented.
- Some rendering and sampling components have known limitations that can be improved in future iterations.
- Some original course tests require environment-specific adjustments.
- The project currently uses local JUnit dependencies rather than Maven or Gradle.
- Noa Aizen and Noga Jacobs: design and implementation, developed together.
- Dan Zilberstein (course lecturer): the course starter code, including
Main.java, the originalPolygonclass, and the base test scenes inPolygonTests,CameraTests,RenderTests,LightsTests,ShadowTestsandReflectionRefractionTests, which the authors extended.
Created for the Introduction to Software Engineering course.





