[my blog] [my software] [contacts]

back to today
 

1 september 2011

Raytracing WebGL experiment

About 10 years ago I wrote a very simple realtime raytracer in C++. It was very slow, I remember I could get decent speeds only when running on very low resolutions (like 320x240).

Last year I was curious to see how a current CPU can handle the same workload. I modified my old code in order to enable multithreading, this way I was able to put in use all the logical cores of my Core i7.
It ran a lot better, but it was still quite slow when running at high resolutions.

My latest HTML5 experiment is inspired by this old raytracer. I'ts not exactly the same code, as I had to rewrite it as a GLSL shader, but it's very close. The result is realtime raytracing running on the GPU, inside a browser.
This version is finally fast enough also at the highest resolutions, on my ATI 5770 I get 60 frames per second with a GPU load of about 35%.

If you have a recent browser and video card you can watch in your browser this experiment featuring realtime raytracing (on the GPU) of 6 spheres and 4 point-lights with shadows.

Here you can also see a video conversion of the same experiment:

 
2011-09-03 23:47:21
Phil wrote:
Vid looks awesome but Chrome 13.0.782.220 on Mac OS X Lion alerts this:

ERROR: 0:46: '.' : syntax error syntax error

2011-09-04 12:48:16
Phil wrote:
Same in Firefox Nightly...

2011-09-04 16:50:52
H3-r3 wrote:
I got the same bug report from another OS X user, it looks like a bug in the OpenGL driver.
I don't have a mac, then It's not easy for me to look for a workaround for this issue :(

Comments disabled