Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: SFML 1.6 - Downscaling and smoothing border issues  (Read 3182 times)

0 Members and 1 Guest are viewing this topic.

BesomeGames

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
SFML 1.6 - Downscaling and smoothing border issues
« on: April 21, 2013, 06:21:01 am »
Hello there,

I've run into an issue I am not sure how to fix and figured I should ask for some input. I am currently working on a 2D tile based game. Everything is designed and coded for 1920x1080 resolution and I use a View to adjust to different resolutions. I load tileset images and create the tiles from subrects. I had an issue previously with ugly borders on transparent images which I fixed by using a nearly black color as the alpha channel.

When I run the game in 1920x1080 everything looks great, as expected. The problem comes when I use lower resolutions. For example, my monitor is 1440x900, which would result in a downscale. With smoothing on the everything looks great, except I get black borders on some tiles:



I have researched this and from what I have found the issue has to do with smoothing. If I disable it, the lines are no longer there but the tiles look awful:



What exactly can I do in this situation? I have considered upgrading to SFML 2.0 and using RenderTexture to draw everything to an off screen buffer then applying smoothing to that, but from what I read nearly all Intel GPUs don't support that. I have also read I could potentially scale and cache the tiles at run time but I am unsure exactly how that would work. I also read something about the view potentially using floating point numbers, and I could remove the lines by down scaling and maintaining aspect ratio.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: SFML 1.6 - Downscaling and smoothing border issues
« Reply #1 on: April 21, 2013, 11:48:46 am »
With enabled smoothing, pixels (or rather texels) outside the actual texture rect are also considered for rendering. One possibility would be to create a border around each texture rect with the same color, but it's rather a workaround.

The idea to use sf::RenderTexture is a good one. It's not true that it works on almost no Intel GPUs -- I have an integrated Intel card on my notebook, too, and it works flawlessly. Render textures are also useful if you want to apply global effects (shaders) to the whole scene.

And you should upgrade to SFML 2 anyway, it is much better than 1.6.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

BesomeGames

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
Re: SFML 1.6 - Downscaling and smoothing border issues
« Reply #2 on: April 22, 2013, 02:12:27 am »
Thanks for the great reply.

I agree, although adding a pixel border around the tiles would fix the problem it is rather hackish. I've put off upgrading to SFML 2.0 simply because the workload for the project is so high I haven't wanted to take the time.

For RenderTexture I was referencing this post:

http://en.sfml-dev.org/forums/index.php?topic=7407.0

I haven't found any news about better compatibility.

 

anything