-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathREADME
94 lines (61 loc) · 2.95 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94

*[Full blog post about this code is here (screenshots, history, etc)](https://www.thanassis.space/cudarenderer-BVH.html)*
This is a real-time raytracer, supporting .3ds, .ply (ascii) and .tri (binary) formats.
## COMPILE/INSTALL/RUN
### Under Linux
The code has 3 dependencies: You must install...
- OpenGL (with GLEW and GLUT)
- libSDL
- CUDA toolkit
If you are using Debian, the first two are covered with:
sudo apt-get install libsdl1.2-dev libglew1.5-dev freeglut3-dev mesa-common-dev
...and the second is also quite easy - add the `contrib` and `non-free`
collections to `/etc/apt/sources.list` - that is, at the end of your distro's
repository line. In my case, it looks like this after editing:
deb http://ftp.gr.debian.org/debian/ jessie main non-free contrib
...and then:
$ sudo apt-get install nvidia-cuda-dev nvidia-cuda-toolkit
$ dpkg -l | grep nvidia-cuda
ii nvidia-cuda-dev 6.0.37-5 amd64 NVIDIA CUDA development files
ii nvidia-cuda-toolkit 6.0.37-5 amd64 NVIDIA CUDA development toolkit
After installing the dependencies, a simple...
./configure && make && ./src/cudaRenderer 3D-objects/chessboard.tri
...will work.
### Under Windows
Make sure you have the CUDA toolkit installed (I used version 6.0)
Then:
1. Open the cudaRenderer_vc90.sln with your Visual Studio
2. Compile in Release mode
3. Right-click on "cudaRenderer" in the Solution explorer, and select "Properties"
4. Click on "Configuration Properties/Debugging"
5. In the "Command Arguments", enter "..\3D-objects\chessboard.tri" and click OK
6. Hit Ctrl-F5 to run.
You should see a rotating chessboard...
Read below for keyboard control intructions, or just press 'H' for help.
Note: I used the free Visual C++ 2008 Express Edition, but this should work
with the commercial one, too.
## Keyboard controls
Use the following keys to navigate around the object:
- Hit 'H' for help.
- Hit 'R' to stop/start auto-spin (camera rotates around the object).
- Fly using the cursorKeys/A/Z.
- Rotate the light with W/Q.
- S/F are 'strafe' left/right
- E/D are 'strafe' up/down
(strafe keys don't work in auto-spin mode).
- F4 toggles points mode
- F5 toggles specular lighting
- F6 toggles phong normal interpolation
- F7 toggles reflections
- F8 toggles shadows
- F9 toggles anti-aliasing
- ESC quits.
## Misc
Since it reports frame rate at the end, you can use this as a benchmark
for CUDA cards. Just spawn with "-b" to request benchmarking:
(Note: keys don't work in benchmarking mode)
./src/cudaRenderer -b 150 3D-objects/chessboard.tri
This will draw 150 frames and report speed back. With my GT240, it reports:
Rendering 150 frames in 8.117 seconds. (18.4797 fps)
You can also do this easily via:
make bench