• entries
    338
  • comments
    2046
  • views
    1155704

AI Pathfinding & Terrain Ambient Occlusion

Sign in to follow this  

948 views

I'm still rushing to have this "small" project out there in the next few weeks, hopefully finished [ offline mode ] by the end of the month, and the 64-player networked games working a week or two after that. I should come in A little over half of my projected 4 month timeline on this new game.

AI Pathfinding / Terrain Navigation

As promised, I finished the pathfinding aspects today...the scene actors can navigate the environment avoiding trees, water hazzards, and whatever else needs to be avoided.

I handle the pathfinding on a few levels, first I resolve the path on a global, 'tile' scale. As the actor is traversing the generated path, they will make slight adjustments to avoid things like, other actors, or medium sized rocks, etc.

First off here is a raw output of the "AI walkability table" that is generated when each map is loaded...and is used to resolve the path on the global level.


White = walkable.
Black = unwalkable.

Now that I've got my walkability table generated, let's see some in-game debug visualization of the AI paths [ I always love these :-D ]

btw. Ignore the blue triangles, that is part of an optimized raycast debug function that I wrote to speed raycasts up, the visualization is just part of the world-space picking ray cast from the camera/mouse pointer.









So yea, now that I've actually got a working pathfinding system...you know what that means??? ZOMG BATTLEZ :-o I will have video footage from the front lines very soon.

I'm still rushing to have this out there in the next few weeks, hopefully finished [ offline mode ] by the end of the month, and the 64-player networked games working a week or two after that.



A random picture of a tank


Oh yea, I went there.




Terrain Ambient Occlusion


I know screen space AO is all the hotness lately, so I've taken a step back like 10 years and just computed the ambient occlusion as an offline pre-process...because I'm cool like that.

Actually I did it because I'm going to use the resources for the SSAO to render dynamic light shafts / crepuscular rays :-o This effect is really awesome if done correctly, so hopefully I can do that.

Anyways back on topic lol, it's very easy to generate the ambient occlusion for terrain as an offline process [ I was actually using it as a precursor to implementing Oats' Ambient Aperture Lighting algorithm, but went for a different terrain shadowing/lighting algorithm, this ambient occlusion is just a small part of it.

So basically what you want to do is determine the average occlusion ( how visible ) a point in 3D space is. You do this by casting a bunch of rays from the 3D point [ in the shape of a hemisphere ;-) ], and based on the number of rays that escape into the atmosphere, you can determine the average occlusion of that location.

I load a hemisphere model of various resolution and use it to cast the rays. Here is a visualization of the 19 rays I cast for each point on the terrain...



So what does this raycasting get me?

A purdy image like the following is the direct output of the offline ambient occlusion...



Here are 2 small images showing only the terrain, rendered with the ambient occlusion. You can see how it adds yet another layer to the terrain's lighting equation, and I think it's surely worth the few minutes of pre-calculation.


Alright guys, back to work I go.

More updates soon!

- Danny
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now