In the beginning there was texface …
Tex Face is part of Blender original design from 15 years ago. The functionality it brought to the Blender Game Engine is still useful nowadays. However its design hasn’t changed and it lacks integration with other parts of Blender.
In order to support this legacy without holding our way to future designs we are introducing a total integration with the old system into the Material pipeline. The changes presented here are already in trunk and will be part of Blender 2.6.
What Changed in a Nutshell:
- “Texture Face” panel (in the Mesh/Object Data panel) no longer exists. Those settings are all part of the material properties, visible when Game Render is set.
- “Texture Face” Shading mode (in the Render panel) is now called “Single Texture”, it needs a material for special settings (e.g. Billboard, Alpha Sort, …).
New options in the Material Panel
- Shadeless option in the Material panel is now supported for all three Shading modes.
- Physics is now toggleable, this is the old Collision option.
- Two Side (on) is now called Back Culling (off).
- Alpha Sort is one of the Alpha options, together (and mutually exclusive) to Alpha Blend, Alpha Clip, Add and Opaque (i.e. solid).
- Shadow, Billboard and Halo are grouped in the “Face Orientation” property.
- “Face Textures” and “Face Textures Alpha” (under Options) can be used for all but GLSL shading mode (to be supported in GLSL eventually).
The backend in the game engine is still the same as before. The only changes are in the interface and in the way you need to think your materials. The bottomline is: It’s no longer possible to share materials between faces that do not share the same game properties.
Reasons to Change
The material system in Blender has grown wide and complex. With the advent of new graphic cards, new functionalities came for the game engine with more modern lighting techniques, shading and textures support.
Blender has a commitment of supporting old hardware, and so does the game engine for that matter. Over time this lead us with three shading systems and an inconsistent workflow between them. For example, in 2.59 and before, regardless of your shading mode you need to use the TexFace panel to set things such as Billboard, Collision, Alpha mode. However there is no way to navigate through your mesh and query what faces share what properties. Some of the properties are obsolete (i.e. Shared), and some are supported only in some modes (e.g. Light, more about this later).
By bringing all the settings to the material panel we are exposing to the user something that the game engine already does internally – see here. This takes full advantage of the material management tools such as the option to select, deselect and assign faces based on their materials – which, as we mentioned, was impossible with the old system.
The Painless Way of Migrating to Blender 2.6
or: how to ensure your file will be converted with 100% of success.
If you are working in Blender 2.59 (or even in the 2.4 series) there is a way to ensure you will have no problem when you decide to migrate to new versions of Blender. The golden rule is: do not share materials between faces/meshes when they do not share the same game settings.
Even if you are using the former Texture Face shading mode you can create redundant materials if you don’t want to set lighting/shadeless after you migrate. If you can, use the options per object, e.g. in the Physics panel you can set collision on and off, and also the visibility of the mesh.
On Load Conversion
If some of your meshes have no material but are making usage of texface properties, a new material will be created for them. For non-existent materials the name will be Material.TF.flag, where flag is a number representing the combination of game settings used by this meshes/faces. Faces that had no material and share the same game settings will be sharing the same material as well.
If your meshes all have materials but you are using texface game setting the material will try to be converted. This will be only possible if all the faces using the same material share the same game settings. In case they don’t we have a conflict and the solution is to split your material into as many materials as needed. This would affect “render” files though, thus it’s not done automatically at first. Instead you will see an error message and be invited to convert the remaining materials with a script:
Post Load (i.e. manual) Conversion
If you got an error message while loading your Blender 2.59 file don’t worry. That means it was not possible to automatically convert all your meshes and materials. In the console you can find a list of all the materials that fall on that situation.
Go to the Help menu and click in “TexFace to Material Convert”. Your conflicted materials will be split into copies of the same but with unique game settings. The original materials will be kept in the file, but with no mesh using them they will be removed after you save and re-open your files. This should be enough in 95% of the cases. But …
There Gotta be a Catch
There certainly is. Although most of the usual and corner cases are addressed, there are some decisions that had to be made that will require extra fiddling. The main one is the “Light” flag in the old Tex Face panel. From the three shading systems the former Face Texture and Multitexture are the only one to use this parameter. The GLSL mode, however, completely ignores this. Since the GLSL mode is the latest mode this was the one prioritized here. Therefore if the material of your faces need individual control over the light (on/off) you need to set it in the Material panel in the Shadeless option.
Also linked materials are not analyzed/converted during the load nor the post-load conversions. If you are using material from linked Libraries you need to convert them in their original files.
My Exporting Script was Relying on the TexFace Properties
We still have access at the same functionality as before. But instead of accessing it per face we have it per material. A mesh can have an infinitude of materials which give as much flexibility as the old system.
But Why Do We Keep Breaking Old Files?
Speaking both as a user and a developer I know how painful it’s to find that your old files don’t work as it used to. In order to prevent that, more than half of the coding time for this patch was poured in the conversion code. Sometimes in order to move on we need to let it go of some legacy. If you face any particular problem in dealing with your old files please do contact me. If the needs arise I can put together a FAQ and a list of common pitfalls.
Things may change slightly before the 2.6 final release. Make sure you read the release log when time comes.