I've been trying to implement a 3D (with the Y axis being utilized) fog of war system similar to what XCOM uses.

enter image description here enter image description here enter image description here

There is only one hint that really seems to nail it, but I can't read the actual function that was in place.


The key difference here is that I'm also trying to apply this to a multi leveled building.

So the question is... How do you go about implementing a height based fog shader, with a masking texture to prevent it from drawing in certain world spaces.

  • \$\begingroup\$ I already figured it out. You can just project the fog of war map over the geometry, and out put the result to a stencil buffer. That will mask the results. \$\endgroup\$ Jul 3, 2016 at 3:15
  • 1
    \$\begingroup\$ if you're still around, it would be great if you'd post an Answer here detailing the solution you found. \$\endgroup\$
    – DMGregory
    Apr 29, 2018 at 11:14
  • \$\begingroup\$ @DMGregory Hard to explain. But I got the solution. Instead of projecting the mask, I use a bit of math to solve for the positions in the textures for each raymarch. This makes things less complicated in the end. \$\endgroup\$ May 6, 2018 at 5:39


You must log in to answer this question.

Browse other questions tagged .