Correctly render map movements, also before map tiles are drawn
When moving the map, VTM is lagging and map movements are performed delayed. To me it seems like the whole VTM rendering is done on main thread (?)
I'm using a Germany map file from OpenAndroMaps for testing on a Huawei Mate 20lite running Android 10.
This observation was first recognized while developing cgeo, however this doesn't seem to be limited to cgeo so I'm opening an issue here.
E.g. I've noticed the same laggy behavior when using Cruiser GL vs Cruiser. Two more videos attached...
It might or might not be a device specific issue, I don't have enough different devices to test it properly.
Classic Mapsforge: tile rendering is slower, however movements are performed with higher FPS
https://user-images.githubusercontent.com/64581222/203828658-57a6870c-2b27-4e27-a4d8-312e0e187619.mp4
VTM: Rendering is faster, however movements are performed with really low FPS rate (especially in busy areas).
https://user-images.githubusercontent.com/64581222/203828645-27191705-c114-46ad-a637-c55a86b04b9b.mp4
Originally posted by @fm-sys in https://github.com/cgeo/cgeo/issues/13718#issuecomment-1326659351
Your VTM example looks extremely slow. From my experience this happens only with Mapsforge render themes (which are very complex) but not with the built-in VTM render theme. What happens when you lower the screen resolution in the Android settings?
I investigated the problem a while ago for my own projects and came to the conclusion that it is not mainly a threading problem, but a rendering problem. There are things we can do:
- Render everything to a FBO and draw the FBO. This is fairly easy but comes with its own problems and does not really fix the problem.
- Reduce the number of elements drawn during animated operations.
- Improve the rendering pipeline?
As said, these are my observations and they might be wrong. Maybe you can try to log the execution times of the different processing steps in the VTM library and check if you come to the same conclusion?
Thanks for the report, indeed it does not look good, for OpenGL's reputation. (the examples show default themes of Mapsforge and VTM)
Both parse the vector data, then:
- Mapsforge creates bitmap tiles and renders them (if separate label layer is enabled, performance is worse)
- VTM (OpenGL) rendering is in real time, for 3D features, rotation, etc.
In Cruiser "Settings | Map | Rendering | Performance" can enable extra simplification. (useful in heavy maps like Germany vegetation and Netherlands water)
And with complex themes like OpenAndroMaps Elevate things are more difficult.
What does the "extra simplification" do (technically in VTM)?
What does the "extra simplification" do (technically in VTM)?
See https://github.com/mapsforge/vtm/pull/757 and https://github.com/mapsforge/vtm/pull/956. (also mentioned in Changelog)
Thanks. Is there a rule of thumb which value to use for Parameters.SIMPLIFICATION_TOLERANCE?
Is there a rule of thumb which value to use for Parameters.SIMPLIFICATION_TOLERANCE?
In Cruiser I set it to 4.
Side note "Settings | Map | Rendering | Performance" (which seem to be the default) was already enabled in Cruiser while recording the videos