SFML community forums
Help => Graphics => Topic started by: nonexistent on March 09, 2010, 10:36:33 pm
-
Hi, I'm getting a black outline on a sprite when rendering in SFML. The original grass image looks like:
(http://www.contrib.andrew.cmu.edu/~gchin/misc/sfml/grass.png)
and rendered in SFML looks like:
(http://www.contrib.andrew.cmu.edu/~gchin/misc/sfml/sfml-grass.png)
The sprite is loaded into an Image, stuck in a Sprite, and rendered with RenderWindow's Draw(). I haven't calling any resizing or scaling functions on the sprite.
I'm guessing this is some sort of side effect of the alpha blending in the sprite blend mode. Any ideas to minimize this unwanted outline?
-
You can try this:
image.SetSmooth(false);
-
Calling SetSmooth(false) on the image resulted in no graphical difference unfortunately :( None of the sprite Blend Modes aside from Alpha seem to allow transparency, so that's no good either.
-
Is the first image that you posted the original one? If not, can you upload it?
-
Yes, that is the exact image I am loading from file. Thanks for the quick replies so far!
-
I've tested the image and can't see any outline.
I haven't calling any resizing or scaling functions on the sprite
What about your window, is it resized after creation?
Do you use a view?
-
Hmm, very interesting. I made a mistake posting the original image, that's not the one I am loading in my file. I extended the image size to the closest powers of 2 to make it 256x64. The loaded 256x64 image displays the black outline problem, but loading the original 224x43 image renders correctly.
Does SFML do something special internally w/ power of 2 textures? I've been manually image editing all my textures to be powers of 2 to account for older graphics cards.
-
Does SFML do something special internally w/ power of 2 textures?
No, it should make no difference.
I've been manually image editing all my textures to be powers of 2 to account for older graphics cards.
You don't have to do that, this is automatically handled by SFML.
Can you upload the 256x64 image that causes the problem?
-
Here is the 256x64 image
(http://www.contrib.andrew.cmu.edu/~gchin/misc/sfml/grass-pow2.png)
It is the same as the original except padded w/ additional transparent pixels.
-
I've had the same problem for quite a while. Disabling smoothing indeed solves the outline problem but it makes the graphics look more pixelated (cause they are from an old game) :(
with smoothing (standard):
(http://img717.imageshack.us/img717/1813/withsmooth.th.png) (http://img717.imageshack.us/img717/1813/withsmooth.png)
disabled smoothing:
(http://img171.imageshack.us/img171/3585/withoutsmooth.th.png) (http://img171.imageshack.us/img171/3585/withoutsmooth.png)
-
I see.
This is the kind of problems that you can expect with SFML 1 (unfortunately), but this is already fixed in SFML 2.
-
No. I'm using (D)SFML2 :wink:
-
No. I'm using (D)SFML2 :wink:
Ah... you should have said it before ;)
Can you send me your tileset?
-
I have no problem with your tiles. Make sure that your coordinates are properly aligned with the pixels of the window (no decimal coordinates).
-
Hey all. Sorry to jump in, but I've gotten graphics to display and I wondered if there's a way to have EVERY image loaded with setsmooth to false? It fixed 2 problems I had with what I was going for displaying.
-
No. But you can easily wrap it into your own loading function or manager.
-
First of all, sorry to my ugly English.
When I use "SFML-1.5", SetSmoth(true), it is fine to rendering. But "SFML-1.6" and "SFML-2.0" are Black outline like this (Win32 sample Project).
Look at the rotated Image.
<SFML-2.0>
(http://i42.tinypic.com/3466y5s.png)
<SFML-1.6>
(http://i39.tinypic.com/i6ysub.png)
<SFML-1.5>
(http://i42.tinypic.com/2s8jk9h.png)
"SFML-1.6" and "SFML-2.0" are Ok that "SetSmooth(false)". But I wanna smooth Image.
Why this happen? :roll:
-
It should be ok now in SFML 2.