0
$\begingroup$

I would like to understand methods to solve this issue; in the next picture the grass has white color around the edges, I would like to create a billboard grass with the foliage technique with alpha-planes.

enter image description here

However, in gimp this issues does not exist , I think this problem is from blender and the alpha channel.

enter image description here

$\endgroup$
  • 2
    $\begingroup$ I suppose this only happens when viewing in the viewport. What does it look like when you render it or press P (to start the game engine)? $\endgroup$ – Štefan Schindler Nov 21 '16 at 18:11
  • $\begingroup$ stills happens, even If press f12 to render , I am thinking if it is z-transparency ,but not sure at all...or if it is the blending-alpha mode...what do you suggest for me? $\endgroup$ – Reifus Rufus Nov 21 '16 at 18:26
  • 1
    $\begingroup$ Could you please share your .blend file here blend-exchange.giantcowfilms.com and post the link here? $\endgroup$ – Štefan Schindler Nov 21 '16 at 19:55
  • $\begingroup$ drive.google.com/open?id=0B63EXzD2m9ecTVB2c0k0eGhuZzg this is the file as object, in fbx format and the png files, but I need an answer this week. $\endgroup$ – Reifus Rufus Nov 22 '16 at 1:14
2
$\begingroup$

What's the cause of the problem

The problem with this is how the transparent texture was created. Some pixels of the image are fully opaque (0% of transparency), some are semi-transparent and some are fully transparent (100% of transparency).

However even the 100% transparent areas have color. Because each pixel of image (when it has alpha channel) has color defined by 4 values = RGBA.

So let's say first color would be rgba(255, 0, 0, 0) and the second would be rgba(0, 255, 0, 0). They are both fully transparent, however the first is red and the second is green.

And the compression algorithms in most programs and game engines take into account also color of transparent areas. Mostly around edges where it is used for anti-aliasing, filtering, ...

Most graphics editors (like Gimp) put completely white color to fully transparent areas, which causes artifacts like in your case.

Solution

To solve this problem there is a pretty cool plugin for gimp. Download it from here (it is part of this thread). Save it into your .gimp-2.x/scripts folder (In my case the folder is located here C:\Users\Stefan\.gimp-2.8\scripts). Restart Gimp, open your texture, and select Layers > Transparency > Bleed Colour into Transparent Areas .... Leave the default settings and wait til it finishes. Now export the result to PNG. And that's it, now the artifacts are gone.

enter image description here

Sources

This answer was inspired by another answer here. Check it for more detailed explanation and alternative for Photoshop users.

| improve this answer | |
$\endgroup$
  • $\begingroup$ I can not solve the problem I use default in gimp ,but nothing happen, but, ok , so what value I need for the future image on the RGBA channel, in "alpha channel" I need always 100% alpha , for example for the future I need to take a texture which has 255,0,0,0 , 0,255,0,0 , 0,0,255,0 , 0,0,0,255 (this last one is the alpha channel?? 255 for the maximum value of pixel for this Alpha in this case? $\endgroup$ – Reifus Rufus Nov 22 '16 at 23:09
  • $\begingroup$ Keep creating textures as you did, then when you are ready to use them in Blender (or other app), open up the texture in Gimp and follow the steps I've written above, it will solve your problem. $\endgroup$ – Štefan Schindler Nov 23 '16 at 13:51
  • $\begingroup$ Ok thanks , any recomendation to know more about RGBA , I know some basics practice , but I am interesting on , the way that blender "blends" the alphas, for example alpha clipping , alpha-opaque ,etc ..and something about it. $\endgroup$ – Reifus Rufus Nov 23 '16 at 20:10
  • $\begingroup$ I don't have very deep knowledge on internal handling of alpha textures, the only resource I can point you is the docs. If you really want an in depth explanation, I would suggest starting a new question. $\endgroup$ – Štefan Schindler Nov 23 '16 at 20:15
  • $\begingroup$ The explanation above isn't completely accurate. The problem isn't the white background in the unassociated alpha image, it's that there isn't solid colour in the pixels with semi-transparent alpha and those pixels were contaminated with white. That's what caused the light halo and that's why the bleed colour plugin solved it. The reason for the problem you experienced is simply that the texture was wrong, and had white contamination in semitransparent pixels. It's not a problem with unassociated alpha images if they are properly encoded. $\endgroup$ – Gez Nov 28 '16 at 17:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.