Revealing 3-dimension fog of war (generated mesh)

This is for an isometric tile-based turn-based tactics game. I seek to replicate the fog of war mechnic from the old X-Com titles, Dungeon Keeper 1 also had this feature.

Basically, every cube space in the world also has a black fog of war cube over it that gets revealed when a unit sees it.

I have my generated mesh with collider which fills the playing field with black cubes, one for each tile. Now I’m wondering how to make units reveal the map without bringing down the FPS.

I can raycast in all direction and remove FoW cubes this way, but it is not reliable and also the FPS goes down to about 10-30. I tried using a sphere collider and then raycasting to the collision points, but it’s even worse.

Are there better ways to do this?

You can do raycasting, but try to limit the number of raycasts or distribute them across several frames. You could do random or pattern like raycasts, but only a fixed number per frame. This can easily be done using Coroutines!