Java real-time raytracing (?)

Hello,

Today I’d like to present an idea I had several months ago :
I wanted to start a new little software rendering engine (yes, I already did JavaGL …) When appears to me a new data structure which allows the possibility to find very fast the collision segment/mesh (no matter the number of polys).

So I applied it in a first test-applet providing simple raytracing (there are still rendering defaults) :
http://javagl.sourceforge.net/demos/JSoftRay/raydemo.html (sorry for the ridiculous screen size ;D )

The main disadvantages of this structure, as you will see, are its weight in memory and its building time, but maybe it can be a way to reach soon, with the hardware progresses, a true real-time raytracer…

If I let myself dream, I can even think about a material acceleration of this structure.

So I have 2 questions :

  • How is the framerate on your machines, according to the rendered options (reflects, shadows) ?

  • Do you find the enterprise pertinent enough to be developed (depends a little on the 1st question ;D ) ?

If that is truely raytracing each frame, bravo !!!
As a math geek I’ve always been interested in raytracing.

I didn’t see any FPS printed, but it was choppy and appeared to be about 3-4 FPS, whether shadows or reflections were on or not.
I have an old Dell Dimension @ 2.1GHz, WinXP Home Edition 2002 SP3.
I’ll run at work (newer faster computer) on Monday and let you know.

Ed

The framerate is perfect, with either of the options.

I note that there is a rendering problem when both are on (a non textured triangle shape moving in the shadow).

This is definately pertinent, keep working on that, this is good work. =)

Good luck,

Miaow.

Wow that’s really impressive. It ran really smoothly for me with reflection and shadow on (couldn’t find FPS printed anywhere either :-): I have an Intel Core i7 2600K with a Nvidia GeForce GTX 580. The shadow however had quite a few visual glitches that looked like a triangle was cut out of it.

NO WAY! You upgraded from your GTX 470?!

The shadow has glitches and for what I see the reflection works fine. I take a bet you set the color of FPS to white so we can’t see them.

I upgraded from the 570 to the 580 ;D

Hi

I’ve just tested it. I have had to refresh the page as the first time nothing appears. It is very slow even in a very small window, even when I disable the effect, I get about 2 FPS on my AMD Semprom 2600+. Ok it is just a demo but d3caster and 3DzzD in software rendering mode are faster, they are able to display much more 3D objects with a better framerate. Good luck.

Hey, thanks a lot for your answers !

@EddieRich
Thanks, actually it’s raytracing (well, I think so…) : each pixel launches a ray and its color is multiplied by the hit meshes ones, which explains the background is white :wink: . With this method it’s very easy to make reflects or shadows, transparency or diffraction effects (that I’ll try to implement) with the same code. Actually, there is no FPS ! I thought I couldn’t display it, which was very stupid, I’ll add it next time ;D . Thanks for Monday, I’m curious of the result !

@Miaow
Thanks, I note it down :slight_smile: . You’re right for the shadow, it’s caused by the nd-grid (yes, N.D. are my initials…) building algo, which is not perfect yet, and btw can seriously be improved to optimize again the performances :wink: . But it’s geometrically more complex than I thought…

@ra4king
Thank you, I must say normally the graphic card shoudn’t change the performances because, as it’s software rendering, the applet only uses the brute force of the CPU ;D . Hmm, that said, maybe it shouldn’t be stupid to try to use CUDA or something like that for the “trivial” calculations, like rays tranformations according to the camera or things like that…

@ReBirth
Ha ha ! No the FPS isn’t displayed, Actually I’ll try not to put it white (that’s a stupidity I’m able to do ;D ) !

EDIT :
Hi, Julien, thanks for the test !
Ha ha, I could have bet you’d talk about 3DzzD ! Maybe keep in mind it’s raytracing (I insist)… 3DzzD is a fantastic engine (I don’t know d3caster) but in a way it emulates the work of a graphic card, what I try to do is closer to a project like Larrabee. Theorically that can easily do things very complex for graphic cards like diffraction, smooth shapes or realistic shadowing, with no loss of performance.

d3caster uses raycasting (raytracing but only handling the primary rays). There are some examples of hardware accelerated shader based raycasting (Julia quaternion?), maybe you should have a look at them. You could even make some computations on the GPU or on the CPU (with OpenCL) and do the rendering on the GPU too (with OpenGL of course).

You’re right, it should be very interesting to try CUDA or OpenCL, at least for some massive sequential calculations (matrix, etc…), but I don’t really understand how to do the rendering with OpenGL :-\ as the result is an array of pixels (I must admit I’m a noob ;D ) . Otherwise thanks for the Julia quaternion, it’s pretty fascinating ! Certainly hard to implement…

Someone spoke about an implementation of Julia 3D quaternion using JOGL and JOCL on our official forum:
http://forum.jogamp.org/Julia3d-out-of-memory-problem-td3729033.html

Martin Pernollet is kind, he might explain to you how it works.

The latest versions of Blender (2.61 and 2.62) have real-time raytracing (the Cycles renderer).

Looking at the source code for that might be very useful for you since they have implemented it both in software and hardware (cuda perhaps?).

Your demo is much less noisy than the Cycles version, so it is probably more useful real-time than the current version of Cycles. See for example this video and also this one.

@gouessej
Hmm, interesting, I’ll register in your forum !

@krasse
Thanx for the information ! I’ll look at it because my nd-grid has one default : it costs A LOT of memory !