Alpha Transparent Texture basics in Blender 3D
Getting alpha-channelled transparent textures to correctly display in Blenders main 3D View has always been a bit tricky to do because of the 'real time' nature of the feature. It needn't be however, as the following tutorial explains, it is generally and relatively straightforward to get semi-opaque or fully transparent textures set-up to display correctly depending on the type of transparency required in the main work zone. The following tutorial discuses the two main approaches to getting transparency to correctly display in the 3D View.
A basic understanding of Blender and making or editing materials is necessary. An alpha-channelled texture is also required for this to work (see sample file if not available).
Transparency & context ^
How we use transparency in Blender naturally depends on what we're doing, making game or 'real-time' art for instance, carries with it a different set of requirements than creating content for static image or off-line movie sequence rendering. For the artist working within a Blender scene however, being able to see some form of transparency is a plus, ideally this should be "WYSIWYG" ("What You See Is What You Get") and without the need for rendering or using any special after-the-fact settings or procedures to see the end result.
There are two approaches we can use to get see-through textures to properly displayed in the 3D View; 1) it can be associated with a material, or 2) it can be assign to individually UVW unwrapped surfaces. Whilst both have or use some form of "alpha" setting, the main difference between the two pertains to the way transparency is assigned - associated with a "Material", any object or surface referencing that parent material is automatically rendered transparent. This makes material assignments much more 'global' in nature. On the other hand when assigned to individual surfaces, the application is much more 'local' and specific; a surface will not display transparent unless it's specifically set up to do that. This means that whilst several objects can be using the same Material, unless each individual surface is set properly they won't display transparent.
When a texture is applied to a mesh, by default it's rendered within the scene without any form of transparency even though the image assigned to the Material itself has an alpha-channel as a 24bit RGB+A source file. Image above is shown rendered under "Textured" viewport shading - "Alt+Z", and with "Wire" outline active
Alpha channels and images ^
Before we can use transparency in Blender we need to make make sure any images being used have an "alpha channel" of some description; although it is possible to use a 'layered' material containing a mask, it's usually a much more straightforward procedure to use and alpha'd texture. This also implies or assumes images are in a suitable format, i.e. images should be in "*.tga", "*.dds" or other "RGBA" ("Red, Green, Blue, +Alpha" ["24bit RGB +8bit Alpha"]) format that Blender can read, and that supports having an 'alpha' channel.
Design Note: alpha channelled textures are sometime referred to as being "32bit" images. This is slightly misleading because 'true' 32bit images are in fact "CMYK", the "Cyan, Magenta, Yellow, Black" colours associated with printing (colour brochures, books etc.). Be sure to double check the correct type of "32bit" image is being used before preceding.
The tutorial texture in GIMP showing the alpha channel in the main view and the separate 'channels' in the "Channels" panel
The same texture in Corel Photo-Paint showing the red tinted visual aid in the main window and the individual channels in the "Channel" list
Transparency via a Material ^
In a correctly prepared "Material", bitmap images are assigned via the "Image" subsection of that materials "Texture" properties (creating a basic material in the 'global' sense). This is then applied to the Object in the normal manner through both a material and UVW map assignment. Once done we next need to change a number of options.
Click the "Material" button to access the appropriate properties. In the options that open scroll down to the "Transparency" subsection and click the check-box, this activates the feature. Next click the arrow to the left of the checkbox to display that subsections options - by default "Z Transparency" should already be selected, if not click the button. In the "Alpha:" input field change the value from "1.000" to "0.000" ("Alpha: 0.000") - either "Ctrl+LMB" click in the data input field and type "0", or "LMB+drag" the area to 'slide' the value to "0". Immediately upon doing this the "Preview" window will show a completely transparent sphere (with specular highlight being visible).
In the "Material" options we need to activate a number of parameters under the "Transparency" subsection, namely the "Alpha" value which then 'forces' the "Texture" stage of the Material to use the alpha channel present in the source image. However, the texture itself is still rendered in the scene 'opaque'
Next, switch to "Texture" properties, scroll down to "Influence" and check (tick) "Alpha:" to activate that option, leave the value at "1.000" - "Alpha: 1.000". No other setting or options need to be changed - N.B. the texture is still displayed as being opaque in the 3D View at this point, to 'correct' this we now need to change Blenders "Material Mode".
In the materials "Texture" options, under the "Influence" subsection, activating "Alpha:1.000" is needed, again to properly force Blender to render transparency in the 3D View. Note however, the image still displays 'opaque' at this point
Material Mode changes ^
Once the material has been set up the final step is to change the "Material Mode" display system from the current default, "Multitexture", to "GLSL", the mode required to properly render Material based alpha transparency in the 3D View. To do this press "N" to open the "View Properties" ToolShelf and then scroll down to the "Display" subsection. Under "Shading:" click the default "Multitexture" option and select "GLSL" from the list that appear - all objects in the scene using the same material will immediately display as transparent.
Design Note: if the textures do not switch, check the "Viewport Shading" mode, it should be "Textured" ("Alt+Z"), then go back over the Materials settings to make sure none has been missed. In addition, check the texture has an alpha channel present.
Using the approach discussed above means the images alpha channel transparency displaying correctly in the scenes 3D View once "GLSL" is activated (switching from the default "Multitexture" shading) after altering other "Texture" and "Material" settings
Transparency via Texture Face ^
Although "GLSL" is advantageous for displaying alpha transparent textures under similar conditions typical of a game engine, because of the way the system makes use of lamps for illumination, it can end up consuming quite a lot of resources in complex scenes. An alternative to this is to render those same images using "Texture Face" transparency - as this is a component mechanism of Blenders default "Multitexture" display mode, it isn't as demanding and doesn't require and special Material settings.
Design Note: "Multitexture", as a display mode, uses the scenes default and 'static' three-point light set up. "GLSL" lighting on the other-hand is 'dynamic' and uses lamp objects placed in the scene for object/surface illumination.
To use "Texture Face" transparency, create a standard Material, one with a "Material", "Texture" and "Image" slot. Load a bitmap with an alpha-channel into the Material and then make sure it's assigned to any associated UVW maps. Select the object and press "Tab" to enter Edit mode then RMB select any single textured surface - if textures are not visible in the main viewport toggle "Textured" shading with "Z" or "Alt+Z". Next, from "Properties", click the "Object Data" button and scroll down to the "Texture Face" subsection. From here change the default "Transparency:" option of "Opaque" to "Alpha" - the selected face should immediately display as transparent in the 3D View based on alpha channel values present in the image. If the surface is to be doubled-sided enable "Two-side", this forces Blender to render the same texture and properties to the reverse side of the face. Deselect the updated surface, select a new one and repeat - change "Opaque" to "Alpha", set "Two-side" where necessary. Repeat the procedure for each surface requiring alpha channel determined transparency.
Design Note: it's important to note that "Texture Face" transparency can only be assigned to individual 'surfaces' at a time (not 'group' assigned), irrespective as to whether that's a single "triangle", "quadratic" polygon or "Ngon", as there is no "Copy (to all)" feature available at present. To make selecting faces easier and quicker use "Ctrl+Tab" to switch "Mesh Select Mode" to "Face".
Textures are rendered by default as being "Opaque"; switching to "Alpha" tells Blender to use the alpha-channel of an image. Each face can also be flagged as "Two-Sided" - the same texture and properties assigned to both sides of the selected surface. Both settings ensure UVW mapped texture appear in the viewport properly
Addendum: Texture Face & Game Settings in 2.60 ^
A major change to "Texture Face" management was introduced with Blender 2.60 which means all previously available options are now legacy properties that have been grand-fathered into a new Material sub-system called "Game Settings". This change effects the way both alpha channel based transparency and "Two-Side" properties are handled and displayed in the 3DView. Although the change doesn't necessarily mean having to use the "GLSL" material "Shading" sub-system (as discussed above), it does require a change between the standard "Blender Render" and "Blender Game" rendering engines for alpha-channelled textures to display correctly in the 3DView.
In Blender 2.59, "Texture Face" options are available in "Object Data" properties once an individual face is selected in Edit mode
In Blender 2.60, "Texture Face" properties have been replaced and 'grand-fathered' with "Game Settings", available in the Material properties stack
To set up a transparent texture using Game Settings first select "Blender Game" from the upper menu header. Next, from "Material" properties, scroll down to the now available "Game Settings" sub-section - expand the options if not visible. In this new area find "Alpha Blend" and from the available drop-down list select a "Blend Mode" to associate with the material, typically this will be "Alpha Blend". Immediately upon assignment the texture will change to display in the 3DView as transparent based on the selected option, if not check the material "Shading" parameter in "View Properties" ("N", scroll down to the "Display" sub-section), making sure to be using "Multitexture" instead of "GLSL".
Design Note: "Games Settings" typically works better within the context of replacing "Texture Face" settings if the "Material Shading" system is left in the default "Multitexture" mode; switching to "GLSL" typically over-rides the former because it expects transparency to be based on the Materials 'alpha' settings rather than simply reading the alpha data directly from the image, displaying it as-is over the UV.
When choosing a "Blend Mode" note that "Alpha Blend" generally pays explicit attention to the alpha values present in the bitmap image sourced to the Image slot. "Alpha Clip" tends to treat the alpha channel as a mask, relying instead on a much more black and white interpretation of the alpha values - in affect, the alpha channel is treated as a simple 'stencil'. "Alpha Sort" changes the order or sequence in which transparent objects are drawn on-screen relative to each other - the process checks to see which objects are in front of others and draws transparency relative to that scenario.
Alpha-transparency based on "Texture Face" properties has changed to now needing to be set from a new "Material" sub-section called "Game Settings" where a number of previously 'individual' properties are assigned as 'global' parameters
Addendum: Games Settings & Backface Culling ^
For double-sided surfaces "Game Settings" also contains another 'grand-fathered' setting which replaces the previously available "Two-Side" property. "Backface Culling" as its now called, performs the same function by toggling a surface and/or texture assignment between being single or double-sided (same texture applied to either/or/both front and back of a face). Note however, this setting is applied per-material and not per-face. In other words, Backface Culling is applicable in instances where an Object or surface (or collection there-of) references the same parent material, it's no longer an independent 'surface' only property.
Design Note: because Backface Culling is applied per-material, in situations where the same texture is required to perform two roles, where the application of a single texture is used for both single and double-sided assignments, an additional duplicate material will need to be created so one can be culled whilst the other can remain double-sided. In other words, it's no longer possible to assign this property to an individual surface (face) element that is/was a distinct property from a Material, as was the case with Blender 2.59+/-.
Activating "Backface Culling" forces Blender to drawn textures assigned to surfaces as single-sided only. In the case of transparency that would mean being able to see 'through' an object (nothing appears on the inside)
De-activating "Backface Culling" causes Blender to draw the same texture on the reverse side of a face so that looking through an object, the inverted images will be drawn and seen through the mesh (Note texture assigned to the test above is "Alpha Clipped" to make the difference between each setting clearer)
Conclusion & Caveats ^
As discussed above, the main difference between the two approaches to setting up transparency in the 3DView is to do with their application based on assignments per-material or per-individual surface. By default Blender uses the latter because it doesn't require any special setting or options other than a bitmap image having an alpha-channel present (which determines transparency levels).
Doing this also ensure that older files loaded into any 2.5+/- version of Blender display correctly, even though the options to do this pre 2.49 versions may be in different locations or have different options available, Blender 2.6+ for example, has changed in this regards significantly, as discussed above, where all 'Texture Face' related settings are now found under the 'Game Settings' sub-section of a given Material. Note the above techniques are only really applicable to 'real-time' or live view rendering - 'offline' rendering of transparency (for images/movies) may need a different approach not covered in this tutorial.