Generating mesh from rays that collide with walls. Then draw it and apply as mask to only draw enemies and NPCs that are cover by this mesh.
https://github.com/filscorporation/Rewind
thank you so much bro