Skip to content

Jake-Baugh/raytracer-gpupro4

 
 

Repository files navigation

Download Models: https://dl.dropbox.com/u/3120756/Models_GPUPro4.zip

// ================================================================================
// The authors of this code (Sergio Murguía, Francisco Ávila, Leo Reyes and Arturo
// García) hereby release it into the public domain. This applies worldwide.
//
// In case this is not legally possible, we grant any entity the right to use this
// work for any purpose, without any conditions, unless such conditions are
// required by law.
//
// This work is provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
// ANY KIND. You are solely responsible for the consequences of using or	
// redistributing this code and assume any risks associated with these or related
// activities.									
// ================================================================================

---------------------------------------------------
Interactive Ray Tracing Using the Compute Shader
---------------------------------------------------
Sergio Murguía, Francisco Ávila, Leo Reyes and Arturo García
August, 2012

---------------------------------------------------
ABOUT THE DEMO
---------------------------------------------------
If you find bug or have further comments, suggestions or questions, please send an email to me@francisco-avila.com

This application is not a product, it is just a demo. It started as a simple experiment and it does not follow the best software engineering practices. However, you may suggest improvements to its design.

---------------------------------------------------
REQUIREMENTS
---------------------------------------------------
* GPU supporting DirectX 11.0 or higher (If not, the RT will run using the reference driver)
* DirectX SDK June 2010 or newer (http://www.microsoft.com/en-us/download/details.aspx?id=6812)
* Visual Studio 2008 and its SP1 (http://www.microsoft.com/en-us/download/confirmation.aspx?id=10986)
* gtkmm Win32 installed on C:/ (http://ftp.gnome.org/pub/GNOME/binaries/win32/gtkmm/2.22/)

---------------------------------------------------
INSTRUCTIONS
---------------------------------------------------
* "Framework" must be set as default project.
* The demo will load the Crytek Sponza per default
	- Raytracing mode
	- SLBVH built on CPU
* To enable GPU building of the SLBVH on each frame
	- Go to conf.ini, set dynamic=1
	- To disable GPU structure bulding, unset dynamic=0
	- Use a small scene, such as ring.obj (Max num of primitives < 262,144)
* To enable globall illumination
	- Go to App.hlsl and uncomment #define GLOBAL_ILLUM
	- Press the Num Pad '+' key to increase the number of reflected rays (you need to do this at least once).
* Switch acceleration structure
	- disable dynamic building: go to conf.ini and dynamic=0
	- go to conf.ini and set: acceleration_structure=bvh
* You can ignore the variables not mentioned in this section in conf.ini
* The Sponza model is for raytracing mode.
* ring, mini_obj and diamond test are for global illumination mode.
* You can rapidly switch the position of the camera with the keypad numbers.
* The light is at the origin, you can change it in RaytracerCS.cpp, with iLightChoice=0

---------------------------------------------------
ACKNOWLEDGMENTS
---------------------------------------------------
The authors would like to thank the Stanford Computer Graphics Laboratory for the Happy Buddha, the Stanford Dragon and the Stanford Bunny models; the Bangor University for the Welsh Dragon model (released for Eurographics 2011); Crytek for its modified version of the Sponza model; and Matt Pharr and Greg Humphreys for their permission to base the BVH implementation on the PBRT framework.

Special thanks to Julio Zamora for his advice on using the Compute Shader for ray tracing and Alberto Castrejon for reviewing the article.

---------------------------------------------------
NOTES
---------------------------------------------------
* The OBJ loader was downloaded from http://www.dhpoware.com/demos/glObjViewer.html which is a OpenGL OBJ Viewer Demo. We are parsing data which was already parsed by this library (practical, but not efficient).
* We tried to load Soda Hall, but the application crashes, the biggest model we loaded was Welsh Dragon with 2.1M triangles. If you load a bigger model, we would like to hear about: gpu.raytracing at gmail dot com
* We included the necessary files in order to use the BVH used in the PBRT framework: https://github.com/mmp/pbrt-v2. We encourage you to visit its webpage: http://www.pbrt.org/ and read the acceleration structures chapter: http://pbrt.org/pbrt-2ed-chap4.pdf. We are including the PBRT license on the file PBRT_LICENSE.txt.
* The Crytek Sponza model is available at http://www.crytek.com/cryengine/cryengine3/downloads.
* The Stanford repository has many available models at http://graphics.stanford.edu/data/3Dscanrep/
* The Welsh Dragon model can be downloaded at http://eg2011.bangor.ac.uk/dragon/Welsh-Dragon.html
* Since our RT just supports OBJ models, you can use MeshLab (or other software) to export your PLY models (or other extensions as well) to OBJ. You can ignore the normals data since the OBJ loader automatically calculates it. Mesh Lab is available at http://meshlab.sourceforge.net/
* The environment map was taken from the DirectX SDK at C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Samples\Media\Light Probes

---------------------------------------------------
KEYBOARD/MOUSE SHORTCUTS
---------------------------------------------------
Mouse: Rotate camera (left click on press)
ESCAPE: Quit
F4: On/Off Camera orbit mode
W: Move camera front
S: Move camera back
D: Move camera right
A: Move camera left
Q: Move camera down
E: Move camera up
F: Phong/Flat shading
K: On/Off shadows
M: On/Off environment mapping
G: On/Off gloss mapping (If it is off, reflections will be off)
N: On/Off normal mapping
L: Recompile and reload shaders (useful for debugging)
Space: Take screenshot
Num pad 0-8: Change cameras
Num pad minus: Decrease number of reflections
Num pad plus: Increase number of reflections
Ctrl + Arrow up: Increase camera speed movement
Ctrl + Arrow down: Decrease camera speed movement
Ctrl + 0 (Num pad): Set light zero (use this for bunny)
Ctrl + 1 (Num pad): Set light zero (use this for sponza)
Arrow up: Rotate camera 22.5 degrees on x-axis
Arrow down: Rotate camera -22.5 degrees on x-axis
Arrow right: Rotate camera 22.5 degrees on y-axis
Arrow left: Rotate camera -22.5 degrees on y-axis
Home: Rotate camera 22.5 degrees on z-axis
End: Rotate camera -22.5 degrees on z-axis

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 89.9%
  • C 10.1%