   Fog of War
  Hi,I'm thinking about an implementation of FoW for a 3D RTS game.My design of FoW is:•By an unit I mean all characters on screen, whether moving or non-moving, and buildings.•Units have a radius of sight.Units that are:•rendered normally:oneutral and enemy units and a terrain in parts of a map, that are ina radius of any friend unitofriend units •rendered in the grayscale:oneutral units and a terrain in parts of a map, that have been visited yetand aren’t in a radius of any friend unit•not rendered:oneutral and enemy units and a terrain in parts of a map, that have not beenvisited yet The game has a heightmap based terrain which is made of cells. On the other hand, FoW should be asmooth effect.Targeted machines are with SM2 and SM3+(So, my solution should be done by shaders not by  the fixed-pipeline.).I had a few ideas but each of them failed to give smoothness.Is there any conventional way how to handle it?Thank you.   
  I'm not sure I understand the question -- failed to give what kind of smoothness?;  I could keep a flag in each cell whether it has been visited or not. However, in this case the effect wouldn't be smooth(per-pixel precise) but it would be per-cell precise.A guy gave me an advice on another forum and here is my solution:I'll use a texture into which I'll render(I call it FactionTexture in the following text.). I'll use a channel of the texture to keep informations about visited areas(channel A) and another channel to keep informations about radius of units(channel B).So, I'll do a render pre-pass. In the pre-pass, I'll draw a circle around each unit with a radius of corresponding unit into a FactionTexture. Channel A of a FactionTexture will keep 0 for no visited areas and 1 for visited areas. Channel B will keep 0 for no-radius areas and 1 for in-radius areas.The channel A will be persistent during entire lifetime of a map. On the other hand, the channel B will be erased and rebuilded each frame.Units will use a material effect in dependence on their citizenship.-Friendly units use a material that has already been contained in NeoAxis.(The game uses NeoAxis engine.).-Neutral units use a modified material://This is pixel shader source.//oColor keeps a color that has been computed normally.//oGrayColor keeps oColor in the grayscale.//Sample a FactionTexture and lerp between oGrayColor and oColor and keep it in oColor. Use value from the channel A as an interpolation value.//Sample the FactionTexture and multiply oColor with a value from the channel B.-Enemy units use a modified material://This is pixel shader source.//oColor keeps a color that has been computed normally.//Sample the FactionTexture and multiply oColor with a value from Channel B.This solution provides smoothness and doesn't need any dynamic branching.BTW: I hope I wrote this explanation in an understandable way.   