Texture bleeding at edges through scaling

Hello Community,

In my current project I’m scaling the screen through the ViewportAdapters of Monogame.Extended and their generated Matrix.
As a side effect of scaling the viewport size down, the adjacent pixels of the edges of my sprites bleed over into the sprites itself(or into their area of the spritesheet).
I suppose that happens because of incorrectly rounded UV-Coordinates after multiplying with the ViewportAdapter Matrix.

Can anybody help me with this situation?!

Monogame scaling|234x276

Cool sprites :slight_smile:

I feel like I’ve seen this before but I just can’t remember. I guess the low hanging fruit to check would be your SamplerState. Are you set to PointClamp in the appropriate SpriteBatch.Begin(…) call for where those sprites are rendered?

Thanks, they are still placeholders, so yeah… ^^

Yes, the SamplerState is being set to PointClamp. My temporary solution would be to just create a transparent border around all sprites, so the bleed-in would be transparent. Doesn’t really help me with with tiles tho.

Maybe theres some way of messing with the SamplerState further?

have you tried turning off the generatemipmaps?

Can you post the sprite texture itself? If I have some time in the next day or so I’ll see if I can do an experiment and reproduce.

Sorry for the rushed answer, I tried it out further and it only sort of works.

While the texture bleeding on the player sprite is gone, the bleeding in my tilemap is still present unfortunately. However only if I move the camera. If it doesn’t move, everything looks fine.

Can you post your texture so that I can try and see if I can reproduce it on my own?

Also, if this is happening when you’re moving your camera, I’m wondering if you might need to cast your coordinates to int right before renderingr.