dynamically update or regenerate navmesh?

1,209 views
Skip to first unread message

Peng Zhang

unread,
Feb 2, 2013, 6:47:41 AM2/2/13
to recastna...@googlegroups.com
Hi,
    I'm now working on a project which not only contains static world geometry but also needs to add or remove some dynamic geometry. For example, a player can build a house(with a door) over a terrain, and then he can find a path from outside into that house. I've looked around recast, and using TileCache seems  make sense to dynamically     
update the tiles the house is in and then regenerate the navmesh. Is this idea right or can someone give me a right way to do that in recast? Thanks!

Mikko Mononen

unread,
Feb 2, 2013, 3:16:46 PM2/2/13
to recastna...@googlegroups.com
Hi,
Tile cache is best for simple obstacles like crates and barrels which
can move or are added and removed. If your house has multiple floors,
then you should use the regular Recast process to rebuild a tile.
There quite a few games our there which have chosen this approach. The
important thing for you to test is to find a good tile size so that
the rebuild times are not too long.

--mikko
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "recastnavigation" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to recastnavigati...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Peng Zhang

unread,
Feb 4, 2013, 7:21:57 AM2/4/13
to recastna...@googlegroups.com
Hi,
I take your advice and see the sample  "Sample_TileMesh". There is one problem that I can't figure out. I dived into the "buildTileMesh" function and it passed the overlapped chunkyMesh's vertices and triangles to "rcMarkWalkableTriangles". When I build a house over a terrain, do I need to add all the house's vertices and triangles to one geometry buffer and then generate the chunkyMesh? and After that, I can rebuild the tiles the house affects? I have this problem because when I try to place a box in one tile and use this 'box InputGeometry' to "buildTileMesh", then in that tile only the box has navmesh poly details, so I think I should add the box's vertices to the whole terrain then rebuild affected tiles, but this seems not so convenient since box and terrain have their own triangle buffer data. Maybe I think the wrong way, and I will appreciate that if you could give me some advice, thanks!

Mikko Mononen

unread,
Feb 4, 2013, 11:58:08 AM2/4/13
to recastna...@googlegroups.com
Hi,

When you do your own integration, you do not need to create chunky
trimesh. Chunky trimesh is RecastDemo's way to quickly query large
input meshes so that it only needs to handle a subset of triangles
when processing one tile. When you regenerate a tile, you will need
all the input geometry that touches it. I recommend to use your own
engine's world query to get the relevant meshes and entities.

Take a look at Recast.h, there are functions to rasterize one
triangle, indexed triangles (draw elements) and flat list of triangles
(draw array). You can use any combination of them during the
rasterization phase.


--mikko

Peng Zhang

unread,
Feb 5, 2013, 10:23:25 PM2/5/13
to recastna...@googlegroups.com
Hi,
Thanks for your patience as my English is not so good. And your reply really helps me. :)

acc1122aradel

unread,
Nov 6, 2015, 7:15:18 AM11/6/15
to recastnavigation
Hello, Running into a similar situation.

I was just wonder. During the TileCache rebuild process.
Would it be possible to directly modify the heightfield in the recastlayer by having predefined layouts stored in voxel representation and overwriting the data from the original mesh?
If the heightfield and areas are set in a correct way the generation process should take care of the rest right?

Mikko Mononen

unread,
Nov 6, 2015, 9:20:36 AM11/6/15
to recastna...@googlegroups.com
Hi,
It is possible to adjust the tile cache height field, but you will need to be super carful so that the dilation and available height and all that jazz works correctly. It will be easier to tweak the tile size and data you pass to recast and rebuild tiles.

--mikko

For more options, visit https://groups.google.com/d/optout.

Amila Madusanka

unread,
Nov 9, 2015, 10:03:51 AM11/9/15
to recastnavigation
Hi Mikko,
I have a small question. Can we subdivide the navigation mesh in to smaller arbitrary points so the latter added object (i.e house) will make new polygons?. I`m asking a to modify the navmesh without having the geom.   thanks

Mikko Mononen

unread,
Nov 9, 2015, 10:15:07 AM11/9/15
to recastna...@googlegroups.com
If you add stuff later, then you will need to rebuild. Tile cache can be used to speed up the common case where you move semi-static obstacles (think crates and barrels in a shooter game).

--mikko

Mark Woo

unread,
Dec 8, 2015, 4:08:33 AM12/8/15
to recastnavigation
你好,我也是使用Recast Navigation在我的项目里面,也是遇到了网格动态生成的问题,请问能够提供一个联系方式讨论一下这个?

cfl443...@gmail.com

unread,
Sep 2, 2016, 1:33:09 AM9/2/16
to recastnavigation
Counld you give me  some steps how to rebuld the some tiles without reload the InputGeom?I browse your above-mentioned,I get confused.
When I add the bridge in the scene,Do I need to add the bridge's verts and  tris to the InputGeom,or not used the chunky trimesh,directly rasterize one triangle?

Sorry,My English is bad!


在 2013年2月5日星期二 UTC+8上午12:58:08,Mikko Mononen写道:

Charles Clark

unread,
Sep 19, 2016, 6:05:11 PM9/19/16
to recastnavigation
My best guess on this is that if you can't reload the input geometry, you would rasterize your bridge to it's own heightfield and then merge the results with the original heightfield.  You would have to keep the original one around so you can merge the spans, but once you complete this you would simply pass it along to the rest of the generation flow.  Keeping the original heightfield around is pretty memory intensive for some applications, so I'd recommend checking out what the TileCache does with compression using fastLZ.  You could retrofit this to compress and decompress the heightfields for each tile at runtime and get pretty good results.
Reply all
Reply to author
Forward
0 new messages