Only 8 light sources?


I was away for a long time frmo these forums.

I did my diploma thesis (a prototype for a MMOG design) in jME and it worked quite well.

Since i finished it (early this year), i haven't done much more in jME.

But at the end of my work, i came across a problem and it really surprises me the more i come across other 3D engines:

The problem was that jME would only use a maximum of 8 simultaneous light sources. I worked around it by clustering the scene and using only the 8 closest lights for each segment. Which of course then caused edges in the light distribution where the segments ended.

I wonder why this issue exists. Almost everywhere you can see a large number of light sources used in 3D realtime engine. Like for example a 3D RTS where every single unit and even every shot is a seperate light source.

We are currently thinking around some first concepts of starting a little MMOG project.

Currently, this limitation is an absolute knock-out criteria for the otherwise very attractive jME.

So it is time to look at this problem once again

So where does this limitation come from (that was even mentioned somehere in the jME javadoc iirc)?

I doubt it comes from my graphics card, as i play games with tons of simultaneous light sources in it.

Is it a permanent limitation of jME or will it be resolved in the future (or has it already been resolved meanwhile) ?

Is it from LWJGL (or maybe was it from an older version of it…) ?

…or can someone give me a counter-example proving me wrong and showing that there is no such limitation ?(which would of course the best solution :wink:


I recently just read the chapter "“Fast Per Pixel Lightning with Many Lights” in “Game Programming Gems 6” which looks like a good solution to your problem. Don’t render everything in one pass, but rather do a two pass rendering where you apply the lightning using a so called G-Buffer (geometric buffer) in the second pass in a per-pixel manner. That way you can easily have dozends of light sources without a over complex one-pass shader or dropping the least significant light sources.

jME seams to be written with a lot of backwards compatibility (fixed pipeline) in mind so nothing like that seams to be available, yet. As I’m no jME or OpenGL pro myself I can only wildly guess that you’d probably best off writing a custom render pass which handles any amount of lightning you need and applies it in a second lightning pass.

Sadly there is no online version of this article that I’m aware of. If you want to invest a few bucks get your own copy of the book. It’s worth every cent.

It's a limitation of OpenGL not jME. Probably you can solve your problem with sorting and selecting the lights like in LightManagementTest?