Real-Time Ray Tracing with CUDA I succeeded!

I will contribute again this time though I have the thing contributed here
before.
Because it succeeded in doing animation in real time.
The file of the project of exe and VS2005 is appended and put.
Please see by all means.
RayTracerExe.zip (180 KB)

D3Dx9_37.dll not found … how to solve it ? Would like to check this stuff very much :-)

I removed few DirectX functions.

Please test this appending instead.
RayTracerExe2.zip (172 KB)

CPU version works and renders the image with about 0.64 fps. However, GPU version shows about 90% of the same image with a stride of noise at the bottom of the window and does nothing else.

May be this is due to the weak hardware (I have 8500 GT which I use for experiments) and lack of memory (8500 GT has only 256 MB on board).

Did not you run normally?

It is regrettable.

The memory is hardly used.

Even 8400GS of home : though it moves with 12FPS…

Well - it hangs in my case.

CUDA 2.0Beta2, with appropriate driver, under XP32.

I first tested the CPU executable (the one without directx call) on my windows XP machine… It said “nvcuda.dll” is missing!! (My machine has CUDA 1.1 installed)

I moved the entire contents to the GPU test machine (same winxp with cuda 1.1).

however, the EXE could not even be launched. (some application configuration error was reported!). I used psftp – so no question of binary/ascii thing.

I tried to compile the sources… but again – you have used some custom build rule – I dont have it in my machine in that location! :-(

I am very eager to look into your work! Can you help by reposting?

There must be a tool in windows (like “ldd” in linux) that can tell what all DLL your application depends on OR Probably, you should opt to static linking to avoid any kind of DLL problems!

Let us know!

Thank you for the report.

First of all, I am using SDK2.0β2 of CUDA though it is an environment.

The driver of this version might be indispensable.

CustomBuild is used to compile the code of CPU with OpenMP though it is a source.

The rule of the custom must delete this only if you make only the code of CUDA.

Because DirectX uses it tacit when CUDA uses it tacit, what actually used is not understood about DLL.

When this becomes help of something though it is good.

In order to run the exe files, first you should download the CUDA 2.0 beta tool kit and driver, and then try it again. It worked on my Vista 32 with GeForce 8800 GTX system perfectly.

For example, ave. 2.5 (Max. 2.8) fps for CPU version and ave. 50 fps (Max. 79) for GPU!

Please look referring to the following.

It is likely to solve it possibly.

http://pcsupport.about.com/od/findbyerrorm…9_37dll-dll.htm

Works fine for me.
I have to download the latest drivers off the cuda zone page or else it would hang.
But now it works.
60fps on a 8800gt.

Congrats!

Nice project. What are your plans with this? Was this just an exercise?

Either way, congratulations.

Thanks for your post, that’s a great start! I’ve also started working on a CUDA raytracer for an exercise…but progress has been very slow :p The next step you might want to consider is adding a KD-tree or other similar structure.

For scenes in games with 100k+ triangles, this could be a problem ;)

 for (n = 0; n < NUMOBJ; ++n) {

  	float3 nvec = cross(vector, n, &t, cvec);

  	if (tt > t && t > mi) {

    tt = t; tn = n; lvec.x = nvec.x; lvec.y = nvec.y; lvec.z = nvec.z;

  	}

  }

Thanks again for the post!

I have also implemented a kd_tree (the one with ropes) with nice results. You can find the paper when searching for stackless kd tree.

Thank you!

I have no plan since this is just an exercise for training of CUDA programming.

So, I wanted to know how much the performance of CUDA was.

However, the wonderful performance was able to be experienced as a

result.

guys, you may want to compare it with Kun Zhou’s two siggraph 08 papers “Kd-tree construction” and “BSGP”, which have ray tracing demos.

Hi noridon,

How did u debug your raytracer? I am using directx interops and it won’t let me run the emulation mode with D3DRegisterResource9(). So i switched to using vertex buffers but am still ahving problems getting it to work.

Seb

CPU: .84 FPS
GPU: 40 to 88.90 FPS, average in the 70’s, 60’s near the reflecting object.

Wow. I <3 CUDA.

I’m getting this error

c:\program files (x86)\microsoft directx sdk (february 2010)\include\d3d9.h(2025): warning: nested comment is not allowed
1>c:\program files (x86)\microsoft directx sdk (february 2010)\include\d3d9.h(2026): warning: nested comment is not allowed
1>c:/Users/TOBBETU/Desktop/RayTraceCUDA/RayTraceCUDA/RayTraceCUDA.cu(67): error: invalid redeclaration of type name “double2”
1>c:\program files\nvidia gpu computing toolkit\cuda\v3.2\include\vector_types.h(342): here
1>c:/Users/TOBBETU/Desktop/RayTraceCUDA/RayTraceCUDA/RayTraceCUDA.cu(566): warning: variable “CUerr” was set but never used
1>c:/Users/TOBBETU/Desktop/RayTraceCUDA/RayTraceCUDA/RayTraceCUDA.cu(567): warning: variable “err” was set but never used
1>c:/Users/TOBBETU/Desktop/RayTraceCUDA/RayTraceCUDA/RayTraceCUDA.cu(690): warning: integer conversion resulted in a change of sign
1>1 error detected in the compilation of “C:/Users/TOBBETU/AppData/Local/Temp/tmpxft_000013b8_00000000-8_RayTraceCUDA.compute_10.cpp1.ii”.
1>Project : error PRJ0019: A tool returned an error code from “Compiling with CUDA Build Rule…”
1>Build log was saved at “file://c:\Users\TOBBETU\Documents\Visual Studio 2008\Projects\cuda_test2\cuda_test2\Debug\BuildLog.htm”
1>cuda_test2 - 2 error(s), 5 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I’m getting this error

c:\program files (x86)\microsoft directx sdk (february 2010)\include\d3d9.h(2025): warning: nested comment is not allowed
1>c:\program files (x86)\microsoft directx sdk (february 2010)\include\d3d9.h(2026): warning: nested comment is not allowed
1>c:/Users/TOBBETU/Desktop/RayTraceCUDA/RayTraceCUDA/RayTraceCUDA.cu(67): error: invalid redeclaration of type name “double2”
1>c:\program files\nvidia gpu computing toolkit\cuda\v3.2\include\vector_types.h(342): here
1>c:/Users/TOBBETU/Desktop/RayTraceCUDA/RayTraceCUDA/RayTraceCUDA.cu(566): warning: variable “CUerr” was set but never used
1>c:/Users/TOBBETU/Desktop/RayTraceCUDA/RayTraceCUDA/RayTraceCUDA.cu(567): warning: variable “err” was set but never used
1>c:/Users/TOBBETU/Desktop/RayTraceCUDA/RayTraceCUDA/RayTraceCUDA.cu(690): warning: integer conversion resulted in a change of sign
1>1 error detected in the compilation of “C:/Users/TOBBETU/AppData/Local/Temp/tmpxft_000013b8_00000000-8_RayTraceCUDA.compute_10.cpp1.ii”.
1>Project : error PRJ0019: A tool returned an error code from “Compiling with CUDA Build Rule…”
1>Build log was saved at “file://c:\Users\TOBBETU\Documents\Visual Studio 2008\Projects\cuda_test2\cuda_test2\Debug\BuildLog.htm”
1>cuda_test2 - 2 error(s), 5 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========