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

Author Topic: Texture with mysterious corners  (Read 1696 times)

0 Members and 1 Guest are viewing this topic.

lexected

  • Newbie
  • *
  • Posts: 8
    • View Profile
Texture with mysterious corners
« 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)


What I get instead is this

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.

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: Texture with mysterious corners
« Reply #1 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).

lexected

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Texture with mysterious corners
« Reply #2 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.

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: Texture with mysterious corners
« Reply #3 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.

 

anything