PTLib is still under heavy development, and is no where near complete. As is, its quite entertaining, but not much of a tool. Currently, rendering is CPU only, and limited to spheres.
Support for meshes, and GPU acceleration are the current goals for this project.
PTLib is a library for the rendering of path traced scenes and objects.
Currently, the library is limited to the tracing of spheres. Other object types such as cubes and meshes are in the works.
PTLib uses OpenMP by default. Be sure the development library is installed, and a supported compiler version is used. Alternatively, build without OpenMP as shown.
make OPENMP=0
PTLib defines every object as a TraceableObject structure. Current, and planned TraceableObjects are shown below.
- Spheres (Implemented)
- Triangular Meshes (In Progress)
- Cubes (Planned)
New objects can be added by providing a properly configuredTraceableObjectstructure. This structure must be configured with:
- A pointer to a function to find the normal vector of any given point.
- A pointer to a function to find the distance to any given point on the object's surface.
- Object properties such as position, emission, color, and material.
For a sphere, these functions can be found in ptl_sphere.c.
Any properties that need to be stored within the object that do not conform to any of the standard members of aTraceableObjectshould be stored in the traceable's properties data structure. By default, this consists of 9 values accessible as v1 to v9. This data can also be accessed as an array by reading from properties.values.
PTLib can load scenes from a scene file (.pts). A scene file is a simple text file describing a singleTraceableObjectobject on each line. Comments may be added with # if desired.
The format is as follows.
<Type> [Position <x> <y> <z>] [Emission <r> <g> <b>] [Color <r> <g> <b>] <Material> [Properties (optional) <p1>...<p9>]
For example, a matte, reddish sphere with a radius of 23.5, at position (10.2, 0, 0) might be:
SPHERE 10.2 0 0 0 0 0 0.75 0.3 0.3 MAT_DIFFUSE 23.5
Note: A sphere's radius is stored within it's p1 property.
Clone this repo, then enter the ptlib directory.
git clone [email protected]:Techmo2/ptlib.git
cd ptlib/ptlib
Run make to build and install the library.
make
sudo make install
An example is provided in the test folder.
Build and run the example after installing PTLib using:
cd test
make
./ptlib-test
The result will be written to output.bmp.
PTLib's functionality is derived from smallpt, written by Kevin Beason, please pay his page a visit :)