Double or two sided meshes/materials in Blender 3D

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.

Single sided faces & meshes ^

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.

Double or two sided faces & meshes ^

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.

Double sided meshes with different materials ^

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.

How to set up double-sided meshes ^

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).

Double sided face rendered in Blender 2.5 "Solid" Viewport Shading mode

Although the mesh and faces are UVW mapped and textured, in "Solid" view the mesh is draw double-sided due to using basic material colour values

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).

Viewed in Textured mode, only a single side is visible in Blender 2.5

Switching the "Textured" view reveals the mesh, by default, as being single-sided only; this requires the least amount of resources to render to screen

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).

Shift+D Duplicating the original mesh

Shift+D duplicated original mesh, which also copies material, texture and UVW map data from the original to the duplicate

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.

Inverting face normals to point 'inside'

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

Showing both the original and duplicate meshes

View showing both the original and duplicate mesh with their respective faces pointed outwards (original) and inwards (duplicate)

Using Vertex Paint on duplicate mesh in Blender 2.5

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

Assigning a completely separate material to mesh duplicate

Similarly, assigning a separate material to the duplicate mesh, which has no affect on the original mesh because they're both completely independent objects

Conclusion ^

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.

Buy now instant access eBook download also available
Connect to KatsBits on Facebook Follow KatsBits on Twitter Connect to KatsBits on LinkedIn Google+ Subscribed to KatsBits on YouTube
Search KatsBits using StartPage
KatsBits Web