First raytraced online game
The first time when I heard about raytracing was about 3 years ago. I was fascinated, though, I had absolutely no idea how it works. It seemd to me like some kind of magic.
I was attending 2 courses of computer graphics and a course about hardware and rasterization during the past year, so now I know a little bit of this magic .I decided to write my own simple raytracer from the scratch.
There is a rectangular floor and two balls on it. When you click “Start”, balls start to move and try to roll over you. You have to run away using cursor keys (or jump over the ball using spacebar).
There is a static texture of outer environment. Balls and floor are shaded using Phong model. There are two levels of ray “recursion” (just two calls of function, recursive functions are not allowed in GLSL).
I have an average 3 years old laptop and Windows OS. I could run the demo at 60 FPS at Medium size and 43 FPS at Large size.
I really wanted to add much more interesting objects and effects into the game. But unfortunatelly, it was starting to be really slow (30 and less FPS). There are some new technologies – OpenCL or CUDA – which allow us to use GPU more efficiently than through shaders. There even is a new standard called WebCL, but sadly, currently it is not implemented in any official release of any browser.