I am working on a small Top-down perspective game, where there is a 'vision' system, with shadows hiding stuff the player souldn't be able to see (like behind walls, or behind his back).
I use a sf::RenderTexture as a canvas, where i manage all the shadows for a player's screen(ConvexShapes drawn to it, then i convert it to an sf::Image, to use the createMaskFromColor function, to eliminate the non-shadow background. It will matter mostly for multiplayer, where i want to create a 'shared' vision for the entire team).
My problem is that when i draw my RenderTexture to the game window (sf::RenderWindow) it's pixelated. I'm new to SFML, and quite new to graphics in general, so if what I'm looking for is not antialiasing please forgive me.
Also,
I looked around a little and checked on the forum for this, and I saw that binary1248 said that RenderTexture "wastes a considerable amount of GPU resources both in terms of processing time and memory usage." (on this post:
https://en.sfml-dev.org/forums/index.php?topic=22147.0 )
So is it really that bad to use RenderTexture?
If so, what should i use for off-screen rendering? (I saw the potential use of views, but I still can't see a way of replacing the Image::createMaskFromColor)
Is there any other way to supposingly 'erase' something drawn? (right now i am redrawing white to the temporary canvas, and then i set the alpha of white to 0, as mentioned above, to erase shadows before i draw them)
And last, if RenderTexture is still what i need to use, how do I make the shadows drawn from the RenderTexture smoother?
Sorry for the long post