Iām porting and expanding my simple pixel game made in XNA to MonoGame. Porting was fast and now Iām adding new features.
The game is low res and is upscaled to screen size with resolution/matrix class I found online.
I draw textures with SamplerState.PointClamp. Game looks good up untill I wanted to try out rotating texturesā¦ they are ugly when I upscale them
If I play the game in real resolution without upscaling, it looks nice and oldschool.
Gif of rotating pixels in real resolution:
Gif on screen upscaled to 1920x1080:
As you can see the upscaled has rotated pixels instead of squares. How can I fix this? I tried googling and finding help but I didnāt find anything.
My current setup:
MonoGame 3.5 (I didnāt go with 3.6 yet ), Visual Studio 2015 Community, Windows 10, cross-platform template project.
I donāt use shaders because I have no experience and knowledge how they work or how to use them
You work around this if you draw to a low res rendertarget and only upscale the final image
EDIT:
I understand you want to rotate the sprite, but want the pixels inside to stay unangled (horizontal alignment).
This is super trivial to do and the easiest solution is to upscale after drawing the whole image.
For that you can use rendertargets (if you need help let me know).
Otherwise you can use a custom shader that uses some form of quantization for the pixel shader texture read. (Again I could help you with that, but make sure solution one doesnāt work for you first). Thatās not trivial to implement into the default spritebatch.draw() pipeline and youād have to make some adjustments to either monogame itself or make a custom spritebatch implementation.
Yes I want to rotate the texture without having ārotated lookā on the pixels.
About rendertargets, I have read about them but havenāt used them, because I read that they use lot of performance and memory(?).
If I use them, should I create new rendertarget for each frame? Or should I make one large rendertarget and clear it each frame before drawing new stuff on it?
For some reason rendertarget draws only top left corner of my game. and no matter what size the rendertarget is, there is just black after certain point. With smaller size the black begins earlierā¦
And because it shows only the top left corner of game area (not the camera area), the game is unplayable because player cannot see
Maybe its just that current resolution independence and camera system arenāt suited for rendertargets
Problem is not that the image/rendertarget is small compared to screen. Problem is that the image/rendertarget is literally just the corner of my game because when I render the game, rendertarget is at zero point.
Is it possible to set rendertargetās position before drawing, so that currently visible area is rendered to it? That should fix my problem.