A monte-carlo bidirectional path tracer written in Haskell.

asaldanha 79171538fa Format readme better-er-er-er-er-er. 1 year ago
envmaps a9136a740f CookTorrance 4 years ago
models e98feb1e9b Add readme file with instructions and reference the license. 1 year ago
papers 744355ae03 Organize model files. Add all missing files referenced in Resources.hs 2 years ago
screens 6a1442ad62 Add some scenes and code to create a camera HUD. 2 years ago
shaders bb6291896a Normal shaders required for rendering vertex normals in the preview viewport. 2 years ago
sponza 7c2620e11b Add cook torrance shading. Add resource files to respository. 4 years ago
stanford_buddha 7c2620e11b Add cook torrance shading. Add resource files to respository. 4 years ago
textures 744355ae03 Organize model files. Add all missing files referenced in Resources.hs 2 years ago
views 744355ae03 Organize model files. Add all missing files referenced in Resources.hs 2 years ago
.hgignore a387f359b0 Remove redundant brackets / dos and follow hlint in almost all cases. 4 years ago
Benchmarks.hs 6686141d46 - Fix caustics for rectangular images. 2 years ago
Bounce.hs 6686141d46 - Fix caustics for rectangular images. 2 years ago
CookTorrance.hs 6686141d46 - Fix caustics for rectangular images. 2 years ago
Filter.hs 0e9c2b695e Convert to Scalar so that we can change types just like linear. \nNew factor for bsdf of 1/pi.\nProper normals in preview. 4 years ago
Graphics.hs 6a1442ad62 Add some scenes and code to create a camera HUD. 2 years ago
Intersect.hs 6686141d46 - Fix caustics for rectangular images. 2 years ago
KDTree.hs 6686141d46 - Fix caustics for rectangular images. 2 years ago
LICENSE a3e58b7f5e Add MIT license, preparing for release of the software. 2 years ago
Light.hs 48c4426a00 Fix billinear filtering after clean-up. Add two new scenes. 2 years ago
Main.hs 6686141d46 - Fix caustics for rectangular images. 2 years ago
Mesh.hs 6686141d46 - Fix caustics for rectangular images. 2 years ago
Muli-Light.ttf ef0af69871 Add GL preview mode before render, which also computes an initial view for the renderer. 4 years ago
Muli-SemiBold.ttf ef0af69871 Add GL preview mode before render, which also computes an initial view for the renderer. 4 years ago
Obj.hs 6686141d46 - Fix caustics for rectangular images. 2 years ago
ParallelImageMap.hs 21eaa45261 Move some functions to new files, and generalize some functions. 4 years ago
PathSampler.hs 48c4426a00 Fix billinear filtering after clean-up. Add two new scenes. 2 years ago
README.md 79171538fa Format readme better-er-er-er-er-er. 1 year ago
RandomDistributions.hs 6686141d46 - Fix caustics for rectangular images. 2 years ago
Raytracer.hs 6686141d46 - Fix caustics for rectangular images. 2 years ago
Resources.hs 6a1442ad62 Add some scenes and code to create a camera HUD. 2 years ago
Scene.hs 48c4426a00 Fix billinear filtering after clean-up. Add two new scenes. 2 years ago
Scenes.hs 6a1442ad62 Add some scenes and code to create a camera HUD. 2 years ago
Util.hs 6686141d46 - Fix caustics for rectangular images. 2 years ago
Vect.hs 0e9c2b695e Convert to Scalar so that we can change types just like linear. \nNew factor for bsdf of 1/pi.\nProper normals in preview. 4 years ago
pths.cabal 2ad8549fc1 Fix normals--large bug from precomputation work; Visibility function doesn't need to check sided-ness; Properly sample area lights; Probability function always works in the direction of the sampling; Add method to render only certain path lengths; Change w_st to 1.0 until it actually works; simplify shadeProductOfPaths; Add path pretty printing functions; Add a cornell scene with just the walls. 2 years ago
stack.yaml 2ad8549fc1 Fix normals--large bug from precomputation work; Visibility function doesn't need to check sided-ness; Properly sample area lights; Probability function always works in the direction of the sampling; Add method to render only certain path lengths; Change w_st to 1.0 until it actually works; simplify shadeProductOfPaths; Add path pretty printing functions; Add a cornell scene with just the walls. 2 years ago
stanford_buddha.zip 7c2620e11b Add cook torrance shading. Add resource files to respository. 4 years ago

README.md

Pths

A bidirectional monte-carlo path tracer based on Veach's original thesis.

Installation

You can use stack to build the application.

$ stack build -j8

Command line flags

Running the application.

$ stack exec pths -- --reso 1900x800 --scene "porcellino" +RTS -N13

 `--reso[lution]` specifies the resolution as a <width>x<height
 `--scene` specifies one of the pre-built scenes
 `+RTS -N` at the end of the command line specifies the number of threads

There are some other undocumented parameters, but they are yet to actually function.

Manual

Initially, the scene will be loaded, and a kd-tree will be constructed, and all transformations in the scene will be baked in.

You will then see a window appear with your scene. You can move the position of the camera with wasd, adjust the direction of the camera with the mouse. Drag the mouse to change the orientation of the camera, and dragging directly left and right will adjust the yaw, dragging directly up and down will adjust the pitch, and you can drag circles to adjust the roll.

Here's a reference for roll, yaw and pitch.

When you're ready, take an image with the space key. The progress will show up on the bottom with a black image--when the progress bar makes its way to the other side of the screen, one sample is complete.

The internal parameters of the simulation have to be adjusted in PathSampler.hs at the moment--the total camera and light paths are adjustable. You can move the mouse around to inspect the color of the pixel at that location.

Finally, you can escape the application using the ESC key.

Custom scenes

Everything is avaiable to support scenes from the disk, except a simple loader from the disk hasn't been written yet. This may change if I find some time, but unfortunately it wont' change for the forseeable future.

To create a custom scene, simply build the application with a new scene.

See the examples in Scenes.hs--you can add meshes, apply materials with textures to those meshes, and add environment maps.

At the end of Scenes.hs will be a list of mappings from a identifier specified by ==scene and the actual variable holding the Scene.

Support / Commercial Use

If you're interested in using this for your commmercial project and need support, please don't hesitate to contact me. You can find my contact details at asaldanha.com/resume.html.

If you're using this for a non-commercial project or for personal use, I'd be happy to support you for free, but obviously I can't make any guarantees. I will take feature requests and bug reports, if I have time I can fix them.

License

You can find the license and associated copyright at the root of the project, in the file called "LICENSE".