How do you do fog of war for a 3d rts?

Started by
8 comments, last by kfcpri 17 years, 9 months ago
The kind of fog of war that grey out the terrain, and only have area that are within range of your units to show a normal color. Is it done with shader? or is it done like a light?
Advertisement
The easiet way i can think of is to project a black texture on every object, for the full size of the terrain, and then alpha blend it.. to open areas up simply write some white pixels to the alpha channel..you could then do some blur post processing if you want.

Additionally, you can have change the alpha value to 50% in areas that have been explored but are not curerently visible or active.. and then keep the areas in an array, and check whether enemy units are in an inactive area, then hide them.
Why are you calling it "fog of war"? Are you referring to Clausewitz?
That's the generally accepted term for it....
but uh........ a visible area is uaully a radial distance around a unit forming the circle right?
I don't know how to reveal this whole circle area. The position(i.e. the center) yes, the other point on the circle no.
well, when you write to the texture, just write a circle of pixels. You can do this by using some kind of texture as a source image.

So basically, think of your fog texture as being a flat texture, then just position a circular sprite over the given area, and then render that.. all this is of course is going on offscreen.

Or you could calculate the cicular pixels mathematically, and just write the pixel directly to the surface..

Maybe there is a "correct" way to do this, but something like this should work fine...I've done it this way.


Quote:Original post by Matt Aufderheide
That's the generally accepted term for it....


Actually, it's not. Fog of war doesn't actually refer to fog or any other environmental effect, but the "fog and friction of war" which are the difficulties that arise in planning and executing battle strategies. Unknown variables in other words.
Quote:Original post by Anonymous Poster
Quote:Original post by Matt Aufderheide
That's the generally accepted term for it....


Actually, it's not. Fog of war doesn't actually refer to fog or any other environmental effect, but the "fog and friction of war" which are the difficulties that arise in planning and executing battle strategies. Unknown variables in other words.


Fog of War is the generally accepted term for the unexplored and blacked out areas that exist in RTS's
--m_nPostCount++
you can add an additional render pass where you only render all units as big circles(billboards with a transparent texture) then project that render target onto the terrain.
"There are 10 types of people in the world... those who understand binary and those who don't."
Finally I've done it, however I don't know how to properly shade the color to look like those kind of grey/darken area.....

This topic is closed to new replies.

Advertisement