Home > Path-Tracer

Path-Tracer

Path-Tracer is a project mainly written in JAVA and COMMON LISP, it's free.

Java based Path Tracer

Daniel Krisher github.com/krisher/Path-Tracer

System Requirements

Any system with JavaSE 1.6 (6.0) or later. Apache Maven 2.2.1 (earlier versions may work) is required to build from source.

Building

The source code is 100% Java, and can be built with Apache Maven.

Run 'maven package' from the top level directory (where this file is found). The build process will create a target/path-tracer-0.9-SNAPSHOT-jar-with-dependencies.jar file that only depends on a Java runtime environment.

Running

The jar file includes a manifest describing the main class and library dependencies. Just run:

java -jar path-tracer-0.9-SNAPSHOT-jar-with-dependencies.jar

from within the dist/ directory. While the raytracer itself uses very little memory, increasing Java's maximum heap size can reduce the load on the garbage collector, and increase performance. You can run something like:

java -Xmx1024m -jar path-tracer-0.9-SNAPSHOT-jar-with-dependencies.jar

The application will start with a simple UI. Follow these steps to use the application:

Enter the ray tracing parameters:

  • image width/height
  • sample rate (actual number of samples per pixel is this value squared) (typically 1 is OK for a quick test, 10 for an OK but noisy image, 20-30 for a good image, 80-100 for a really good image).
  • maximum recursion depth (0=>eye rays only, for most sample scenes there is little noticable change after about 16 bounces, but 6-8 usually produces good results)

Select a scene from the list.

Press Start. The image will render into the panel to the right of the controls. A progress bar next to the Start button will show the ETA of the completed image.

Once this has completed, you can use the Tone-Mapping controls near the bottom left of the window. Pick a TR operator, and/or modify the midpoint gray value (for Reinhard), and the image to the right will be immediately updated. The original image is preserved so you can change the tone mapping as many times as necessary without re-tracing the scene. You can also specify a desired white-point (as a luminance value), the image will be scaled so that pixels at or above this luminance value map to white, leaving greater range for the darker portions of the image (from Reinhard paper). When using the Reinhard operator/algorithm, you can double click an image pixel to select the corresponding luminance value as the white point.

Finally, press Save to save a copy of the image currently displayed in the UI to a specified png file.

Third-Party Libraries

This project uses MiGLayout for the user interface (miglayout.com).

Major Features:

Engine:

  • Complete Monte-Carlo Path Tracer
  • Mostly complete photon tracer.
  • More or less energy conserving (errors have come and gone...)
  • Multi-threaded (one thread per processor with multiple work items in shared work queue, each corresponding to a small region (64x64px) of the image. This scales nearly linearly with number/speed of CPUs.

Material:

  • Material Interface allows many different materials to be defined and combined:
    • BRDF/BTDF (Implementations for Specular BRDF, Diffuse, Dielectric Refraction BRDF (with extinction)x and Composite that allows mixing of BRDF/BTDF with specified probabilities)
    • Measured data. It works, but has only been tested against a couple of the measured BRDF data sets from Cornell.
    • Emissive (Basic emissive color)

Geometry/Scene:

  • Simple scene description (lists of geometry and light sources). This was slightly more sophisticated in an earlier implementation, however a full scene graph was not really necessary for this assignment, and I did not have time to maintain it to keep up with other changes in the ray tracer.
  • Geometry for boxes (with arbitrary orientation), Spheres, and Triangle Meshes.
  • KD Tree acceleration structure with surface-area-heuristic based partitioning (median can be used instead if desired)

Lights:

  • Point light with specified emssion power
  • SphereLight with importance sampling for direct illumination calculations

Camera:

  • PinholeCamera
  • DoFCamera for depth of field with specified aperture and focal plane distance.

Imaging:

  • All radiance calculations done in unbounded (single-precision) float values, nothing is clamped or compressed until the final tone-mapping stage.
  • Ward and Reinhard tone mapping operators (with user-specified midpoint for Reinhard, and max-luminance scaling for both).

Source Code

Eclipse .project/.classpath files are provided so this can easily be imported into the IDE as an existing project. All of the application source code is contained in src/main/java. 3rd-party libraries are in lib/.

The application's main class is edu.rit.krisher.ui.RTDemo, which defines the scenes that are available for ray-tracing, and launches the main UI.

Previous:Ctrl