Alpha transparency on textures

I have created a cube and am mapping a texture to it which has alpha transparency. The problem is that the transparent areas always show up as white. If anyone has any idea on why this is it would be much appreciated.

UPDATEDuntitled.blend (530 KB)


untitled.blend (442 KB)untitled.blend (530 KB)

It would help if you actually included your texture in the blend file !

For your material:
You have not enabled transparancy
You have not set the alpha to zero
For your texture:
You have not set the texture to influence the Alpha as well as the colour

Sorry, I think I packed it in ok this time (UPDATEDuntitled.blend - this forum doesn’t let you delete attachments?)

I added all of the alpha information in I believe but it still shows up as white.

Switch to GLSL Shading mode on N panel and add some lights to the scene.

Thanks guys! It looks a lot better but for some reason whenever I set the uv across a transparent section in the image I get like a semi transparent line. Almost like it’s doing some kind of shading.

Anybody got an idea? It’s like it is stretching the pixels and shading them somehow.

If the latest .blend is the one labelled UPDATEDuntitled.blend, then the white line only shows in the view port and isn’t in the render; add a camera and a light.

You can also go to User Preferences > System and uncheck MipMaps or set the Alpha clipping to 0.995; setting it to 1.000 causes other problems. No idea what either of these actual does, but it gets the visual effect you’re looking for.

From what I can understand, from the tool tips, the Mipmap option in the User Preferences auto-scales the texture to make it ‘pretty’. As we all know from various image manipulation software, scaling an image reduces its quality and causes blurring.

How and when it’s useful to turn this setting on/off would be best explained by someone else.

Deleted post

Make sure you have 1 pixel wide 100% transparency around image border.

It’s a common problem when you use alpha and color from the same image. The shader is trying to sample a pixel between 2 edge pixels, one being 0% transparent brown and the other 100% transparent pixel without color data (or so it seems). So the shader gets a value by averaging the two sets of information. The transparent pixel might have some RBG color data depending on how you generated the image but at least from the results we can tell that it appears to use 100% white as the color of the transparent pixel in this case.

From the file it’s hard to tell what you are trying to do but there might be better ways to achieve it.

  • For alpha maps the usual solution is to use separate alpha image for defining transparent areas and use a non-cut repeating texture as the actual color texture. (so 2 textures, one RGB image affecting color and another black-and-white image affecting alpha) That way even the blurry edges in alpha transparency get their color data sampled correctly.

  • It is also possible to make your alpha images in the way that the color information “bleeds” outside the opaque pixels, for example if you fill the entire texture with the color you want and then erase the parts you need transparent. This way you can use single image for color and alpha (if that is important to you).

(For these solutions the alpha border is always going to be a bit blurry if you don’t use application-specific “hacks” like alpha clipping. But that might not be a problem if you don’t plan to take the model outside Blender.)

  • If you want just crisp and accurate changes in alpha I suggest you actually model the holes in vertex topology or at least split the faces so you can use 100% transparent material if that suits your purpose better. If you can afford the slightly increased polycount, of course.

Thanks guys, the mipmaps option checked off makes it look pixel perfect.

Very well since it seems the problem is with mipmap generation anyway. 100% transparent pixels don’t contain color information (at least for the .png format) and produce bleeding edges in the mipmap generation in Blender (and possibly on other platforms as well, this fix only applies to Blender of course).

Mipmaps are auto-generated downscaled (smaller in pixel size) versions of textures that the real-time renderer (such as Blender 3D view) uses for sampling the textures. Virtually all game engines and other real-time applications use it for the best performance. Mipmaps are obligatory for large texturing projects (video game levels, image-textured scenes, HD renders) although good computer specs (mostly RAM) will help.

So they are very sensible and industry standard optimization method. When you disable mipmaps I just want you (and everyone else around here) to know what you’re doing. Understanding alpha and sampling will help you render the materials exactly as you want and also preview the results as accurately as possible.

In my tests Blender still renders the image fine in both cases, it’s just a matter of how it shows up on screen.

Below I’ve attached a version of the blend using separate alpha and color images. Like I said this is the industry standard solution. I don’t know what exactly you’re doing but I could imagine if you want to adjust the transparent areas it is also easier with BW image than by cloning that texture to different areas. :slight_smile:

Note that you could also include the alpha data in single image using the actual alpha channel instead of PNG transparency that seems to be the issue.

UPDATEDuntitled_fixed.blend (580 KB)

Thank you for the explanation, Kheetor.

Also, for anyone using Unity. I was experiencing this issue again after importing. I was able to fix it by setting the texture type to “Advanced” and then unchecking the “Non power of 2” option. The texture I was using is 250x250 but unity was automatically resizing it to a power of 2 which left transparent lines on my edges. >_<

^ I’ve been telling you it’s your textures and not the software. Disabling mipmap just makes the texture look pixelated in Blender and doesn’t fix the actual problems that resurface in Unity or any other 3D software you take the model to. Always, always, always make power of two textures…

No, it still displayed bad in unity and blender. That option fixed it for unity and the mipmapped option fixed it in blender.