Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

tiled navmesh generation Fails #162

Closed
yelouafi opened this issue Sep 25, 2023 · 7 comments
Closed

tiled navmesh generation Fails #162

yelouafi opened this issue Sep 25, 2023 · 7 comments
Labels
bug Something isn't working

Comments

@yelouafi
Copy link

yelouafi commented Sep 25, 2023

Drop this file on https://navmesh.isaacmason.com/

Case 1: Generate a tiled mesh with cell size 0.1 and tileSize: 32

Navmesh generation fails with Aborted() error

Also seems the lib isn't recovering, retrying with other params always gives Aborted after the first error.

Case 2: reload, drop the file and generate with 0.2 cell size

The navmesh bounds do not cover the whole input meshes

Screenshot 2023-09-25 at 19 07 09

Also noticed the non recovery issue happens whenever the generation fails (for example after solo generation fails for big scenes, retrying with different params seems to fail instantly)

@yelouafi yelouafi changed the title tiled navmesh generation Failed tiled navmesh generation Fails Sep 25, 2023
@isaac-mason
Copy link
Owner

Thanks again for the repros! I'll do some investigation soon and get back to you.

@isaac-mason
Copy link
Owner

isaac-mason commented Sep 26, 2023

Both of these issues appear to be memory related.

For this larger model, it looks like the cell size and tile sizes can be increased a fair bit without sacrificing much precision, which would at least mitigate these issues as nav mesh generation would require much less memory.

Digging into the causes though -


Re case 1: the failure here is emscripten reaching it's currently configured max memory limit - 2gb.

Here's a relevant log from a debug build:

Cannot enlarge memory, asked to go up to 2147487744 bytes, but the limit is 2147483648 bytes!

I've got a couple of WIP changes to help with this.

First, I've got a fix that will lower the max memory usage for generateTiledNavMesh and generateTileCache when keepIntermediates is false. Right now tile intermediates for nav mesh generation are only released after processing all tiles or on failure. I'll change this so they are released after processing each tile. You can track that here: #163

Second, I'm adding a "keep intermediates" checkbox to the navmesh generator website that can be unchecked when attempting to generate navmeshes for large models.

I can also look into whether this limit can be raised, but consuming 2gb of memory in a browser is unideal 😅
I'm also not sure whether the heap can be shrunk, that needs looking into.


Re case 2: after some number of tiles are processed and added to the nav mesh, navMesh.addTile starts failing with an error code for failing to allocate memory.

This one I still need to do some more investigation on. It doesn't look like emscripten's wasm heap is reaching 2gb, so maybe the error is misleading and has a different meaning.

@isaac-mason isaac-mason added the bug Something isn't working label Sep 26, 2023
@isaac-mason
Copy link
Owner

Also seems the lib isn't recovering, retrying with other params always gives Aborted after the first error.

I'll also look into this 🙂

@yelouafi
Copy link
Author

Thanks! Yeah I think I can get good results and also faster gen time with 0.5. Although I’m sticking to solo navmesh right now since I noted some navigation issues with tiles (most likely related to the pruning issue)

@isaac-mason
Copy link
Owner

Noted! I'm going to spend some time improving the debugging tools (#165), and after this I'll circle back here hopefully better equipped.

@Samsy
Copy link

Samsy commented Feb 26, 2024

Hello there !

Having the exact same issue with the tiling

@isaac-mason
Copy link
Owner

Hey @Samsy, if you can share your model and code I'm happy to take a look 🙂

Repository owner locked and limited conversation to collaborators Apr 21, 2024
@isaac-mason isaac-mason converted this issue into discussion #336 Apr 21, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants