Skip to content

Fog of war demo made with unity, with full implementation details and shader scripts included.

Notifications You must be signed in to change notification settings

xddemir/Unity-Fog-of-War

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fog Of War - Unity

Status License


📝 Table of Contents

About

I recently came up with a game idea in which fog of war will play a huge role, but was unable to find proper implementation, i tried to gather as much information as possible, that i found and made a cheap example of it, which you will be able to play along with, learning what lays under the hood.

🎥 Video

Unity_gKzm4IzFxf.mp4

What is Fog Of War?

Fog of war is a term that refers to describe the uncertainty in situation awareness experienced for militars in military operations. However, in video games, the fog of war reffers to giving the player partial information of a certain area, which makes the player re-think the strategy of the gameplay taking in account the leaking information.

How does this work?

FogOfWar.cs includes all mechanism to use fog in this particular project. It raycasts the obstacles and renders vertexes by the radiant angle which means each line that touches the obstacles does not go through therefore it creates triangular meshes. StencilShader.shader creates a layermask for actual scene and makes scene objects invisible. Once we play the scene objects with stencil are rendered properly.

Notes

  • URP not compatible now
  • Download additional standart fps controller package

✍️ Contact

See also the list of contributors who participated in this project.

About

Fog of war demo made with unity, with full implementation details and shader scripts included.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published