Ray Tracing and jME 2.0

Hey guys, I haven't had much time in a while to do any game development, but hopefully that will be changing soon.  However, I've been reading a lot about Ray Tracing recently and it got me really thinking about a lot of things in jME.

Right now in jME things like shadow passes, light states, etc are all things that really have to be explicitly thought about by the game developer as they are putting their game together.  Wouldn't it be better if people abstract out a bit more from the system and focus more on "what" they are creating rather than "how" they are going to display it?  This idea I think is very similar to the advances that Irrisor made in jME-Physics 2.  A dynamic physics object can have materials an other attributes defined for the "object" and it behaves a specific way because of those attributes.  What if jME were the same way?  What if instead of having to define an AlphaState, a ShadowPass, etc. you could set a material and texture to an object and it would simply display the way it should given the other aspects of the scene?

Like I said at the beginning of this post I've been researching Ray Tracing in real-time games recently and it made me think about the practicality of adding it to jME as an alternative rendering strategy.  If we switched to a more abstract perception on "what" instead of "how" this would be possible and at runtime a player could choose a classic rendering strategy or ray tracing depending on their machine performance.

Am I talking about something that should be at a higher level than jME, something we should aspire to bring jME to, or just talking crazy?

do you have any good links to those ray tracing in real time sources you have been reading? i would like to read more about it myself… and some docs would help out in giving you good feedback


Quake 3 / 4 Ray Traced:


Wikipedia is where I went when I first got interested to learn a bit more:




I was reminded of Sunflow, a rendering system (granted, not real-time) that I had looked at previously:


Sunflow’s gallery really shows what is possible with ray tracing and has amazing potential if a game engine could leverage that kind of quality.

There was a few other articles and one that I was reading that led me to this in the first place, but I can’t remember where they were.

The simplicity of the game engine using ray tracing is very compelling versus all the junk we have to handle in jME right now (such as shadows) that you essentially get for free. However, there is a definite cost to the CPU going this route and it may not be practical yet to assume machines have enough power to do it, but if someone could ever get a good ray tracing hardware support or a well developed engine I think it is the future of game development.

What's the state of bounds checking in Java these days? Does OpenJDK / JDK 6/7 do any good optimizations yet? (or better yet, allow you to turn them off completly?)

IMHO with "on insert/get" bounds checking you'll never get the performance you need for ray tracing in Java, unless you want to accept that you're perpetually twice as slow as your C/C++ friends. Or did you plan on JNI-ing a C/C++ implementation?

What do you mean by "on insert/get" bounds checking?

I really haven't gotten to that level of thought yet.  I wanted to bring it up to you guys and get some feedback on what you all thought to help decide if it's even probably to be able to do.

Doing a bounds check when inserting or getting a value inside (for instance) an array.

Ray tracing requires a great number of lookups, often over a great variety of different coordinates. If every time you have to look if the (what eventually becomes) memory address is in a certain range, you can understand this slows you down a lot.

Not a problem if you copy big buffer (since that's only 2 bound-checks per copy), but if you want to modify a lot of single point (ray hits)… real time ray tracing is barely feasable as it is…

AFAIK the old Sun JDKs work exactly like that, the new ones I have no idea. I do know some other runtimes (eg during the time of the Alpha processors) did some compile optimizations. I think they won't do much good for your situation though, so what you really would need is turning of bound checking (like eg you can do with gcj).

Of course if you want to experiment and learn ray tracing that's not really a problem, but you seem to have grander ambitions than that… :stuck_out_tongue:

You know me…delusions of grandeur. :wink:

Interesting…I've been thinking about that boundary from a different perspective.  What if instead of an Array or list/collection you could organize things more logically in a three-dimensional growable container that organizes Objects by their location?  Something like a TreeSet but multi-dimensional?  This would allow ray hits to be much more efficient, right?