Having more then 5 light sources drops FPS to near ZERO

Hello JME3 !

My name is Eric, new on the forum but have been making a game for some time now (around 6-7 months actually) and I love it.

I have a problem with lights.

I tried using point lights with a very limited radius but as soon as i trow more 4-5 in the game fps drops down severly. I have a day/night cycle and I need a way for the player to be able to light up his world at night.

Any ideas ? I can provide code but basicly I am using allot of stuff (water, advanced terrain, shadows… ) I think having a large terrain might be slowing down the game but the point lights radius does not seem to affect FPS.

Thanks in advance.

By default point lights are not range-limited. You can scope them to light only specific subparts of graph manually, but there is no logic for scoping them by distance.

You might want to apply patch

to see if it will help. But this will make a difference only if you have a lot of smaller objects outside of light scope - if your main cost is terrain, then there is no easy solution. In theory, single-pass light could help a bit here, but I don’t it is implemented in any shader by default and might be buggy?

If you want to go crazy light-wise, deferred rendering/lighting is a way to go. Unfortunately, this is quite painful to integrate with jme3, you would need to reimplement most of the filters on your own and then fact all the issues for deferred rendering like transparency handling etc.

1 Like

Hello!

Thanks for the quick answer.

How do I apply the patch please ? Which file do I edit and should I copy the whole thing or just sections marked in red ??

Easiest will be probably just taking

and pasting over your Material.java

But please be warned - it will help only for very specific scenes, where small points lights highlight only subset of small geometries. It is not helping at all in case where small point light highlight a some triangles of large geometries.