CUDA Raytracer update, now comes with OpenGL flavour

Well I’ve been busy with my raytracer again and this time I added OpenGL support and a camera. What I do is:

  1. make an OpenGL pixel buffer
  2. bind it to CUDA
  3. run the raytracer kernel which fills the buffer
  4. give it back to OpenGL
  5. generate a texture from the buffer
  6. set up orthogonal view
  7. render a quad with the texture on it

The results:

Suzanne raytracedand to show that the camera works (somewhat):

Suzanne from a different angleFor those who want to combine CUDA and OpenGL is highly recommend watching this video.

Setting up a git server in Ubuntu with gitosis and using gitextensions on Windows

When writing code, you want to use some sort of version control system. Trust me, you want it. I had a project I worked on for 4 weeks and a couple of hours before the deadline I mad a mistake. I was making a class diagram from existing code and realized that a certain UML tool thinks it’s a good idea to delete a class from the project folder when you decide that you don’t want that particular class in your diagram. I guess that makes sense… on a planet where all software developers are masochists.  Anyway, that little mistake could have been a serious problem (and a simple “Oops, sorry I deleted all the code by accident, kthxbye” wouldn’t have cut it), but luckily I had it stored in my dropbox folder which backs everything up on the dropbox servers and they provide an ‘undelete’ option.

I’ve been trying to setup a git server on my server which runs Ubuntu Server 9.10, but I had a lot of problems partly due to the fact that I couldn’t find a lot of information when something went wrong. But I’m a stubborn person so I persevered and succeeded in the end. This post is for those who want to setup a git server on Ubuntu and want to use git on Windows, especially with Git Extensions. This tutorial consists of two parts: setting up the server and setting up gitextensions on Windows, but there will be some switching between the server and the local Windows machine so please pay attention.

There are a lot of tutorials that cover setting up a git server but this one is a full guide to setting up a git server and the tools necessary to work with git on Windows. It also has some information I found on some mailing lists and forum posts that I found after a lot of searching. Still I take no credit for this tutorial for it is merely a collection of information I found. All credit goes to the people who actually tested these steps and bothered putting it on the internet for other people struggling with this. I try to explain everything as thorough as possible so it is a lot of text, but it’s not hard. Just read carefully and you will have git running in no time!

Read more

How to use usbhostfs_pc as non-root

I had some problems on Ubuntu with running usbhostfs_pc as non-root. I searched for an answer and finally came across a solution.

1. First go to System->Administration->Users and Groups, type in your root password and you should get to a screen with all of your users. Now click on the ‘Manage Groups‘ button and then on the ‘Add Group‘ button. Type ‘psplink‘ in the Group name section and select your user in the Group Members section. Click on Ok and then twice on Close. Now you have to logoff and log back in for your user to be added to the new group. You can also do this with terminalcommands but quite frankly I forgot how the commands work (since I don’t add groups and users on a regular basis) and I was too lazy to find out how they work again, so that’s why I chose the GUI-approach.

Read more

How to setup the psp toolchain on ubuntu

[UPDATE] If you want to setup the psp toolchain I recommand using MINPSPW. It supports Windows, GNU/Linux and OpenSolaris and is much easier to setup. You can of course still use this tutorial if you like.

I know that there are some guides out there how to setup the psptoolchain but when I followed them I still had problems compiling SDL programs. So here is my guide to installing the psptoolchain and psplibraries on Linux. I figured these out by myself and with the help of J.F.’ post on the ps2dev forums, so my thanks to him. I assume that you have basic shell knowledge like how to make a folder and how to change folders and stuff like that.

Read more

OguTracer

My raytracer so far is very simple. It uses no acceleration structures and the scene is static. Earlier versions ran on the CPU, but now I use Cuda to use the enormous floating point processing power of my GPU which shortened my rendering times a lot.

The raytracer loads a mesh from a 3DS Max  file, puts a ‘room’ around it and renders the scene using only primary rays. Here is an example:

Raytracer output

Raytracer output

The scene above consists of 1034 triangles and renders in 0.693 seconds on my Geforce 8600GT. My CPU needs around 10 seconds to render the same scene with the same detail so using the GPU is much faster.

Right now I’m in the process of implementing a BHV acceleration structure to make rendering faster. What it basically does is, it puts a bounding box around the mesh and then divides the mesh into two smaller bounding boxes. This process is repeated until some conditions are met (i.e. maximum depth reached) or when each bounding box contains a single traingle. This speeds up rendering because now the rays are checked against the bounding boxes instead of the triangles, and the bounding boxes that do not intersect with the ray don’t have to be checked.

My new blog

I used Joomla before but it offers me too much options, so I switched to Wordpress. Hopefully I’ll be able to post some usefull information about the projects I’m working on :)

I will ‘port’ the posts on my old website to my blog in a short while.