MoreMcmeta / core

Animate almost any Minecraft texture with more options. Texture configuration API. 1.16-1.21
GNU Lesser General Public License v3.0
30 stars 5 forks source link

Poor performance when using high-resolution skybox resourcepacks #39

Closed ghost closed 1 year ago

ghost commented 1 year ago

Describe the bug Moremcmeta always causes huge lag when using high-resolution skybox resourcepacks(Such as Hyper realistic sky)

2023-09-26_01 03 37 When I load Hyper realistic sky without any optimization mod,my fps is 400+

But if it works with Moremcmeta,this number decrease to 60 2023-09-26_01 13 11

Animatica has one similar issue:https://github.com/FoundationGames/Animatica/issues/43

To reproduce Steps to reproduce the behavior: 1.Install fabricskyboxes-0.7.2+mc1.19.4,fsb-interop-1.3.3+mc1.19.4-build.45 and moremcmeta-1.19.4-4.2.3-fabric 2.load any high-resolution custom skybox resourcepack

Which Minecraft versions does this bug affect? List Minecraft versions that this bug affects. Only tested on 1.19.2 and 1.19.4,should affect all Minecraft versions.

Mod loader Which mod loaders does this bug affect?

soir20 commented 1 year ago

This resource pack uses particularly large animation frames. There are some potential optimizations I could introduce, though I am not sure how much it will help, given the size of these frames. It's updating millions of pixels every 1/20th of a second. I will see how much of an improvement can be made.

Do you see similar performance issues when you use OptiFine only?

As a temporary workaround, you can remove the assets/minecraft/optifine/anim folder inside the pack, or try turning off interpolation.

ghost commented 1 year ago

No,I have never seen similar issues on Optifine.My fps is up to 650 when using optifine only 2023-09-26_02 35 29

soir20 commented 1 year ago

Just FYI, this is being worked on, but it will likely take several days. I'm looking at processing these large frames with multiple threads from a cached thread pool (see dedicated branch for this issue if you are curious). It takes some time to introduce multithreading and ensure that I haven't introduced any bugs.

I'm not a huge fan of the cache solution presented in the linked Animatica issue because it can easily lead to multiple GB of extra memory. For example, one of the animations in the pack you provided would require about (1536 pixels 1024 pixels) (4 bytes/pixel) (3 frames) (40 ticks per frame) = 754,974,720 B = 720 MiB of cache. That will probably be a last resort if I can limit the memory to a manageable amount.

soir20 commented 1 year ago

Good news: with the initial changes, I'm seeing an improvement from 1-2 FPS to 30-40 FPS on my machine. There's still some tuning and other improvements I want to make, but this approach is yielding a significant improvement so far.

ghost commented 1 year ago

Good news: with the initial changes, I'm seeing an improvement from 1-2 FPS to 30-40 FPS on my machine. There's still some tuning and other improvements I want to make, but this approach is yielding a significant improvement so far.

Could I get the latest build?I would like to try how much it has improved on my computer.

soir20 commented 1 year ago

Here's the latest development build for Fabric 1.20.1. (I generally develop for the latest MC version and then backport.)

I had to attach this as a .zip for GitHub to allow me to upload it.

moremcmeta-1.20.1-DEV-10-2-2023-fabric.zip

soir20 commented 1 year ago

Here is the second development version. This version disables updates for any texture that is not currently being used. So you should see a performance difference between:

Can you confirm that you see a significant performance improvement in all three scenarios?

Furthermore, I've noticed that the auroras in this pack flash rapidly. Is that the way this pack is supposed to look? I don't see any issues with the tornado or other animations.

moremcmeta-1.20.1-DEV-10-3-2023-fabric.zip

soir20 commented 1 year ago

Fixed aurora rapid flashing.

moremcmeta-1.20.1-DEV-10-4-2023-fabric.zip

ghost commented 1 year ago

image Amazing improvement!Nice work!

ghost commented 1 year ago

But I suppose there are something wrong in other ways.My FPS is much lower than it used to be when using Reimagined resourcepack,which may add some custom animated textures. image (with latest release) image (with dev build)

soir20 commented 1 year ago

There is a small bug in the last build that was causing block frames to be recalculated excessively. This build should fix the issue.

moremcmeta-1.20.1-DEV-10-4-2023-2-fabric.zip

Can you confirm whether the performance issues with Reimagined are fixed? Can you also confirm that the performance is reasonable when you can see the auroras from the other pack? There will be some performance hit when the auroras are visible, but it shouldn't be as bad as before.

ghost commented 1 year ago

The performance issues with Reimagined are solved as you expect.And I don't think Auroras impact performance significantly,it's acceptable. image

soir20 commented 1 year ago

Thanks for confirming, I am going to backport the performance enhancements to older MC versions. There should hopefully be a release tomorrow or over the weekend.

soir20 commented 1 year ago

MoreMcmeta v4.2.5, which contains these performance improvements, has been released. It take a few minutes for the release scripts to run and for the files to be approved by CurseForge. Thanks for reporting!