https://github.com/edap/ofxraytracer
A Ray Tracer in openFrameworks
https://github.com/edap/ofxraytracer
Last synced: over 1 year ago
JSON representation
A Ray Tracer in openFrameworks
- Host: GitHub
- URL: https://github.com/edap/ofxraytracer
- Owner: edap
- Created: 2017-08-16T06:10:11.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2020-02-10T19:12:10.000Z (over 6 years ago)
- Last Synced: 2024-10-11T00:25:23.416Z (over 1 year ago)
- Language: C++
- Homepage:
- Size: 2.56 MB
- Stars: 11
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ofxRayTracer
A Ray Tracer in openFrameworks

This ray tracer implementation was written as exercise for this [online course](http://graphicscodex.com/projects/rays/index.html), course prepared by prof. Morgan McGuire.
It is intended for personal use. It provides a way to load an `.obj` file through the `ofxAssimpModelLoader` and render it.
### Requirements.
You need to install tbb. On MacOS, follow this [answer on SO](https://stackoverflow.com/questions/45884514/what-are-xcode-8-environment-variables-to-run-intel-threading-building-blocks)
### Usage
You need to set up a scene
```cpp
shared_ptr image;
ofxAssimpModelLoader modelCornell;
vector primitives;
vector lights;
ofNode centerOfTheScene;
modelCornell.loadModel("CornellBox-Original.obj", 20);
// set up a scene
centerOfTheScene.setPosition(0, 0, 0);
// set the lights
ofLight light;
light.setPointLight();
light.setPosition(0, +0.5, -3.0);
lights.push_back(light);
// read the models and fullfill the primitives vector
ofxRTMeshHelper::readModelAndGetPrimitives(modelCornell, primitives, centerOfTheScene);
// position the primitives
centerOfTheScene.move(0, -1, -3);
```
and this is how you launch the render
```cpp
ofxRTPinholeCamera camera;
shared_ptr image;
image->allocate(800, 600, OF_IMAGE_COLOR);
ofxRayTracer rayTracer = ofxRayTracer(primitives, lights);
rayTracer.traceImage(camera, image);
```
Have a look at the `example-cornellbox` app.
On this [file](NOTES.md) there are my notes written while I was writing the renderer
TODO:
- [x] colors
- [x] multithread
- [x] indirect rays
- [x] colored shadows
- [x] antialiasing