https://github.com/halcy/openclpt
A simple OpenCL path tracer with spheres and mixed glossy/specular + diffuse + emission material
https://github.com/halcy/openclpt
Last synced: 10 months ago
JSON representation
A simple OpenCL path tracer with spheres and mixed glossy/specular + diffuse + emission material
- Host: GitHub
- URL: https://github.com/halcy/openclpt
- Owner: halcy
- Created: 2013-10-04T21:21:21.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2014-02-13T22:25:46.000Z (over 12 years ago)
- Last Synced: 2025-03-31T08:51:15.334Z (about 1 year ago)
- Language: C
- Size: 8.16 MB
- Stars: 12
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
OpenCLPT
==========
A simple OpenCL path tracer with interactive preview.
Command line options (Mandatory, see also included .bat files):
openclpt.exe
[window width] \
[window height] \
[speedup grid extent] \
[scene file] \
[material file] \
[samples per kernel invocation] \
[camera initialization file]
Controls:
* Tracing:
* Y to pause path tracing
* X to resume path tracing
* Movement:
* L to lock/unlock camera
* Mouse to look
* WASD to move around
* Q/E to go up/down
* Preview and Output:
* f/g, 1/2 through 7/8: Decrease / Increase brightness slightly -> strongly
* B to dump current frame buffer to bitmap file
* K to dump current camera position and orientation to file
* Post-filtering:
* V: Activate bilateral filter
* C: Deactivate bilateral filter
* Misc:
* P to pause everything for a second
* Escape to quit
To make, open the .sln file in Visual Studio and compile, everything
that is required should be included in the repository. Currently,
only windows is supported, but most of the code (everything that is
not user input handling) is platform independent and should work on
any platform with a new enough OpenGL.

The path tracer is relatively simple and straightforward, paths are traced
using standard monte-carlo path tracing with russian roulette termination.
Tracing is accelerated using a regular grid data structure pre-computed on
the CPU (Precomputation should only take a few seconds even for complex
scenes).
The input file format for scenes and materials is a variant of the obj/mtl
format: For the scene itself, the format is a subset of obj - only triangles
with vertex normals are supported. Material names must be numeric. For the
scene to be the right way around, -Y should point up and -Z should point
forwards.
The material format is as follows:
m [material number]
a [albedo r] [albedo g] [albedo b]
e [emissive r] [emissive g] [emissive b]
p [specularity (0 to 1)] [transparency (0 to 1)] [specular quality]
The albedo is simply the colour of the material, the emissive colour is the
colour of light emitted. Specularity gives how much of the material is
specular / transmissive. Transparency gives how much of the specular
part is transmissive. The specular quality controls the glossiness of
the material - higher means more perfect reflections. See the included
material library for some examples.