• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by leopripos · Jun 13, 2017 at 05:28 AM · rtsfog-of-war

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:

  1. Which performance is better using this approach (draw to texture2d directly) or draw mesh, let camera render it to render texture?

  2. How to manage field of view smoothness? This is my current result. alt text

current-result.png (89.8 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by leopripos · Nov 15, 2017 at 04:58 AM

Up please :)

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

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.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image leopripos · Nov 17, 2017 at 09:20 PM 0
Share

Thanks @NorthStar79,

It is a good idea. Can i make it in shader? Or I should make it in my game logic?

avatar image NorthStar79 leopripos · Nov 18, 2017 at 07:07 AM 0
Share

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.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

66 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Lighting Light Increase 1 Answer

Cheap way in making Fog of War 1 Answer

How would I do fog of war? 3 Answers

RTS Style Camera Scrolling 8 Answers

Is a Unity simulation deterministic? 4 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges