-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2D Batching is extremely slow on Android (GLES3) #53537
Comments
I wonder if this is related to 2D lighting. Can you reproduce this if you hide all lights in the scene? Also try reproducing this with only one light visible in the scene. |
With 4 lights visible, the demo runs at 3 FPS. The lights are definitely influencing the degradation. |
Ah thanks for posting (from reddit)! Yes it will be the lights. Lights are very difficult to deal with in terms of batching, and sometimes there are 'worst case scenarios' in which there is no way to batch the drawcalls without affecting the end result, so none of the commands are batched. Sometimes tricks are needed with lights, as you can easily end up in situations where merged sprites end up using more fill rate than individual sprites (and mobile is very sensitive to fill rate), especially with large lights, which is what you are using. This is the reason for the There's some info on this in the docs: There's a number of other parameters that may help your situation too, I'll see if I can work out what is going on from the source and Yes because of the long chains of overlapping sprites you are literally getting no batching going on above the x1 setting. Here's a diagnose log:
If you turn on the batching Now as to why it is that much slower when it can't batch, I'm not absolutely sure, but it could be that part of the explanation is that Yes, just tested the batching is quite a bit faster with the You are probably also losing some performance because it is attempting to deal with the overlapping sprites and failing. You can also turn this off in the batching settings, but none of this will get you better performance than legacy if no batching at all is possible. What is very telling is that if I use the legacy renderer, and switch on For android you can probably get by with this off in either case (i.e. |
Thanks -- I see! I currently have a game with about 50 overlapping sprites (each character is made up of tons of parts for their mouth, eyes, ears, etc) and a polygon (their torso is a big oval which can change shape.) The unfortunate reality of this design, is that I must have batching on to work around issue #19943, but I must have batching off to work around issue #53537. I think a feasible workaround is the "create a Sprite which snapshots a polygon" approach, so that's what I'm trying for now. But ideally it would be nice if the fix for #19943 did not require sprite batching, or if a fix for #53537 allowed sprite batching to work efficiently on Android. |
Well in fact, if you follow the advice above you should be able to cure most of the performance issues with batching on. I'll try and find the best settings for you, but for now, try switching Yes the exact best parameters to use will depend on your game, but the three most likely to be important here are: |
Thanks for the suggestions! I've done some experimentation. With batching disabled, the demo runs at 60 FPS. I see similar behavior in my game -- the |
Also a couple of other options:
https://www.youtube.com/watch?v=P6qzGofbNyo Although it will probably be difficult to get it looking as good (and won't work if you are e.g. using normal maps), this will run shedloads faster in your situation. The main problem I seem to remember was the lack of bit depth when I tried it. |
Thanks for the suggestions! My game doesn't use any lights -- it is doing something else which impacts the batching algorithm, but I'm not sure what exactly. I'll continue looking into it over the next few weeks and see what I can find. |
Closing as lighting performance is unlikely to be fixed, being a limitation of the 2D rendering paradigm. |
Godot version
v3.3.4.stable.official [faf3f88]
System information
Galaxy Note9 REV1.1, Android 10, GLES3
Issue description
2D batching causes a severe performance degradation on Android. With 2D batching disabled, the attached demo can render 1,920 sprite nodes at 60 FPS. With 2D batching enabled, it runs at 3 FPS. This is on my Samsung Galaxy Note9 (SM-N960U) running Android 10.
2D batching enabled:
2D batching disabled:
![Screenshot_20211007-112131_polygon2d_performance](https://user-images.githubusercontent.com/5902413/136416325-6c82c75a-60d2-48ef-9460-ce9172768ca8.jpg)
Steps to reproduce
Project
->Project Settings
,Rendering
->Batching
->Use Batching = Off
)Minimal reproduction project
polygon2d_performance.zip
The text was updated successfully, but these errors were encountered: