Embree is an open source, ray tracing kernels from Intel. It makes ray tracing really fast. But adding it into your project may be a little painful especially you will use it with Qt etc.
I used Embree for my “Precomputed Ambient Occlusion for Animated Meshes” project, and until having a stable project I faced lots of crashes. But, finally it seems I solved the problem, and Embree is working without any problems.
Downloading Embree
Embree has a GitHub page that you can download the latest or old versions of it. It also contains a quick overview about Embree, information about old versions etc. But, I think the fastest way to download Embree is this link.
For Windows, you can use the setup.exe to install it. But, if you prefer to use .zip version, I suggest you to use C:\Program Files\Intel\Embree X.X.X path.
For my project I started with the latest version of Embree, and finally, after I use version 2.5.0 on Microsoft Visual Studio 2013 (instead of 2010), my crushing problems were solved.
Setting Up Embree
After you download, and install/extract Embree, you have to set it up with your project. For this:
- Environment Path: Computer -> Properties -> Advanced system settings -> Environment Variables -> Path (PATH) -> Put the path you install Embree (For example “C:\Program Files\Intel\Embree 2.5.0”)
- Your project: Properties -> C/C++ -> General -> Additional Include Directories -> Include folder of Embree (For example “C:\Program Files\Intel\Embree 2.5.0\include”
- Your Project: Properties -> Linker -> General -> Additional Library Directories ->lib folder of Embree (For example: “C:\Program Files\Intel\Embree 2.5.0\lib”)
- Your Project: Properties -> Linker -> Input -> Additional Dependencies -> Just “embree.lib”
After these steps, you will also need some DLLs. Easiest way to solve it putting this DLLs in the same folder with your debug/release.exe.
After doing everything correctly, you should be able to include Embree headers, and call rtcInit(), and rtcExit() functions:
1 2 3 4 5 6 7 |
// Headers for Embree raytracer #include <embree2\rtcore.h> #include <embree2\rtcore_ray.h> // Embree init, and exit function calls rtcInit(); rtcExit(); |
For creating the scene, adding your vertices and faces, and tracing the scene, you can visit Embree Tutorials page, ReadMe file or code examples.