SFML community forums

Help => Graphics => Topic started by: lexected on January 06, 2016, 10:18:21 pm

Title: Texture with mysterious corners
Post by: lexected on January 06, 2016, 10:18:21 pm
Hello!

I have been told that this is kind of a common problem with transparent textures, but didn't get any further information on how to solve it.

In my code, I'm trying to render this texture (a square with rounded corners, where rounded corners have some alpha)
(http://i.imgur.com/eNICD46.png)

What I get instead is this
(http://i.imgur.com/DVBPY0r.png)
Notice those greyish places on the corners of the textures - where rounded corners are supposed to be.

What could be causing this? I have a pure-white texture, so I don't expect a single pixel to get any darker than the background. All pixels should have at least the color of background, but as you can see, there is something darker.

Any help would be highly appreciated.
Title: Re: Texture with mysterious corners
Post by: Mario on January 06, 2016, 10:34:17 pm
This might be a scaling/blending problem caused by your graphics editor. The pixels outside have 0 alpha but they're black. So the upscaling mixes these colors, essentially creating semitransparent gray.

You might be able to fix this, but that's based on the actual editor being used (and not sure it's indeed that though).
Title: Re: Texture with mysterious corners
Post by: lexected on January 07, 2016, 07:37:52 am
I'm using InkScape. I've read that this could be caused by using premultiplied textures, but I know no more.
How would you call this? What could I type into the search bar? :)

To the other post:
Well, drawing rectangles with rounded corners seemed to be easier with textures. But I did draw those ordinary rectangles as primitives, of course.

I temporarily solved it by replacing alpha with background color. It's not pretty in principle, but it works.
Title: Re: Texture with mysterious corners
Post by: Mario on January 07, 2016, 07:56:43 pm
More about this here: http://graphicdesign.stackexchange.com/questions/25308/why-does-resizing-png-with-alpha-transparency-make-edges-gray

Not sure if Inkscape has options to fight that. Would have to have a look first.