Search Unity

How to generate Navmesh from very complicated mesh?

Discussion in 'Navigation' started by KB, Dec 18, 2014.

  1. KB

    KB

    Joined:
    Dec 9, 2012
    Posts:
    18
    I picked up the "Underworld: Cave environment" asset and assumed that it would be easy to generate a navmesh (even in Unity free - 4.6). Using the supplied demo scene (an entire cave system) there is nothing obvious in the scene to select for what approximates to a "floor", you simple have this very complicated tube like mesh with the addition of loads of objects like stone slabs etc. There is no terrain so you have to pick a number of the meshes. I figured that I'd just select the whole thing to generate a navmesh from but this was useless. I think there was one tiny spot where I got a navmesh this way. Without a navmesh this very pretty asset is useless.

    So, how to go about doing this in Unity free (and I wonder if Unity Pro copes with such complicated geometry)? Yes, I've done the create a navmesh process (in Unity free) but the result is useless. Is there some other trick?

    Alternatively, is there some script or asset that is capable? I've looked at the A* Pathfinding Pro but the way it works does not look like it would cope either (as the "tubes" that make up the cave system can loop under others etc. and so on, plus with A* it looks like you have specify a cuboid to contain the resulting path but then you'd have to enclose the whole system and would have walk-able bits that are unreachable such as on holes high up in the cave used to stream light/water in that you can't climb up to)?

    Given the number of good reviews that asset has I'm sure there must be a way (other than by hand or something insanely time consuming). BTW; I'm a coder so putting it in an art package to do something is not viable (as I have no art packages beyond GIMP etc!. I'm considering doing it with code but bought the asset to save time not burn it.
    I have emailed the asset people but no reply.
     
  2. KB

    KB

    Joined:
    Dec 9, 2012
    Posts:
    18
    Had another go starting with a reboot!

    This sort of works (using what is a fairly normal procedure I expect): Select the Navigation tab, select the Object tab (on the Navigation tab), select the "All" icon (could be where I'd gone wrong in the past, I may have tried the meshes icon), select the Bake tab (on the Navigation tab), I used default settings here, press the Bake button.

    Well, it works except that there's gaps in the Navmeshs between each module that I don't think should be there. Each module is a large chunk of cave composed of a mesh (plus some extra stuff). Now I know that Unity Pro will link navmeshs but I don't think there should be any gaps such as in this bit here:

    upload_2014-12-20_15-38-44.png

    The modules are right next to each other so the crack between them is not a gap, the navmesh should be continuous. Any suggestions to make the navmesh continuous here?
    (and presumably if you want an efficient navmesh this affects Unity Pro users too because you may not want to have to use navmesh links when you don't need to).
     
  3. KB

    KB

    Joined:
    Dec 9, 2012
    Posts:
    18
    OK, I thought I'd solved it by placing a plane in between. As my Unity plane has a lot of polys I decided to use a cube. I seem to be getting some vertical artifacts like here:
    Vertical bit in navmesh.gif
    You can see the gray cube top just sticking though the floor in places. The vertical artifacts don't seem to be connected to the cube edge so I'm assuming it's some other bug that's triggered now that the join between 2 larger mesh's is bridged. Any ideas on dumping those artifacts? Anyone?
     
  4. KB

    KB

    Joined:
    Dec 9, 2012
    Posts:
    18
    I get the vertical artifacts with a plane too (remembering to set it to navmesh static!). I've tried fiddling with the height, size, position and angle of the plane and it made no useful difference (with default settings).

    I then changed the navmesh render settings from default to 0.5 step height, 10.7% width inaccuracy, 5% height inaccuracy and it seems to have worked. It does helps with the example above but I'm a tad nervous that when I add all the other bridge assets some of them...

    I'll let you know if this was just luck should the other bridges I'll now have to add not work out. I don't want to fix one only to find those settings break another bridge. Is it me or does the Unity navmesh generator need a tweak... this is not a very productive way to spend my time (although better than no fix).
     
  5. KB

    KB

    Joined:
    Dec 9, 2012
    Posts:
    18
    The solution in my last message does work.
    Now to solve the crazy 10K+ draw calls that this asset generates in its demo scene at times.