Hi Dev,
I've been thinking for awhile about traditional isometric RTS's on how to do 3D fog of war like that. I dunno if you have found a final solution to what you asked for yet or not, but this is my theory I will approach in which I havn't tested via code... yet.
For a 3D RTS that only pans the camera view with no view rotation what so ever, this method would use some type of fog of war layer configuration over the terrain itself.
The Fog would actaully be setup as a single surface mesh built with enough evenly spaced small polys. This fog mesh will have a single dark color to it and also have EntityOrder to set it to display in front of the terrain. Yes, the Z-Order is out the window for it. The fog of war is usually above everything else on the terrain anyways.
Now, we need an algorithm to match your unit's position on the x/z plane to an array that points to a vertex index of the Fog mesh. So basically here, we want to know exactly the vertex index closest to the center of your unit at all times. Then we alpha the vertex to 0 and then the Fog of War Mesh opens up to let you see your unit and the terrain around it.
Ofcoarse we want more than one vertex to be alpha'd down. My suggestion here is to use some kind of circular array'd pattern to instantly make the Fog of War area around your unit disappear. This pattern can be made to fit a "view range" from the center of your unit. Ofcoarse we want to have an old copy of the pattern to fill in the old fog of war area when the unit is moving. This circular pattern can have various alpha values to make the edges of this circular view range to seem to fade into the dark fog. Also, when a unit view range area merges in with another unit there shouldn't be any problems with various alpha values between the two. Just keep the highest alpha value of the two patterns by comparison( I get that right?).
Thinking more into it, the Fog mesh would probably be more efficient if split up into 9 same sized meshes in which a section is a bit bigger then the size of the current playfield resolution. With that, you can do something similuar as a scrolling 2d tiling effect. This can help to eliminate the "bigger the map the more polys used" problem I see in using only one fog mesh for the whole map. Obviously, coding that is a bit more envolved, but should be more awarding in certain situations.
One thing that eludes me at the moment is thinking how I would approach the algorithm to get the closest vertex of the fog mesh to the center of your unit. Looking directly down on the terrain is easy to calculate, but when you have the iso view from an angle, the alogirthm needs to shift the unit's position in order to get the 'view area' of the unit to be centered with it( I guess a simple tweak of the unit position will do it). Otherwise, we'll definitly get an uncentered circular area in the fog.
---------
Just thought I'd throw this idea out at you or any one else just in case if you are still looking. It will be awhile until I get to program this up. I really like the idea of using the vertex alpha capability this way. Should be able to make some smooth looking effects( ie: mabie different colored fog, the circular area could breath in and out a bit, the circular area doesn't have to be completly circular as in it could have a puffy looking pattern look, unit gets killed then the fog smoothly swallows up the dead unit's viewing area, rotating pattern to only show the field of view, etc...).
talk ta ye laters...
I've been thinking for awhile about traditional isometric RTS's on how to do 3D fog of war like that. I dunno if you have found a final solution to what you asked for yet or not, but this is my theory I will approach in which I havn't tested via code... yet.
For a 3D RTS that only pans the camera view with no view rotation what so ever, this method would use some type of fog of war layer configuration over the terrain itself.
The Fog would actaully be setup as a single surface mesh built with enough evenly spaced small polys. This fog mesh will have a single dark color to it and also have EntityOrder to set it to display in front of the terrain. Yes, the Z-Order is out the window for it. The fog of war is usually above everything else on the terrain anyways.
Now, we need an algorithm to match your unit's position on the x/z plane to an array that points to a vertex index of the Fog mesh. So basically here, we want to know exactly the vertex index closest to the center of your unit at all times. Then we alpha the vertex to 0 and then the Fog of War Mesh opens up to let you see your unit and the terrain around it.
Ofcoarse we want more than one vertex to be alpha'd down. My suggestion here is to use some kind of circular array'd pattern to instantly make the Fog of War area around your unit disappear. This pattern can be made to fit a "view range" from the center of your unit. Ofcoarse we want to have an old copy of the pattern to fill in the old fog of war area when the unit is moving. This circular pattern can have various alpha values to make the edges of this circular view range to seem to fade into the dark fog. Also, when a unit view range area merges in with another unit there shouldn't be any problems with various alpha values between the two. Just keep the highest alpha value of the two patterns by comparison( I get that right?).
Thinking more into it, the Fog mesh would probably be more efficient if split up into 9 same sized meshes in which a section is a bit bigger then the size of the current playfield resolution. With that, you can do something similuar as a scrolling 2d tiling effect. This can help to eliminate the "bigger the map the more polys used" problem I see in using only one fog mesh for the whole map. Obviously, coding that is a bit more envolved, but should be more awarding in certain situations.
One thing that eludes me at the moment is thinking how I would approach the algorithm to get the closest vertex of the fog mesh to the center of your unit. Looking directly down on the terrain is easy to calculate, but when you have the iso view from an angle, the alogirthm needs to shift the unit's position in order to get the 'view area' of the unit to be centered with it( I guess a simple tweak of the unit position will do it). Otherwise, we'll definitly get an uncentered circular area in the fog.
---------
Just thought I'd throw this idea out at you or any one else just in case if you are still looking. It will be awhile until I get to program this up. I really like the idea of using the vertex alpha capability this way. Should be able to make some smooth looking effects( ie: mabie different colored fog, the circular area could breath in and out a bit, the circular area doesn't have to be completly circular as in it could have a puffy looking pattern look, unit gets killed then the fog smoothly swallows up the dead unit's viewing area, rotating pattern to only show the field of view, etc...).
talk ta ye laters...