Skip to content
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

Improve NavigationRegion2D debug performance #92372

Merged
merged 1 commit into from
May 29, 2024

Conversation

smix8
Copy link
Contributor

@smix8 smix8 commented May 25, 2024

Improves NavigationRegion2D debug performance by replacing the canvas polygon and line commands with a static mesh.

This largely copies from the NavigationRegion3D debug mesh creation. The result is a whooping performance jump from ~100 fps to ~1400 fps in my test project with a 10.000+ polygon mesh and an unoptimized dev build.

Like most 2D nodes the NavigationRegion2D used the canvas draw functions for lines and polygons to draw its debug. This caused significant performance issues on complex navigation meshes as the rendering could not keep up with so many inefficient draw commands. This PR changes the debug and turns the entire region debug visuals to a single static mesh used for the rendering.

Note: That the mesh uses an array of vertex colors for everything is not a mistake. This was done due to issues with the 2D canvas rendering api not rendering colors correctly when using meshes without textures. With textures the materials and node canvas modulate did not play nice together and created weird color combinations.

Copy link
Member

@fire fire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't tested cases but the feature is great.

Improves NavigationRegion2D debug performance by replacing the canvas polygon and line commands with a static mesh.
@akien-mga akien-mga modified the milestones: 4.x, 4.3 May 29, 2024
@akien-mga akien-mga merged commit 183c634 into godotengine:master May 29, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants