- Home /
Multi-Unit Fog Of War for Mobile
Hello guys,
I am trying to implement fog of war for my game. It is RTS game which has many Unit (max is about 50 per player) for mobile. Now, i am using grid system for simulation of visibility and field of view. The visibility states are stored in grid node.
For presentation of fog, I am trying to map directly from grid to texture with same size (grid and map size = 256x512) by mapping node visibility to texture pixel alpha. And then use that texture for at quad material like other approach of fog of war.
So, my questions are:
Which performance is better using this approach (draw to texture2d directly) or draw mesh, let camera render it to render texture?
How to manage field of view smoothness? This is my current result.
Answer by NorthStar79 · Nov 15, 2017 at 08:51 AM
hello,
1-) I can not say anything about performance for sure before actually testing it with profiler, but using render texture may be a lite bit heavier, but not that much.
2-) for a smooth edges you can draw 1 pixel wide circle around fog with %50 alpha, that may help.
Thanks @NorthStar79,
It is a good idea. Can i make it in shader? Or I should make it in my game logic?
shader would do the job, but you said that game is for mobile, writing performant shaders for mobile is kind of pain in the a** don't quote on me though I'am quite terrible at shader development. but, you shoud easily implement soft shadow on your texture render code. so i suggest you to do it there.