Archive for the ‘cudart (ray tracing)’ Category

C / C++ and STL

Wednesday, October 28th, 2009

Before everyone gets really upset with the rest of this post, as is the trend in the OO community…  I thought I’d start, rather than end, with a disclaimer:  I use C++ and STL on a daily basis in my job, although I don’t use all of what stl has to offer it does make coding in c++ much easier. C++ in itself does allow fairly elegant code (if constructed carefully) whilst providing a decent level of code performance. So I do actually like C++ and stl and they make my life at work much better :)

But this blog isn’t about my day job….  It’s about my tinkering with the wonderful world of parallel algorithms and CUDA code.

What a lot of people don’t realize is that you *can* use stl, c++ classes and templates in a .cu file. As long as its client side code you should be fine. I’ve had a few compiler crashes when using stl especially the sort. To sort this out I used the overloaded < operator in your class, don’t try and define a custom < method it will crash the compiler.

(more…)

Oil and Gas

Thursday, April 16th, 2009

Oil and Gas: What a fascinating industry! With all the different technologies and processes involved there is so much to learn.

Why the sudden interest you may ask? Well I may have an opportunity to work for a company involved in supplying software to the oil and gas sector in a part of the UK in which we would very much like to live and doing a job with such a wide variety of interwoven fields is rather appealing. As I have no oil industry experience I have been reading and googling as much as possible.

It seems like the software and technologies required revolve around:  3D visualization and analysis of volumetric data (seismic), construction of data based on field measurements, Geographic Information Systems, GPS, fluid / gas flow simulations in porous media or in hollow volumes, visualization of the strutures (rigs etc), drilling planning and plotting. And I’m sure there are even more things to discover.

(more…)

Qt Revisited

Monday, March 9th, 2009

I managed to find some time to play with Qt this weekend. Firstly, I am rather impressed by the new IDE: While not quite as good as eclipse in terms of editing it seems more stable and uses FAR less memory. It is definately more user friendly than my visual studio 2003 and has a nice auto-complete feature that seems to actually work.

The new widgets and libraries are great if a little large and its pretty quick to whip something together. A nice touch in the IDE is the ability to just drag and drop signals to slots right on the visual layout of the form.

(more…)

Qt 4.5

Friday, March 6th, 2009

As my raytracer is getting more and more complex with lots of dynamic options and movement controls trying to remember keypresses from a command window to turn things off and on is getting increasingly difficult.

The time has come to build a proper interface for the rendering window. Now as I dont want to spend too much time developing this from scratch I thought I’d have another look at Qt (pronounced cute). Its been quite a while and a good few versions since I last used it, and am pleasently surprised at the improvements and additions. As it does offer openGL widget / rendering it is the perfect library to use for my raytracer.  Using openGL and Qt still gives me the option of going cross-platform on the raytracer and as the memory handling / page locked mem is faster on linux this could give a few more fps :)

In short, if you are looking at a C++ friendly interface designer you could do a lot worse than using the new Qt. (http://www.qtsoftware.com/)

Voxels, Dynamic Grids, KD Trees

Thursday, February 26th, 2009

During the course of developing my raytracer I’ve investigated various acceleration structures and made comments on them in previous posts.

My primary focus has been ray tracing of dynamic scenes where you would need to re-calculate the acceleration structure for each frame. As a result of this I ruled out KD-Trees (even SAH partitioned ones) early on and concentrated on methods which could be implemented well in parallel.  The voxel method with fixed maximum object counts served me very well in early implementations.  It is very quick to compute in parallel and its memory accesses on traversal are very kind to a CUDA implementation.  However as the number of objects in my scenes have increased, it has caused problems with this fixed max element voxel structure.  It is possible for the number of element to exceed the maximum in the cell thereby resulting in visual artifacts / lost objects.  Increasing the maximum elements per cell slows down the raytracing stage too much even though the objects are no longer lost.  To overcome this limitation I increased the number of cells in the grid.  Again this works, but slows down the raytracing due to the higher number of voxels needing to be traversed. I was using a mesh of slightly overlapping spheres as they are much quicker to run intersection tests against rather than the standard cube approach.

(more…)

Finally an update!

Thursday, October 9th, 2008

What with work / projects / email / spore, updating the web site has definately taken a back seat recently. The good news is that I have answered every email I’ve been sent so if you haven’t received a reply the chances are my spam filter ate it - just resend or post a comment here if this is the case.

On the project front - have a look at this screen shot…

721 Spheres and 2 lights with 1 level of reflection at +- 14fps

721 Spheres and 2 lights with 1 level of reflection at +- 14fps

I am actually really happy with this as having 8000 objects on the screen only drops the frame rate to +-9. I can still make a lot of optimizations to it but the basic algorithm seems to be working well. Soon it will be time to switch back to triangle meshes and render something useful :) I’ve recorded a short video of it which is available here , unfortunately the screen capture application I use to generate the recording dropped the frame rate by +-6fps…  At the start of the recording I turn reflections on and you will see the (already diminished) framerate drop accordingly. Note that the camera isn’t moving - all the objects are moving.

(more…)

Various updates and a challenge

Tuesday, September 23rd, 2008

The last week and weekend has been really busy with guests staying at our house so unfortunately not much done in the way of coding. Still it’s always good to catch up with old friends. You know you are getting old when you realize that you have had some of your workshop tools and friends longer than not having them….

If you have sent an email in the last week and have not received a reply please be patient I do try and answer each one.

(more…)

New Downloads

Friday, September 12th, 2008

Please visit the cudart downloads link to get the *hopefully* bug fixed versions of cudart for CUDA v1.1 and v2.0.   The v2.0 one also includes the viewport bug fix.

Although the previous versions worked fine on the majority of systems there were issues with any CUDA 2.0 toolkit install / new forceware drivers. Hopefully these are now sorted out.  Please make sure you extract all the files from the zips before you run the .exe’s.

Thanks again to Audun for his help on this one. Its nice to see that there are still people out there who know how to use a debugger in native mode.

Bug Fixes

Thursday, September 11th, 2008

While working on my much talked about acceleration structure I have kept noticing artifacts and distortions as soon as it is applied to the scene. This has had me rather stumped for two days as the code / raw output seemed correct. Finally it occured to me to check my scene code and in particular my viewport code.

As it turns out my viewport code has been flawed since I converted from purely triangles to include spheres. Here is a new screenshot showing the improvement in the image quality now that its been fixed. You will also notice that you can clearly see the spiral reflected in the sphere as well as the red light that is behind the viewer (have to look closely for this one). The image is scaled down from the original size in order to save a bit of bandwith - lots of traffic from nvidia site :) 

 

After bug fix of viewport code

After bug fix of viewport code

I am yet to fix the downloadable version (downloads section) but will do so tonight.

Acceleration of ray tracers on CUDA 1.1 devices

Wednesday, September 10th, 2008

As those of you who follow the blog will know, I have been working on an acceleration mechanism for my raytracer over the past week.

As it turns out converting my large stack of A4 sheets of diagrams and equations into proper code has not been as easy as I had hoped. With about a third of it implemented I am getting no speed up what so ever on cudart. In fact I have lost about 2fps. This is largely to be expected as I am pretty much hitting the limits of what my card can do.

(more…)