Jump to content
  • Advertisement
Sign in to follow this  
IceCave

Green border rendering glitch

This topic is 729 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have drawn and scanned some sketches by hand with the intention to post-process them with GIMP on the computer and use those images then in my game.

 

This is a rendered scene (on Android) of my very first sketch try:

[attachment=33301:device-2016-09-18-154457.png]

As you can see there is a green border around those objects which should be partially transparent/grey-scale.

I have used the wand tool in GIMP to remove the scanned white paper at exactly those borders.

 

When I put this image over the same background image in GIMP, there is no such "green border" appearing. It seems also independent from the background color.

 

Does somebody know what could cause this to happen?

Share this post


Link to post
Share on other sites
Advertisement

I assume the images have an alpha channel, and you're using blending/testing to not show that area?  What is the color of the alpha pixels in the image?  It looks like the alpha pixels are green, and ether you're using filtering on the image, or the alpha of the pixels is not actually 0 (just slightly above), which results in the pixel showing.  There are a couple of solutions, if that may be the case.

 

One is to use a different alpha color.  Instead of using green, use the same color as the border of the image (black in this case).  This is commonly done with different channels for cutouts (normal maps, etc).  Extend the color by a few pixels (or all the way to the edge) around an image to prevent bleeding when using bilinear filtering when sampling the texture.

 

Another is to use alpha testing instead, so if the alpha is less than 1, clip the pixel.  This means that anything less than full will not be shown.  Any pixels with a slight alpha blend to them will just not be shown at all.  This ends up giving hard edges though, as it's basically clip or don't clip, there is no in between.

Share this post


Link to post
Share on other sites

When I put this image over the same background image in GIMP

 

In GIMP you don't have scaling/filtering, so colors from transparent pixels won't bleed.

 

In addition to what xycsoscyx suggested, you can also try using premultiplied alpha.

It will prevent color bleeding and has some other advantages (like blending associativity).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!