daleblackwood / goshapes

Intuitive path-based level editing for Godot 4
MIT License
127 stars 16 forks source link

in-editor performance when using a WallMeshShaper with a non-trivial mesh does not scale (PR) #15

Closed GGAlanSmithee closed 1 day ago

GGAlanSmithee commented 3 weeks ago

Hi @daleblackwood

First of all a huge thank you for this amazing addon. I've been looking for something like this for a while, and found this just today, and must say I really love how easy it is to create levels with this tool.

NOTE: I am using the v1.2 branch

I have found one issue though, which is that - if I use a WallMeshShaper with a non-trivial mesh - the performance in the editor gets bad real quick as the shape grows. (see the two videos attached for the difference between a low poly wall and a box). I had a quick look in the code, but haven't really started digging yet, but from what I gather, it's probably down to the fact that the WallMeshShaper.build_sets function simply takes times (which is probably reasonable).

Since I don't (yet) understand the code well enough, I can't speak to what potential performance improvements there are, but one potential solution could be to allow the user to set a placeholder mesh that is used while editing, and then require a baking step, where the actual mesh is only used. This work-around is possible as-is but requies you to manually swap the mesh in the editor.

Another annoying problem is that the Goshape is flagged as dirty too quickly. For example, as soon as I give focus to the shape, the entire shape is rebuilt, without me even editing anything.

Also, please let me know if this is a user-error on my ned, and again, thanks for your hard work. I will keep looking if I can come up with some more useful input in this issue.

OBS this is only regarding the in-editor performance, once the shape is built, the performance is perfect.

https://github.com/user-attachments/assets/ab0cee5d-7b53-4ad0-a0e9-852126020e85

https://github.com/user-attachments/assets/b518be21-db27-458a-9420-a117f7f610eb

image

GGAlanSmithee commented 3 weeks ago

here is a video showcasing the second issue, which is that the Goshape gets rebuilt on focus. It's a bit hard to illustrate, but I click the wall and the ground respectively (both Goshapes) as soon as the cursor moves over respective object.

https://github.com/user-attachments/assets/d5e752cb-17d0-44e9-bd76-3b8b5b20e1c0

GGAlanSmithee commented 2 weeks ago

I added the option to allow for a placeholder_mesh which is a very straight forward implementation, and which greatly improved the developer experience. I will send a PR, in case you are interested.

https://github.com/user-attachments/assets/139c75b1-7a77-4031-82aa-a9b6df9467c4

daleblackwood commented 1 week ago

Hey @GGAlanSmithee - I've made a pretty big update that refactors the mesh generation to be on a separate thread, it's working well in my limited tests, but I could use feedback. Feel free to test it out: https://github.com/daleblackwood/goshapes/pull/41

GGAlanSmithee commented 1 week ago

@daleblackwood

Amazing! It's so much better. I have found some minor UX quirks, but nothing major so far. I will post further feedback and possible commits to #41

GGAlanSmithee commented 1 week ago

@daleblackwood also, see #43 for another idea.

daleblackwood commented 1 day ago

I've added a level-of-detail (LOD) mesh for wall mesh. If it's specified, it will be used for the collider instead. It will generate the low detail mesh first, making it a bit quicker.

GGAlanSmithee commented 1 day ago

amazing! I will try it out @daleblackwood many thanks!