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.
Unity_gKzm4IzFxf.mp4
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.
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.
- URP not compatible now
- Download additional standart fps controller package
- @xddemir - Github
- @dogukan.demir991@gmail.com - Email
See also the list of contributors who participated in this project.