highlighting terrain sections

kungfoomasta

20-10-2008 17:53:09

The next big task for the project I'm involved with requires implementing the Polygon Soup pathfinding algorithm discussed on gamasutra. (and somewhere on Ogre showcase) I'm wondering if anybody has written any code sort of like terrain decals, but tailored for generic terrain regions. (will help debugging and developing algorithm)

For example, lets say I want to highlight the terrain from xz(0,0) to xz(100,100). The most efficient way would be to have a manual object and create lines that match the verticies of the terrain, right? How can I go about iterating through the vertices of a given region and creating a decal-like object? Any API references or approaches would be helpful.

CABAListic

20-10-2008 18:30:25

Hm, the simplest way to do it would be to use a white texture on which you paint the parts you want to highlight in a desired colour. You would then modulate the terrain by this texture (basically using it as a colour map), potentially with disabled texture filtering. Granted, it might not look too nice, but would be a relatively simple approach.

SongOfTheWeave

26-10-2008 09:28:14

The next big task for the project I'm involved with requires implementing the Polygon Soup pathfinding algorithm discussed on gamasutra. (and somewhere on Ogre showcase) I'm wondering if anybody has written any code sort of like terrain decals, but tailored for generic terrain regions. (will help debugging and developing algorithm)

For example, lets say I want to highlight the terrain from xz(0,0) to xz(100,100). The most efficient way would be to have a manual object and create lines that match the verticies of the terrain, right? How can I go about iterating through the vertices of a given region and creating a decal-like object? Any API references or approaches would be helpful.


Actually, I just implemented that technique... and yeah, visualisation is a pain. I just added thousands of wire bounding boxes (which absolutely KILLS, probably due to absurd batching inefficiency).

Some of the problems you're going to run in to are needing quite a few specialised spatial partitioning data structures (like an oct-tree, and an MX-CIF Oct-tree). And the author doesn't mention how he expects to do some things like... convert a portal list into a path (which is about 100 times harder than you think it will be. Seriously.) and then more importantly how to run your A* in a way that gives you the best path in cases where portals are long (and they will be) where estimating the portal location as the center of the portal doesn't cut it.

Anyway, if you solve either of those two related problems I'll gladly trade you my implementation (which includes serialisation).