Skip to content
/ openclpt Public

A simple OpenCL path tracer with spheres and mixed glossy/specular + diffuse + emission material

Notifications You must be signed in to change notification settings

halcy/openclpt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Screenshot

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.

About

A simple OpenCL path tracer with spheres and mixed glossy/specular + diffuse + emission material

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages