Closed yelouafi closed 6 months ago
Thanks again for the repros! I'll do some investigation soon and get back to you.
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: https://github.com/isaac-mason/recast-navigation-js/issues/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.
Also seems the lib isn't recovering, retrying with other params always gives Aborted after the first error.
I'll also look into this š
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)
Noted! I'm going to spend some time improving the debugging tools (https://github.com/isaac-mason/recast-navigation-js/issues/165), and after this I'll circle back here hopefully better equipped.
Hello there !
Having the exact same issue with the tiling
Hey @Samsy, if you can share your model and code I'm happy to take a look š
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()
errorAlso 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
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)