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

Error when baking navmesh for very large mesh #28624

Closed
Toshiwoz opened this issue May 2, 2019 · 9 comments · Fixed by #28806
Closed

Error when baking navmesh for very large mesh #28624

Toshiwoz opened this issue May 2, 2019 · 9 comments · Fixed by #28806

Comments

@Toshiwoz
Copy link
Contributor

Toshiwoz commented May 2, 2019

Godot version:
3.1.1 official

OS/device including version:
Windows 10 (x64)

Issue description:
When I try to bake navmesh for a very large mesh a terrain mesh made of 64x64 Quads (I mean 2 triangles) each triangle is more than 300mts (I mean godot units), I get this message:

ERROR: _build_recast_navigation_mesh: Condition ' !rcCreateHeightfield(&ctx, *hf, cfg.width, cfg.height, cfg.bmin, cfg.bmax, cfg.cs, cfg.ch) ' is true.
   At: modules/recast/navigation_mesh_generator.cpp:182

Now, if I reduce the size (not scale) of the same mesh, it works flawlessly.
I tried to change the default values, but, as I have no Idea of certain parameters, I can't tell which one I have to change and how, so I did it randomly, but the best result I could obtain was an infinite wait, that in the end leeds to have my computer almost freezins (CPU process always around 25-30%, still, sometimes Windows becomes super slow in responding, I have a 5th gen i5 CPU).

Workarounds to upscale (yes, this time using the scale value in the node transform) the small mesh does not work as my units will move far above ground, funny but not what I want.
As my terrain is massive, but still super simple, I believe there should be a way to make it work.

Steps to reproduce:
I have created a sample project, it has 2 meshes (that I created on another project with GDScript), one is small, one is super large.
Try to bake navmesh of the small one, it works.
Then try to bake the superlarge, nothing is generated, but the console output returns the error mentioned.

Minimal reproduction project:
LargeNavMesh.zip

How do I feel about it 😥
Please, help me out, this time I'm trying to come out with a full game, and I'm putting a lot of effort into it.
If I'll have to delay it to Godot 4 or later I know I'll be very sad (I won't move to Unity nor any other game engine as Godot is GREAT).

@Toshiwoz
Copy link
Contributor Author

Toshiwoz commented May 2, 2019

I also tried to simplify the mesh to a 16x16 one, and changed the parameters, usually to highest values (but not for agent), and it generated the heightfield, was eroding something something (sorry couldn't remember what it eroded, I guess slopes), and it crashed.

@Ace-Dragon
Copy link

A couple of things to try.

  • Make your Navmesh in Blender and use the Better Collada Exporter with the -navmesh tag in the object name. This will import as a navmesh in Godot, the only downside is that the exporter does not create a navigation node, so you need to save the navmesh to a file in Godot and create it in your scene by way of creating a navmesh node. If your levels aren't generated dynamically this could work.
  • Untested, but maybe subdivide the very large mesh so it has smaller faces?

Either way, Godot should at worst show an error message box if something is not meant to work, so the bug is valid.

@Toshiwoz
Copy link
Contributor Author

Toshiwoz commented May 6, 2019

The only way would be to subdivide it into smaller meshes, I'm generating on the fly the whole planet Mars, so I can't store all that data.
But I don't even know if actually I can bake navmesh from GDScript.

@Toshiwoz
Copy link
Contributor Author

Toshiwoz commented May 6, 2019

But, yeah, I'm here to report an issue with the engine, more than finding a soultion to my case.
It shouldn't crash at least.

@bojidar-bg
Copy link
Contributor

The test project has a huuuge mesh, I can't even see all of it with the maximum Z-Far plane setting in the editor. Maybe you should still downscale it a bit?

That being said, I increased the navmesh's "Cell size" property to 1, and tried to bake the mesh. Didn't manage to get a navmesh after 1 hour and a half. In the process it used needed just 18 GiB of RAM.

At 0.01 scale, it bakes under a few seconds, even with the default cell size.

I think the error you are observing might be from not having enough RAM memory to fit the whole voxel heightfield at once, which is needed to generate the navmesh.

@Toshiwoz
Copy link
Contributor Author

Downscaling might be an option, I'll have to do it with everything tho, terrain, buildings, units.
But probably a custom A* algorithm would fit better my case I guess, I had a version that was aaalmost working with GridMap, but now I'm not using gridmap anymore and Just a mesh generated on the fly, that, by the way, improved performance a lot.

With that said, it would be nice to have a sort of warning, so that none will ever try that.

@bojidar-bg
Copy link
Contributor

@Toshiwoz I just tried setting Cell size and height larger than the allowed values, and it seems to work just fine. Going to PR it in a moment :)

@Toshiwoz
Copy link
Contributor Author

Thank you, that's great news.
So that means I can simply put greater values for larger meshes as the one in the example?
And in my particular case would be those 2 values you mention (Height and Cell size)?

@bojidar-bg
Copy link
Contributor

Given that it worked when I scaled the mesh to be 100 times smaller, it should work with the unscaled mesh and cell values 100 larger. Make sure to change the Agent values so that they fit as well though.

kiku-jw added a commit to kiku-jw/godot that referenced this issue May 16, 2019
* [TileMapEditor] Improve tool picking usability

When KEY_CONTROL is released, go back to the last tool.

Also add a tooltip for paint button with shortcuts for line draw and
rectangle paint.

* Make buttons that trigger popups have the same scale

* Make 'Line/TextEdit's context menus hide their editing options when in readonly mode

Fixes godotengine#28243.

* Renames captions of Scalar/VectorInterp in Visual Shaders

* Warn when opening imported anim in AnimationPlayer

* C#: Support resource type hint in exported arrays

- Elements of types like PackedScene will display with the special editor for such type.

* Fixed GLES2 transparency order

* Added an is_valid function to FuncRef so script can check if it is safe to call it.

* issue-28446 - disable higlighting all occurences of string in editor if only whitespaces are selected

* Set range for line spacing

* Fixed a few issues with the bezier animation track editor, fixed the Travis CI errors, added TTR to bezier value labels and rounded them to 3 decimal points

* Add and expose to Font a function to get the rect size needed to draw a word-wraped text

* Fix build error after godotengine#27294

* SCons: Always use env.Prepend for CPPPATH

Include paths are processed from left to right, so we use Prepend to
ensure that paths to bundled thirdparty files will have precedence over
system paths (e.g. `/usr/include` should have lowest priority).

* Properly expose PhysicsServer methods

* Forgot a parameter in the ARVR gdnative bindings for notifications

* Fix sign-compare error from godotengine#26051

* doc: Sync classref with current source

* GridMap editor fixes and improvements

This change fixes a few outstanding issues and greatly improves the usability
of the GridMap editor through the following changes:

- Copied mesh now gets displayed during pasting (also renamed the related
  identifiers accordingly)
- Duplication/paste indicator now gets rotated around the correct pivot point
  (duplication worked properly before, but the indicator was shown misplaced
  when rotated)
- Selected mesh library item cursor is no longer shown during selection and
  duplication/pasting
- Back rotate X/Y/Z is now working during duplication/pasting
- Added true cut operation thanks to now having a proper clipboard (clear
  operation got remapped to the DEL key)
- Got rid of some weird workarounds in the duplication code
- Fill and clear operations now correctly make the selection marker inactive
  as this was broken partly due to the workarounds mentioned above
  (duplication continues to keep the selection marker active to allow
  subsequent duplications)
- Clear current selection on RMB, but treat selection as an action so previous
  selection can be restored on undo
- Separated selection and paste indicator data as it's prone to error and
  confusion and it's anyway needed now that selection is treated as an action
- Added support for cancelling paste, selection, and even unselect the
  currently selected mesh library item with the ESC key (previously there
  wasn't a way to unselect)
- Changed the key binding of fill/clear/duplicate operations to use Ctrl as a
  modifier
- Changed erase to use RMB instead of Shift+RMB (free look is available
  through Shift+F anyway, so no need to occupy RMB for it during gridmap
  editing)
- Removed unused area, external connector, and configure menu items (there's
  also the non-functional clip mode menu items, but I'm not sure whether there
  are any plans with that, I suppose it's meant to be an editor aid)
- Renamed INPUT_COPY to INPUT_PICK to better reflect its purpose
- Added support for using Shift+Q and Shift+E to select multiple floors/planes
  without actually changing the current floor/plane as it happens when using
  e.g. the mouse wheel

Fixes godotengine#25373 and godotengine#15883

* Fix script dialog path validation to handle spaces correctly

* fixes bug when setting projection matrix

* Make "decimal" functions more consistent

In GDScript, rename "decimals" to "step_decimals". In C#, add "StepDecimals", but keep the old functionality in a method called "DecimalCount".

* Fix missing argument for vsnprintf_s

* fixes 27543, adds a copy button for the editor log

* Fix regression on 'PopupMenu's minimal size

* Fixed game crash, regression of godotengine#26977

Co-authored-by: bruvzg <[email protected]>

* Small documentation improvements

* Fix pvrtc encoder
Always resize image to square of power2
Enable mipmaps only if original texture has it enabled
Fix godotengine#28534, godotengine#28541

* Support Mac OS default move cursor hotkeys

Add missing FALLTHROUGH define

* Fix Remove Missing Project projects on Windows

* Revert "Update libwebsockets to 3.1 (plus UWP patch)"

This reverts commit 90210c4.

* Added missed inputs for other modes in visual shaders

* Change order of Visual Script Search.

Previously:

* vs nodes
* properties
* methods

Now:

* properties
* methods
* vs nodes

* VS: Better ux

* In VS functions' put the current node type first.
* Cleanup and merge property and method sections.

* VS: Give the generic search the current base type.

* Freetype clone env for no-SMID single file

Fix freetype build issue for javascript platform.
When disabling optimizations (SMID) in specific freetype, source files,
we need to make sure to copy all other CPPFLAGS, not just override them.

* Fix First Ctrl+R and Ctrl+F not showing long name variables correctly

* Add a property hint for DynamicFont size

This caps its size to reasonable values in the Inspector.

This closes godotengine#22581.

* Fix input entries when switching to new visual shader

* Locales: Add some missing locale names

* Ignore a warning in _get_socket_error (-Wlogical-op).

drivers/unix/net_socket_posix.cpp: In member function 'NetSocketPosix::NetError NetSocketPosix::_get_socket_error()':
drivers/unix/net_socket_posix.cpp:197:22: warning: logical 'or' of equal expressions [-Wlogical-op]
  197 |  if (errno == EAGAIN || errno == EWOULDBLOCK)
      |                      ^

and:

modules/mono/utils/string_utils.cpp: In function 'int {anonymous}::sfind(const String&, int)':
modules/mono/utils/string_utils.cpp:68:48: error: logical 'or' of collectively exhaustive tests is always true [-Werror=logical-op]
      found = src[read_pos] == 's' || (c >= '0' || c <= '4');
                                       ~~~~~~~~~^~~~~~~~~~~

* Fix typed arrays and dictionaries getting their values shared

* Document CollisionObject2D pickable requires collision_layer

Documents CollisionObject2D mouse_entered, mouse_exited and input_event requiring at least one collision_layer to be set.

* Fix slight issues with autocompletion and member lists in GDScript

Fixes godotengine#27152
Fixes godotengine#28591

* Fix regression in 'PopupMenu' when icons have different values for width and height

* Fix script dialog asking for correct inheritance when not needed

* Make small changes to the script dialog

* Add "disabled" icon for 'CheckButton'

* Hide "Built-in Script" option in the script creation dialog when not possible

* Fix Mac OS move cursor behaviour

* added MSAA to GLES backend

* Make "Find in Files" always available in the script editor

* Fix build visual_shader_editor_plugin

* Remove unused `panelf` and `panelnc` styles

Fixes godotengine/godot-docs#2426

* Fix collapse visual shader tree

* Fix navmesh not finding optimal paths

Addresses part of godotengine#17885

* Update of RigidBody2D class description

Added a hint in the RigidBody2D class description regarding the transformation issue mentioned in godotengine#5734

* Make 'TabContainer' update when icon/title is changed

Fixes godotengine#28655.

* Fixes VideostreamGDNative crash on audio_channel=0.

Added an if case to check if the mix_callback exists before running any
of the audio code.

Fixes: godotengine#28644

* Support Mac OS default delete char hotkeys

* Document dictionary erase return value

* Fix ParallaxBackground breaking when moving it out the scene tree

* fix CollisonShape changing shape cause crash when not in a tree

* Fix generation of Mono Glue for Visual Studio 2017+

vsnprintf definition should only be changed when MSC version is older than 2013. The version check and fix is taken from StringUtils.h of assimp.

* Fix 'TabContainer' not updating its tab titles when locale is changed

* Make editor close empty scene when creating an inherited one

Fixes godotengine#28654.

* Update AUTHORS and DONORS list

New contributors added to AUTHORS:
@Kanabenki, @KoBeWi

Thanks to all contributors and donors for making Godot possible!

* Remove reduz from some autorequested code reviews

He's still one of the main architects of some of these code branches,
but quite often PRs that modify one or two files in such folders don't
necessarily need his input, and he has enough backlog to handle.

PR triagers will ask for his review manually whenever relevant. He's
left as code owner for physics/visual servers and rendering backends.

* Center shape according to logic Bullet applies

* Add transform support to deal with Bullets centering of shapes

* Fix SHADOWS_DISABLED flag in GLES2

Signed-off-by: Guilherme Souza <[email protected]>

* Improved the AnimatedSprite docs; added description to speed_scale.

* Revert "Merge pull request godotengine#28715 from YeldhamDev/inherent_scene_close_empty"

This reverts commit 0f8356d, reversing
changes made to 7b7a664.

* Change empty scene closing on new inherented scene to a better approach

* Fix texture resource reload bug

If a non-imported texture resource file (e.g. DDS) gets updated the editor
doesn't reload it. The cause of the problem is two-fold:

First, the code of ImageTexture assumes that textures are always imported
from an image, but that's not the case for e.g. DDS. This change thus adds
code to issue a resource reload in case an image reload is not possible
(which is the case for non-imported texture resources).

Second, the code is filled with bogus calls to Image::get_image_data_size()
to determine the mipmap offset when that should be done using
Image::get_image_mipmap_offset(). Previous code literally passed the integer
mip level value to Image::get_image_data_size() where that actually expects
a boolean. Thus this part of the change might actually solve some other
issues as well.

To be pedantic, the texture_get_data() funciton of the rasterizer drivers is
still quite a mess, as it only ever returns the whole mipchain when
GLES_OVER_GL is set (practically only on desktop builds) but this change does
not attempt to resolve that.

* Docs: Add tutorials for KinematicBody2D

* Revert "Merge pull request godotengine#26053 from qarmin/back_scroll_to_start"

This reverts commit b5deb1d, reversing
changes made to 2cc8848.

This change causes unwanted regression.
It's too risky to have scroll back to top in ItemList.clear()

* Scroll back to top when changing directory in FileSystem dock

Fix godotengine#26041

* [EditorSpatialGizmo] Fix error in intersect_ray

* Avoid _can_call_mode resetting error message in MultiplayerAPI

* Change "ID" to lowercase "id"

Reasoning: ID is not an acronym, it is simply short for identification, so it logically should not be capitalized. But even if it was an acronym, other acronyms in Godot are not capitalized, like p_rid, p_ip, and p_json.

* Fix AudioEffectRecord messing up the effect stack by not writing to dst_frames

* X11: Check if "_NET_FRAME_EXTENTS" atom is supported.

* Fixes to ClippedCamera

This work has been kindly sponsored by IMVU.

* Allow or_greater for most properties of NavMesh

Closes godotengine#28624

* Open selected folder when pressing the "Open" option in the menu

An attempt to fix godotengine#28798

* Add RegEx substitution testcase and fix relevant docs

(cherry picked from commit a31bbb4)

* Make possible to create inherited scenes via the RMB menu in the FileSystem dock

* Fix orientation of generated navmeshes

Fixes godotengine#23817

* Apply sprite frames editor FPS value correctly upon _animation_select

* updated description of Array.shuffle to properly describe that it uses the same common seed at every runtime, thus being reproducible in general

* AnimatedSprite: Add from spritesheets now work as expected. Fix godotengine#28030

* Better handle some self-RSET/RPC in MultiplayerAPI

Allow calling yourself via RPC/RSET if the mode allows it.
Better error messages when you are not allowed to call yourself.

* Fix GDNative library resource loading.

Store general properties in ConfigFile too when modifying them.
Additionally set config_file property as internal as it's not editable
from inspector. It also does not appear to get saved in a meaningful way
(saved as Object(ConfigFile, ...))

* added radiance when using clear color and fixed brdf

* Properly update script button when undoing a script addition

Fixes godotengine#28870.

* Improve the CanvasItem documentation

This makes it clear that line width and antialiasing in
`draw_multiline()` aren't implemented yet (see godotengine#16448).

* Make Xcode recursive search frameworks in project dir

* fix lighting bug introduced in clear color changes

* Fix NaN with get_action_strength

* doc: Sync classref with current source

* doc: Fix issues found by the parser

* Update GDNativeLibrarySingletonEditor.

Moved GDNative singletons discoverer from register_types to
GDNativeSingletonEditor.
Fix enable/disable switch in GDNativeLibrarySingletonEditor.
Separate `gdnative/singletons` and `gdnative/singletons_disabled`
project settings, keeping "on by default" behavior.

* Fix OS_Javascript execute method

Signature was changed in OS via:

cd4449e

* Fix indexing failure in NativeScriptLanguage::unregister_binding_functions.

binding_functions.size() and an instance's binding_data.size() can get out of sync. They sync up when an instance's bindings are requested. When binding functions are registered after creating an instance's bindings, the instance's bindings are out of sync until requested again. If they're never requested, they're never synced.

unregister_binding_functions indexes into binding_data, but only checks that its safe to index into binding_functions. When they're out of sync, indexing fails.

This revision checks that it's safe to index into binding_data.

* Fix OS_UWP::execute's signature after cd4449e

Same as godotengine#28919.

* Revert "Revert "Implemented terrain raycast acceleration""
myhalibobo pushed a commit to myhalibobo/godot that referenced this issue Sep 3, 2019
akien-mga pushed a commit to akien-mga/godot that referenced this issue Nov 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants