Content is copyright © KatsBits™ 2000-2013. All Rights Reserved.
No part of this web site may be reproduced (except for personal use) without prior written permission from KatsBits.com. For more infomation on copyright click here.
A common issue that crops up modelling with Blender 3D or developing content for games, is how to make a mesh double-sided whilst using different materials on the each face. Although the solution is relatively straightforward, it has to be implemented relation to the renderer being used; rendering two sided faces increases the amount of data being processed regardless as to the process used. Bear that in mind when reading the following tutorial and/or implementing this 'trick' in a game.
If we start with the basic question of;
Can I have a two sided face in Blender/my game using different materials on each side?
The basic answer is;
'Yes' and 'no' depending on what you're trying to do and what you're using.
Generally speaking all faces are rendered single sided by default as it's the quickest and most efficient way to give shape and form to, and in, a real-time environment by processing the coordinate data associated with the individual polygons from which objects are composed. Due to the fact that items are rendered to screen this way, standing inside a mesh looking out, the user or player is able to see the external world because nothing is blocking their view of it. This is the default condition of a mesh.
If, on the other hand, the mesh needs to have an 'inside' this means 'forcing' double or two-sided polygons. This is done through duplicating and inverting (relative to the orientation of the original face the duplication came from) a face so its normal point inwards, the end result being two identical faces, back-to-back. Because standard double-sided polygons are created this way, the duplicate will also carry the same 'face data' as the original - the same materials, UVW's, textures, etc are copied onto the inverted face when duplicated, resulting in both being identical (except for the orientation).
Design Note: this is one of the reason why polygons have face normals because they are used to determine the orientation a given polygon is facing.
Now whilst it is technically possible to render a standard two-faced mesh with different materials on either side, it can only generally be done through some relatively complex calculations that have to differentiate and then determine how materials and surface properties are assigned to any duplicate faces in such a way as to mean they become independent elements from the original. This all requires precious resources and processing time to render to screen, in essence;
mesh » duplication » invert » mat lookup » assign » render
However, because it's generally a good idea to do things as 'cheaply' as possible, the best way to actually achieve a two-sided mesh with different material assignments is to use two separate meshes like this;
mesh 1: » matset1 » render
mesh 2: » matset2 » render
Essentially everything is pre-calculated, polygon positions, material assignments and surface data is already present in the mesh so all that's being done (relatively speaking) is the 'reading' and 'rending' of that data.
Before progressing it helps to activate "Wire" mode - in Blender this option is located in "Object" properties, under the "Display" sub-section (for Blender 2.49 click "Wire" in "Object" ("F7") buttons). The following assumes the mesh has been UVW mapped and textured, if it's not then activate "Face Normals" so it's easier to see which direction a polygon is facing (because the mesh may or may not be displayed as the 'white' of untextured surfaces).
The default "Viewport Shading" mode in Blender is "Solid". In this mode meshes (faces and polygons) appear double sided because it's relatively straightforward for the application to render a materials simple flat colours to both sides of a face (shown below).
However, when the scene is toggled to "Textured" mode ("Alt+Z"), the mesh effectively vanishes from view because there's nothing being rendered from the 'inside' of the mesh; this incidentally means the mesh can't be selected because Blender thinks there's nothing there to select - this is the reason for activating "Wire" mode; with the wireframe visible, it also means the mesh is subsequently visible as a selectable object (shown below).
Select the object and make a 'unique duplicate' using "Shift+D" or "Object >> Duplicate", this will create a copy of the original mesh that's not directly linked to it (changes to this new mesh won't effect the original, and visa-versa).
Switch to "Edit" mode ("Tab") and select the entire mesh ("A"). In the toolbar on the left find the "Normals" sub-section and click "Flip Direction" or "Ctrl+F >> Flip Normals". The mesh will invert, the faces then pointing inwards as shown below so that there are now two versions of the same mesh structure, with different material assignments, for both the 'outer' and 'inner' surfaces of the object.
Flip or invert the face normal's so they point 'inwards'. 1) "Flip Direction" button in the "ToolShelf" inverts selected faces. 2) activate "Normals" for "Face" to see direction if mesh isn't UVW mapped/textured. 3) inverted polygons
View showing both the original and duplicate mesh with their respective faces pointed outwards (original) and inwards (duplicate)
Because the duplicate mesh is a separate object in it's own right, Vertex Colours can be painted onto the mesh without affecting to the other side - which can't normally be avoided when relying on 'standard' two-sided materials
Similarly, assigning a separate material to the duplicate mesh, which has no affect on the original mesh because they're both completely independent objects
For this process to be effective, it's best to ensure that materials applied to objects are not using any form of general or global double sided setting or surface flag; this applies as much to using Blender 3D and 3D applications in general as it does to game engines because it's more efficient to only render surfaces that need to be treated as double-sided, standard materials should be single-sided by default to which two-sided is then applied as required on a case-by-case basis.
The process described above is also a handy 'cheap' way to produce double-sided objects using technology that doesn't have that capability - simple items such as windows, sprites and so on can be made on condition that they're not to be 'spammed' over a wide area - grass sprites over a terrain for example - as that can be resource heavy to render.
Learn Blender 3D - learn to make a simple low-poly rigged and animated character
Blender & IMVU furniture - new to Blender? IMVU? Learn to make furniture quickly
Displaced Terrain Mesh - using displace to make a basic terrain +optimisation tips
Displace & Simple Terrain - making a simple terrain in Blender 2.49 using displace