Jump to content
  • Advertisement
Sign in to follow this  
kfcpri

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

This topic is 4424 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Why are you calling it "fog of war"? Are you referring to Clausewitz?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.


Share this post


Link to post
Share on other sites
Guest 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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.....

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!