Grid graph on terrain with procedurally generated obstacles

Creating obstacles on terrain at runtime, and using ProceduralGridMover to update graph, which works great so far. Issue is, I want to add penalties for terrain textures to force AI prefer road instead of grass/mud/etc.

I’ve read that I can import texture splatmap to Pro edition to set penalties, but will that work with ProceduralGridMover since its size is much smaller than terrain size?

I can also create a huge graph with same size as terrain, import 1:1 splatmap to A* for penalties, and I can use DynamicGridObstacles on all terrain obtacles. I’ll probably have 25-30 obstacles enabled at most. Do you think this splatmap method will work with Pro edition?

Edit: Another idea, can I use two grid graphs, one for whole terrain for splatmap penalties and one for ProceduralGridMover? I’ll need to modify ProceduralGridMover to update the second, smaller graph I guess.

In case anyone have issue with Vegetation Studio Pro and procedural vegetation, here’s what I did to solve pathfinding with low latency:

Baked every collider for the scene and created an Obstacle Mask for all the colliders. Also, exported terrain splatmap and created 2 channel image for unwalkable/high-penalty zones on the grid. Removed collider check from the Pathfinder and now agent can walk around the map without any spikes.

1 Like

Hi. I apologize for this thread necromancy, but I’m not getting any help with my question. I am using VSPro with (I hope) A*, too. Do you create a VSPro obstacle mask, and if so, how do you make A* recognize it? I can’t leave baked colliders in my scene; my usual workflow is to bake them, bake a Unity navmesh, then delete colliders. I hope I can use a similar workflow with A*…

Thanks!

Hello DancingGoat,

  • Get pro version :slight_smile:
  • Bake all the colliders to the scene
  • Export mask file using VSP obstacle mask creator
  • Delete all the colliders
  • Add VegetationSplatmapGenerator script to the scene
  • Set filename to Resources/Something.png
  • Set terrain.
  • Set size, should be same as the obstacle mask size. Not sure, try and see.
  • Set obstacleTexture in the script to the exported obstacle mask
  • Layers part is not mandatory, but you can use it to add penalty to specific terrain layers. Use layer index and its penalty multiplier.
  • Using context menu, generate vegetation splatmap
  • Use generated file Resources/Something.png in AStar > Graph > Advanced > Penalty Modifications > Use Texture
  • Set R to walkability and penalty, set factor to 0
  • Set G to Penalty, set factor to 100. Not quite sure about layer penalty factor and this one. Try and see.
  • Generate the graph.

I hope that helps. I found the old project in my backups but scene file was incomplete. If I remember correctly, using Resources folder is very very important. Otherwise, AStar fails to find it.

Cheers.

4 Likes

Wow! Thank you so much! I will give it a shot. I just bought Pro yesterday; my other task is to properly integrate it with Ootii and Behavior Designer. Looking forward to better AI nav :smile:

1 Like