- Home /
blender image texture is not transparent in unity
when i try import a blender tree model to unity with leaves, the leaves have a white background, whereas in blender its transparent. I tried adding a shader to the white parts transparent but it has a white outline which makes it look white. unity leaves without shader (L) and with shader (R) vvv
blender leaves vvv
Answer by Pangamini · May 22, 2021 at 04:05 PM
This is caused by texture filtering. The transparency is usually controlled by the alpha channel, making the texels with alpha 0 fully transparent and opaque with value 1. The problem here is, that your texture has a white color value of those fully transparent texels . That wouldn't be an issue, if texels colors were directly copied to the screen pixels, but you are most likely sampling the texture with at least a bilinear filter, which makes smooth transitions between texel colors. So, if you have a green opaque pixel next to a white transparent one, the color halfway in between would be a semi-trapsnarent whitish green. Unity tries to solve this problem with the "alpha is transparency" option in the texture import settings. This will cause the transparent texels to ignore its own color and take the color from some nearby visible texel. This is a simple technique, sometimes sufficient, but sometimes creating other artifacts. The other option, if the former is insufficient, is to do this manually in your image editing tool. The problem is worsened as you fall to the lower mip levels, so you want to make sure that all of the fully transparent texels hold some valid (in your case, green) color, and not just black or white. HERE's an article that menions this problem, with the Fig. 5 and 6 showing possible solutions
Your answer
