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 cylinder gizmo performance #103903

Merged
merged 1 commit into from
Mar 11, 2025

Conversation

kiroxas
Copy link
Contributor

@kiroxas kiroxas commented Mar 10, 2025

Same as capsule gizmo but for cylinders.

This time align segment number between rendering and collision to be able to reuse, leading to even greater gain.

Expect even better gain (more than x30) as previously (as I removed one loop in this one), making those gizmos really cheap to create and edit.

Cylinder with 64 segments
cylinder_64

Cylinder with 360 segments
cylinder_360

I don't really see any difference on my screen, and maybe someone will spot one on some really high res screen, but these are supposed to be cheap debug gizmos, so not having a 4k version should be ok (if not, we can always slightly increase it).

@Calinou
Copy link
Member

Calinou commented Mar 10, 2025

I'd say 64 segments is too little for large cylinders that are several units wide or more. I'd make it 128 instead, which should be a reasonable approximation of the actual collision shape even for large cylinders.

We could make the number of sides dynamic depending on the size, but a static 128 should perform well enough already.

@kiroxas
Copy link
Contributor Author

kiroxas commented Mar 10, 2025

I'd say 64 segments is too little for large cylinders that are several units wide or more. I'd make it 128 instead, which should be a reasonable approximation of the actual collision shape even for large cylinders.

We could make the number of sides dynamic depending on the size, but a static 128 should perform well enough already.

Ok, I'll trust your judgement on that. I'll bump it to 128 and for spheres too

@kiroxas kiroxas force-pushed the improveCylinderGizmo branch from f6f7fc6 to 46428c4 Compare March 10, 2025 17:55
@kiroxas kiroxas force-pushed the improveCylinderGizmo branch from 46428c4 to 8eaab62 Compare March 10, 2025 19:14
@clayjohn clayjohn modified the milestones: 4.x, 4.5 Mar 10, 2025
@kleonc
Copy link
Member

kleonc commented Mar 10, 2025

Note this creates micro gaps at the middle of circles' quadrants (the last points of the in-quadrant octants are not exactly equal). Might be acceptable / not an issue, but wanted to point it out. Note they are sometimes visible:

godot windows editor x86_64_84zbYuZTSS ApAzTTzHcn

@Repiteo Repiteo merged commit ff674de into godotengine:master Mar 11, 2025
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Mar 11, 2025

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.

None yet

6 participants