Best implementation for client-side MOBA style Fog Of War? (With line of sight)
Hello! This is currently my game: There is a procedurally generated terrain with variable height, and trees. I am trying to implement for of war, like this picture:
I accomplished this by placing a point light high above the player with a big range:
And having tall shadow casters on each tree:
But this gives terrible results on low settings:
And lowering the light creates an ugly gradient and overwashed colors:
And lowering the intensity doesn't help (Gradient emphasized):
Note that right now i'm using the spawned tree gameobjects as the FOW source, and i'd rather have the actual map data be the source (Painted black):
Also, I'm not looking for Fog of war that is applied by changing the ground mesh's UV or texture (Tested - Super laggy). Also, it's supposed to be binary (AKA in LOS or not, no gradient like the light) and (preferably, I can probably do it myself) have a predefined range.
Here's what I tried:
Modifiying the UV of the mesh (the colors you see are actually UV coords on a green to black gradient), Playable only if I set it to execute every half second, and still stutters.
Make a texture2d with the rendered fog of war and use a projector to project it onto the mesh. Laggy as well.
This shadow trick
Thanks in advance!
Your answer
![](https://koobas.hobune.stream/wayback/20220612135802im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
URP spotlights and point lights do not cast shadows 0 Answers
Checking if the reflected angle is too sharp 0 Answers
Sun Shafts - Use 'Centre On Main Camera' through script at runtime? 0 Answers
Strange shadow triangles in my scene. 0 Answers
ProBuilder - Light leaking through seams on internal scenes 1 Answer