Fog of War

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
coder543
Posts: 17
Joined: Sun May 31, 2009 4:40 pm

Fog of War

Post by coder543 »

Is there a simple way to do selective fog of war? Say that I have user controlled ships, planets, and stars. Is it possible for me to make only the ships vanish when outside of the given sensor range?
Kalango
Posts: 157
Joined: Thu Apr 26, 2007 12:46 am

Post by Kalango »

You can make like this:
Each unit you have has an light scene node attached to it (you can also make only one light, depending on the camera position). If enemy units are inside the range of that light, the they're visible, if not, fog of war wont let you see your enemy nodes....
You may have some bugs regarding this technique if you use something like setVisible, try to update the position of your enemy nodes independently of the node(mesh) itself (sorry, realy dont know how to put this in a better phrase).
Anyways....try it!
coder543
Posts: 17
Joined: Sun May 31, 2009 4:40 pm

Post by coder543 »

How would I attach a LightSceneNode to a unit?
Sylence
Posts: 725
Joined: Sat Mar 03, 2007 9:01 pm
Location: Germany
Contact:

Post by Sylence »

Set the parent of the light ndoe to the node of the unit.
Software documentation is like sex. If it's good you want more. If it's bad it's better than nothing.
coder543
Posts: 17
Joined: Sun May 31, 2009 4:40 pm

Post by coder543 »

ok
Darktib
Posts: 167
Joined: Sun Mar 23, 2008 8:25 pm
Location: France

Post by Darktib »

You can use a texture which contains the fow poxer for each tile on the map, pass it to a shader, which will multiply each vertex colour by the coulor of the correponding pixel.
Your fow texture will be in black and white.
Post Reply