-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
Path2D renders slowly #38543
Comments
Could you provide more information? Are you saying that having a Path2D node in the scene slows down your FPS? Or are you saying that the process of drawing a Path2D slows down the editor? Also some numbers would be helpful. For example if your FPS goes from 2500 to 2050, that isn't very bad, but if a single Path2D takes FPS from 500 to 50, then that is a big issue. |
A single visible path 2d node can slow down the editor considerably more than any other 2D node, here's a video. Maybe drawing lines in general is slow, but paths seem to have a bigger impact in the editor performance. |
Thanks for the video! But could you provide numbers please? The FPS of the video is low enough that I can't see an appreciable difference. |
The video is 60fps(I think it's 30fps if you play it at 360p), the part where I just duplicate some sprites is 60fps all the time and when I add the path it drops to like 20, I'm not sure how to measure the fps in the editor I'll try to figure it out to post numbers |
Can confirm it is slow, just tried a test and a similar number of path points dropped FPS in a project to 73fps, whereas sprites will be >1000 fps with batching. Thick lines are quite involved, they involve drawing a central rect and 4 smoothed GL_LINES round the outside. I'll see if I can break out the |
I measured the fps in game with visible navigation turned on and I got 2300fps with nothing on the screen at a very low resolution, when the path is visible it drops to 90. In the editor in distraction free mode fps is 60 with nothing on the scene (vsync) and it drops to 14 when the path is visible. |
Just for info, when I used my Also long thin triangles / lines are bad for rendering:
There's also something weird going on with the drawcalls. For around 30 line segments, I'm getting 1240 drawcalls. Even with 5 drawcalls per line that would be closer to 150 drawcalls. Yes .. for circa 30 line segments it is trying to draw 248 lines for some reason. Multiply 5 and you get the 1240 drawcalls. Ah .. the Path2D is made up of curves, which presumably are broken into line segments, hence the large number of primitives. So in a way this is totally expected, it will probably only be properly solved in this case when we extend the batching to other primitives such as lines. |
I have the same problem on a 2018 Macbook pro running Catalina. FPS go to 12-14 both in editor and in-game using GLES2 |
@MightyPrinny Can you (or anyone else) still reproduce this bug in Godot 3.3.2 or Godot 3.4beta3? If yes, please ensure that an up-to-date Minimal Reproduction Project (MRP) is included in this report (a MRP is a zipped Godot project with the minimal elements necessary to reliably trigger the bug). You can upload ZIP files in an issue comment with a drag and drop. |
3.3.4 stable I have the same issue reproduced on Windows 7 and Windows 10 machines, slightly better performance on macOS Big Sure, but still noticeable. The Path2d which I test has about 50 points, and with every new duplicated object the performance of editor gets significantly worse in the area of the scene where these objects added. Note: this is not an issue when the game starts, it is only when scrolling/working with the scene where the Path2D object added, so seems like the editor issue |
Just to note that rather than fix this in the rendering we can presumably alternatively reduce the number of line segments in the curves of the Path2D (assuming this is just a gizmo?). I'm just having a look at simply converting Ok done some more investigation. This screenshot is zooming in on a section of Path2D in the editor. It shows that in the situation before the segments are drawn as separate thick lines, using anti-aliasing. The anti-aliasing is giving a lighter outline, presumably because the color is inheriting some alpha, and it is effectively drawing these areas twice. You can also see the edges don't match up between these segments don't match up. I noticed this when drawing them as lines, but maybe this would be better drawn as a polyline, and perhaps the polyline can be decomposed to polys in the same way. |
Fixed by #54377. |
Godot version:
3.2.2 beta 2 (and previous versions)
OS/device including version:
MXLinux 19 64 bits
Issue description:
Path2D nodes draw very slowly, 3d paths don't slow down the editor so much for me
Steps to reproduce:
Add a Path2D and draw a path
The text was updated successfully, but these errors were encountered: