godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.34k stars 21.06k forks source link

horrific performance on android (3D) #31601

Closed grusad closed 4 years ago

grusad commented 5 years ago

Godot version:

Godot 3.1.1

OS/device including version:

PC: RTX 2080 ti, i7... a monster Android: Galaxy s10

Issue description:

Well im having a simple 3D scene containing a small gridmap (something like 15x15), a player, 3 mobs running around, and some sprite3D laying around in the gridmap. On my PC a get over 1,5k FPS in fullscreen mode, and on my android phone its unplayable.. maybe around 10fps?

So what is going on here? Should i exclude 3d in android dev using Godot?

Calinou commented 5 years ago

First, make sure to switch the project to use the GLES2 renderer (instead of GLES3). It's much more optimized for mobile devices overall. You can do this by changing Rendering > Quality > Driver Name to GLES2 in the Project Settings.

Also, note that by default, Godot will render in the device's native resolution. This resolution is very high on recent flagship smartphones; it makes sense to lower it to something more reasonable.

To do this, go to the Project Settings and set the window width and height to 1280 and 720 (or 720 and 1280 for a game in portrait mode). Then set the stretch mode to viewport and the stretch aspect to keep.

See Multiple resolutions in the documentation for more information.

grusad commented 5 years ago

@Calinou I tried GLES2, and adjusted the settings that u mentioned, and the fps didnt increase that much.. And i lost depth test on all objects :'D Ill have to stick to desktop version with the game, unfortunately. I dont even know if this should be issued on github or not...

Calinou commented 5 years ago

@grusad Some features like real-time shadows are very demanding on mobile GPUs, so you will likely have to live without them if you're targeting mobile devices (use baked lightmaps and fake shadows using sprites instead).

Also, since you're using a Sprite3D in your project, you may want to replace it with a MeshInstance with a QuadMesh attached due to #20855. Reading the issue's description, it seems the performance issue might come from the Sprite3D actually :slightly_smiling_face:

lawnjelly commented 5 years ago

So what is going on here? Should i exclude 3d in android dev using Godot?

This might not be a godot issue, just a guess are you new to developing for mobile / non-desktop platforms?

Mobile in particular is a lot more limited in terms of horsepower than desktop, particularly with graphics. If you are aiming for mobile release it is a good idea to do performance testing early and throughout development so you can get an idea of what is and isn't feasible.

Fill rate in particular is often very low, and mobiles often use tile rendering so the bottlenecks can be different than on desktop. Overdraw, transparency, and things like shadows can kill performance, and simpler shaders are likely to work better.

grusad commented 5 years ago

@lawnjelly I am pretty novice at mobile dev. The thing is that my scene that i tried to render on my galaxy s10 should not be a problem to run, i cant imagine that anyways. Havnt had the time to try to replace my sprite3D to a quadmesh to see if that fixes the problem yet..

Jayanth-L commented 5 years ago

@lawnjelly I am pretty novice at mobile dev. The thing is that my scene that i tried to render on my galaxy s10 should not be a problem to run, i cant imagine that anyways. Havnt had the time to try to replace my sprite3D to a quadmesh to see if that fixes the problem yet..

Hello grusad i would recommend you to remove the Procedural sky and set it to Clear Color and also adjust the Ambient Light, You will see FPS Shooting up in GLES3

The main Bottleneck here is actually the Sky and its properties like light and shadows, according to my experience with GLES3.

I could get 60 fps with 100000+ vertices drawn on Samsung A7 device with GLES3.

if you still don't get good FPS then experiment with the shrink option in the Window -> stretch menu you will get good FPS but the Image rendered may be pixelated corresponding to the shrink value set.

Hope this helps!

kruglinski commented 5 years ago

I think the weakest chain of Godot is 3D assets pipeline not the renderer.

I backport godot-sponza(from @Calinou ) to Godot 2.1, fix some core engine bugs including one in material.glsl(Godot 2 BakedLightmap is broken in iOS). and use BakedLightmap I'm able to running this scene in 60 FPS for both vivo z3(Qualcomm Snapdragon 710) and iPhone 6SP(A9)

psb

generally In mobile platform you use realtime shadow as less as possible, if you must have shadow you use only one DirectionalLight

BTW: I'll stick with Godot 2 until the day it can't be use anymore :-)

shivmsit commented 5 years ago

godot-sponza

I tried godot-sponza with godot 3.1.1, performance is very poor it's struggling to achieve 6-7 fps for machine with 2.8 GHz Quad-Core Intel Core i7 NVIDIA GeForce GT 750M 2 GB macOS

clayjohn commented 5 years ago

@shivmsit this issue is about Android performance, not macOS. Please search for an issue relating to macOS or open a new issue.

Calinou commented 4 years ago

@mahdisml Please don't derail the discussion with off-topic comments.

Either way, I'll close this issue as there's nothing actionable we can do about it right now. That said, you should be able to achieve better performance on mobile by designing your game around the limitations of the platform (such as by lowering the target resolution). For more information, look into the new optimization tutorials in the documentation.