Terrain low FPS when zoomed in close

I keep encountering areas in my scene where the framerate drastically drops when I am looking down at the terrain in front of me, but if I zoom out and view the same area from further back, the framerate goes back to normal and runs at >60 fps.

Usually in the past, my scenes would encounter lower framerates when I view them from a far distance because there are more vertices and objects on screen.

But in this case it is happening the opposite way around: the framerate drops are happening when the stats view is reporting a lower value for every category, and then when I zoom out the texture / shader / object / vertex / triangle counts all go up but the framerate also increases.

I think this framerate drop began when I started using a terrain shader with texture arrays a while ago, but I did not notice right away. Around that time I also increased all of my terrain textures from size 1400 to 2048 but as far as I’m aware, larger textures shouldn’t lower the fps.

Here are 2 screenshots showing the same area viewed from up close and from afar with the statsView shown at the lower left to show how the framerate is lower in the scene that has lower stats in every category except for Textures(F):

Does anyone have any ideas where I should look to start solving this framerate drop? I am completely stumped and feel like there must be some important aspect to scene optimization that I am still unaware of, since the statsView is reporting lower usage for the scene that is also running at a lower FPS. Thanks


Lately when I used ToneMapFilter i got lags, some fps drop, but more lags, i really have no idea but if you have filters try to disable them to see what happens!
EDIT: Nice Beautiful scene :+1:

1 Like

Thank you!

That is a good idea I should have turned all my filters off first to narrow the issue down.

I just removed the 3 filters my scene was using (DirectionalLightShadowFilter, WaterFilter, and LightScatteringFilter) although the framerate drops are still happening in the same spots of the scene.


I should also mention that I’ve noticed a very strange and unexplainable lag in the engine’s official test case I made for the AdvanedPBRTerrain.j3md shader that uses texture arrays. The terrain in that test case gets an extremely low framerate at all distances if anti-aliasing is turned to x16 or even x8.

Which is very strange because that test case uses less texture reads and contains less terrain than many scenes in my game that render with a way higher framerate even at x16 anti-aliasing.

So something strange seems to be going on with the advanced PBR terrain shader that uses a texture array. If anyone else has a chance to run this engine test case (jmonkeyengine/PBRTerrainAdvancedTest.java at c7d82696b8479891862b93a8edd3075e9bb87d5f · jMonkeyEngine/jmonkeyengine · GitHub) I’d be interested to know if you experience extremely low FPS with anti-aliasing at x16 compared to x0.

Edit: Now I’m extremely confused… I noticed my game still was using a TranslucentBucketFilter so I removed it, and now my games lags like crazy just like the test-case. For some reason having a TranslucentBucketFilter in my game improves the framerate drastically… I thought this Filter was just fixing the sorting issue with my particle emitters and the water Filter, but apparently it is also having a positive effect on my game’s framerate it seems like.

Edit 2: The TransluscentBucketFilter appears to affect the framerate depending on what other filters are being used… If I use TranslucentBucketFilter without any other filters, the framerate is consistently terrible no matter where I look. But if I use TranslucentBucketFilter while using all of my other filters, then the framerate is back to how I explained in my original post. So I don’t know if this is related to the my original issue, but it still seems to be strange behavior that I do not understand.

1 Like

I already also got some drop in fps by only using 16x or 8x anti-alias, I thought it is caused by my system specs which i can’t see why only one model in scene can happen it. since i have skylake i7, so capable i played dark souls 3 with it, but may be something related to the filters to, also i just got two different model view with exact model and code just 30 min ago on beta3! I still have no clue.
Try to diagnose with removing some elements like sky hdr, or any new added feature or model too.

1 Like

I feel like your stats and your tests are all pointing to “fragment limited”, no?

…and especially when getting into the subtexel range.

Hard to say though, I’m not familiar with these shaders. Slow performance on high AA also says “fragment limited” to me.

1 Like

I’m not sure, wouldn’t that also mean that the view from further away would render at lower fps than the close up view, since the terrain behind the hills still is being rendered and resulting in more terrain fragments being rendered overall?

Or am I mistaken about this? I know that I’ve read about objects behind other objects still being drawn and causing lower performance even when out of view; does this include both the vertices and fragments or just the vertices?

1 Like

If they are separate objects then JME will sort things front to back to avoid overdraw.

And while rendering things far away will render more of them, they are all going to be relatively tiny with relatively few fragments each. The number of fragments goes up exponentially (geometrically, heh) as a triangle gets closer to the screen.

It’s just a guess, though.

1 Like