AI Pathfinding & Terrain Ambient Occlusion

Published January 21, 2009
Advertisement
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 <br><br>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.<br><br><IMG SRC="http://www.radioactive-software.com/images/AI_Pathfinding1.jpg" border="0"></A><br><br><IMG SRC="http://www.radioactive-software.com/images/AI_Pathfinding2.jpg" border="0"></A><br><br><IMG SRC="http://www.radioactive-software.com/images/AI_Pathfinding3.jpg" border="0"></A><br><br><IMG SRC="http://www.radioactive-software.com/images/AI_Pathfinding4.jpg" border="0"></A><br><br>So yea, now that I've actually got a working pathfinding system…you know what that means??? <b><i>ZOMG BATTLEZ :-o</i></b> I will have video footage from the front lines very soon.<br><br>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.<br><br><br><br><b>A random picture of a tank</b><br><br><br>Oh yea, I went there.<br><IMG SRC="http://www.radioactive-software.com/images/RandomTank.jpg" border="0"></A><br><br><br><br><b>Terrain Ambient Occlusion</b><br><br><br>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.<br><br>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.<br><br>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.<br><br>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.<br><br>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…<br><br><IMG SRC="http://www.radioactive-software.com/images/AO_Raycast.jpg" border="0"></A><br><br>So what does this raycasting get me?<br><br>A purdy image like the following is the direct output of the offline ambient occlusion… <br><br><IMG SRC="http://www.radioactive-software.com/images/AO_Output.jpg" border="0"></A><br><br>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.<br><IMG SRC="http://www.radioactive-software.com/images/AO_Ingame.jpg" border="0"></A><br><br>Alright guys, back to work I go.<br><br>More updates soon!<br><br> - Danny<div> </div>
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement