8000 GitHub - edap/ofxRayTracer: A Ray Tracer in openFrameworks
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

edap/ofxRayTracer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ofxRayTracer

A Ray Tracer in openFrameworks

current

This ray tracer implementation was written as exercise for this online course, 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

Usage

You need to set up a scene

shared_ptr<ofImage> image;
ofxAssimpModelLoader modelCornell;
vector<of3dPrimitive> primitives;
vector<ofLight>	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

ofxRTPinholeCamera camera;
shared_ptr<ofImage> 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 there are my notes written while I was writing the renderer

TODO:

  • colors
  • multithread
  • indirect rays
  • colored shadows
  • antialiasing

About

A Ray Tracer in openFrameworks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0