The insanity! But I dared and wanted to see what can be achieved with a simple raytracing engine and a Java2D rendering backend (Java2D isnt’t the bottleneck here, as it turned out).
Edit start
Latest demo without shadows:
http://www.java-gaming.org/user-generated-content/members/132627/simpleray-r5.jar
Latest demo with shadows:
http://www.java-gaming.org/user-generated-content/members/132627/simpleray-r6.jar
Edit end
The results are surprising - realtime raytracing of simple scenes might be possible with Java on current computers. The preview doesn’t look like much, but textures won’t cause a big slowdown, and the two spheres have mirror surfaces, so the core features of raytracing, reflection and refraction seem to be doable. Lightsources and shadows will cause a slowdown though. For this scene, I’d estimate 30% slowdown for each additional light source. I’ll find that out soon. In the demo the balls circle around the center of the checkerboard plane, so there shouldn’t be any caching messing with my timings since each frame is different from the former.
Using one thread on a 2.5 GHz core i5 I get about 30FPS with my current code and three scene elements (two reflective) and 800x600 pixels.
I hope I can optimize the tracer itself some more, and when using all (virtual) cores of the CPU there might be a speedup of 3 or more in reach, which is looking promising.
I hope to get a little graphics demo out of this, wanted to do something like that since a while