README

November 23, 2012 · View on GitHub

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


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


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