I’m looking to to implement “fog of war” as seen in games like WC3, Age of Empires etc.
After some reading, I’ve decided the way to go is to write a Filter class and a fragment shader.
What I’ll do is have a texture, say, 256x256 size. Where the alpha channel describes which areas are visible and which areas are not. 0,0 in the texture would correspond to the 0,0,0 world coordinate (don’t need Y component of course).
Then, in the fragment shader. I would need to know the world position of the current fragment/pixel, then figure out where this is in the fow texture map and paint the texture accordingly.
Anyway, I’m kinda lost as to how filters work.
Question:
In the initFilter method of my filter, I set the material field to a new Material, using my custom FogOfWar.j3md. Where do I get the input texture for the scene?