
Improve performance
Rivmun opened this issue · 3 comments
In 1.7.0, I'd adjusted cloud mesh building priority to let visual perform of fadein feature smoother. It's needs mesh building runs in every tick and spend lots of hardware performance. Then I've found that game fps will critically drop when SFCR gen too many clouds. So, an optimization patch for performance is necessary.
Two ways to achieve it:
-
Cull faces which is invisible, to improve performance, prevent lags.
- learn about quaternion, or find a way without using any quaternion function (because I don't learnt anything about it...)
- calculate whether clouds are in sight
- culling
- Re-use quaternion to do a rectangular culling. (trying to)
-
Reroll the mesh building priority in 1.5.x
Add interval to mesh rebuilding, HIGHLY effective to improve.- Prevent clouds flicker when fullOffset is round off at this time.
Trying to impl culling unsight faces. When no have culling:
When culling enabled:
FPS increase by 50%. (when cloudRenderDistance is 192, thickness is 32, cloudBlockSize is 2)
But it not enough, because when I turn SFCR off (with Sodium):
And, I'm already put fov as a culling condition, but fps has not change when I decrease or increase fov. It's strange.
On the other, I found that reroll remesh priority and culling face is conflict. Because if remesh isn't run in every tick, the culling will be delay to a few seconds. It will causing bad visual things.
Sadly for now, if I impl culling, I couldn't fix remesh priotity.
Reopened because I noticed that the culling is a limited way to improved performance, if we make #2 implementation, it's not enough.
Simply use a timer to added 0.1 seconds interval for clouds mesh building instead of in every frame, its lags disappear nearly entire. See below👇
1.7.4:
Vanilla:
1.7.5-dev:
It's a huge breakpoint for performance improvement on 1.7.x version, even better than original SuperFancyClouds. Because we have low frequent remesh (not high freq at least) and clouds face culling at same time.
But here comes a flicker issue and visual lag when culling is running. The remesh isn't run in every frame, so clouds will disappear at screen's edge in few frames when player rotate his camera fast.
Whatever, this's a HIGHLY effective optimization patch. I'll handle it and preparing to release it late.