Rivmun / SuperFancyCloudsRefabricated

A unofficial multiloader port of Minecraft quilt-side mod SuperFancyClouds.
MIT License
5 stars 1 forks source link

Improve performance #50

Open Rivmun opened 1 year ago

Rivmun commented 1 year ago

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:

Rivmun commented 1 year ago

Trying to impl culling unsight faces. When no have culling: QQ截图20230509105754 When culling enabled: QQ截图20230509110058 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): image RFE%%TH5 F7YWT4G3 GENBX

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.

Rivmun commented 1 year ago

Reopened because I noticed that the culling is a limited way to improved performance, if we make #2 implementation, it's not enough.

Rivmun commented 1 year ago

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:

QQ截图20230630010655

Vanilla:

QQ截图20230630010523

1.7.5-dev:

QQ截图20230630010634

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.