HowTo/Export from Blender using FBX

From TrainzOnline
< HowTo(Difference between revisions)
Jump to: navigation, search
(WIP)
Line 1: Line 1:
 
(Work in progress)
 
(Work in progress)
  
This is very much a work in progress as: (1) the author learns more about the process, and (2) N3V are exploring the FBX format.  Please contact the author if you have something to contribute.
+
This is very much a work in progress as:
 +
(1) the author learns more about the process, and
 +
(2) N3V are exploring the FBX format.  Please contact the author if you have something to contribute.
  
 
==Introduction==
 
==Introduction==
Line 50: Line 52:
  
 
===The Main Menu===
 
===The Main Menu===
[[File:FBX_Main_Menu.jpg|380px|left|thumb|frameless|FBX Main Menu]]  
+
[[File:Blender_FBX_Main_Menu.jpg|380px|left|thumb|frameless|FBX Main Menu]]  
 
* Ignore the Operator Presets for now.
 
* Ignore the Operator Presets for now.
 
* Ensure FBX 7.4 binary version is selected.
 
* Ensure FBX 7.4 binary version is selected.
Line 56: Line 58:
 
* Selected Objects.  This option needs careful consideration.  Unlike the Blender XML exporter, the FBX exporter will export all objects in all layers
 
* Selected Objects.  This option needs careful consideration.  Unlike the Blender XML exporter, the FBX exporter will export all objects in all layers
 
which is probably undesirable in many cases and particularly if you have different LOD models in different layers.  So, first select those objects within Blender
 
which is probably undesirable in many cases and particularly if you have different LOD models in different layers.  So, first select those objects within Blender
that you want to export and then select Selected Objects in this panel. (note that hiding objects may be a useful option but that hasn't been tested)
+
that you want to export and then select Selected Objects in this panel.
* Scale.  Leave the Scale value as 1.00 and deselect the small icon to the right of the Scale value.  The default value for this icon is selected and
+
* Scale.  Leave the Scale value as 1.00 and deselect the small icon to the right of the Scale value.
will cause your object to be 100 times its specified size in Blender.  This issue is still being investigated.
+
* Forward and Up.  Set these to the values :Y forward and Z Up.
* Forward and Up.  Leave these in the default values of "-Z Forward" and "Y Up".
+
 
* The next six options of Empty, Camera, Lamp, Armature, Mesh and Other are mult selecti.e. zero or more can be selectedSelect Mesh only at this point.
+
The options below are multi select (i.e. you can select more than one)For the time being just leave Mesh selected.
* Leave the Experimental and Custom Properties as deselected.  These have not been tested.
+
 
* Leave Path Mode as Auto and Batch Mode as Off.  These will be investigated later.
+
* Leave the Experimental and Custom Properties as deselected.  
 +
* Leave Path Mode as Auto and Batch Mode as Off.  
 
* Choose the FBX filename and export using the Export FBX in the top right hand corner.  There is no exporter log.
 
* Choose the FBX filename and export using the Export FBX in the top right hand corner.  There is no exporter log.
 
{{clear}}
 
{{clear}}
 +
 +
====Tip====
 +
You can save your preferences for a given situation by clicking on the plus button (+) next to Operator Presets.  This is particularly useful for animation.
  
 
===The Geometry Menu===
 
===The Geometry Menu===
  
 
[[File:FBX Geometry Menu.jpg|380px|left|thumb|FBX Geometry Menu]]  
 
[[File:FBX Geometry Menu.jpg|380px|left|thumb|FBX Geometry Menu]]  
* Leave these values as shown. We need more information on this.
+
* Leave these values as shown. (more testing required ;o) )
 
{{clear}}
 
{{clear}}
  
Line 75: Line 81:
  
 
[[File:FBX Armatures Menu.jpg|380px|left|thumb|FBX Armatures Menu]]  
 
[[File:FBX Armatures Menu.jpg|380px|left|thumb|FBX Armatures Menu]]  
* Leave these values as shown.  We need more information on this.
+
* Leave these values as shown.  (See animation section)
 
{{clear}}
 
{{clear}}
  
Line 81: Line 87:
  
 
[[File:FBX Animation Menu.jpg|380px|left|thumb|FBX Animation Menu]]  
 
[[File:FBX Animation Menu.jpg|380px|left|thumb|FBX Animation Menu]]  
* Leave these values as shown.  We need more information on this.
+
* Leave these values as shown.  (See animation section)
 
{{clear}}
 
{{clear}}
  
Line 88: Line 94:
  
 
Setting up the CONFIG.TXT
 
Setting up the CONFIG.TXT
(The config.txt WiKi page will probably be updated in the future to reflect changes required for FBX)
 
  
 
The only changes to the config.txt are in the mesh table.  The mesh entries for FBX files now have a "trainzmesh" extention as per the following example:
 
The only changes to the config.txt are in the mesh table.  The mesh entries for FBX files now have a "trainzmesh" extention as per the following example:
Line 98: Line 103:
 
     }
 
     }
 
   }
 
   }
 +
 +
Note that for the LM.TXT Level of Detail (LOD) you can still use the LM convention but the LM.TXT file must refer to trainzmesh files.
  
 
==Files Created==
 
==Files Created==
Line 103: Line 110:
 
===Mesh Files===
 
===Mesh Files===
  
The file my-mesh.trainzmesh is created during the asset commit.  Currently the FBX file is not deleted but bundled into the asset and made available if opened for editThis may change.
+
The file my-mesh.trainzmesh is created during the asset commit.  Currently the FBX file is not deleted but bundled into the asset.  Since the FBX format is readable by 3D modelling tools, you may want to remove any FBX files from assets uploaded to the DLS or other web sites.
  
 
===Texture.txt Files===
 
===Texture.txt Files===
  
You can provide your own texture.txt files or let the commit process create them for you.  The commit process will create suitable files, such as those required for normal maps, but you can provide your own if you have special requirements.
+
You can provide your own texture.txt files (advisiable) or let the commit process create them for you.  The commit process will create suitable files, such as those required for normal maps, but you can provide your own if you have special requirements.
  
 
==Warnings and Errors==
 
==Warnings and Errors==
Line 155: Line 162:
  
 
Treatment of materials is unchanged and no changes to existing textures are required.
 
Treatment of materials is unchanged and no changes to existing textures are required.
 +
 +
Values you can play with in any material include:
 +
:* Diffuse colour
 +
:* Diffuse specular
 +
:* Specular colour
 +
:* Specular intensity.  This gets exported as specular factor.
 +
:* Specular hardness.  This gets exported as shininess exponent.
 +
:* Shading Emit.  Exported as emissive factor.
 +
:* Ambient.  Exported as ambient factor.
 +
 +
Be wary of checking Shading->Shadeless as this  stops the export of several attributes including: Specular Color, Specular Factor, Shininess Exponent, Reflection Color, Reflection Factor, Specular, and Shininess.  The actual effect of this has not yet been tested.
  
 
Notes in each material section identify what is exported by the Blender exporter however these attributes may not be recognised by TANE.  In particular, there is no point in specifying shader attributes as TANE uses its own shader.
 
Notes in each material section identify what is exported by the Blender exporter however these attributes may not be recognised by TANE.  In particular, there is no point in specifying shader attributes as TANE uses its own shader.
Line 160: Line 178:
 
===m.notex===
 
===m.notex===
  
Currently there may be a problem with mixing NOTEX materials and other materials in the same exportThis is being investigated.
+
[[File:Blender notex material panel.jpg|403px|left|thumb|frameless|NOTEX Material Settings]]
 +
The material name must be suffixed with "m.notex"For example, "box.m.notex".  A notex material has no texture and the colour of the material is derived from a simple RGB colour in the diffuse setting.
 +
{{clear}}
  
 
===m.onetex===
 
===m.onetex===
  
There are no special Blender settings for ONETEX materials.  A sample ONETEX material and texture setting is shown below.
+
[[File:Blender sample onetex material.jpg|403px|left|thumb|frameless|NOTEX Material Settings]]
 
+
The material name must be suffixed with "m.notex".  For example, "box.m.notex".  A notex material has no texture and the colour of the material is derived from a simple RGB colour in the diffuse setting.
(insert pics for onetex)
+
{{clear}}
  
Note: Version 84376 appears to be creating texture.txt files with an erroneous "alpha=" line.  This causes the asset to be partially transparent.  You should check the contents of all texture.txt files to ensure they meet your material requirements.
 
  
 
===m.reflect===
 
===m.reflect===
Line 184: Line 203:
 
[[File:Tbumptex-material1.jpg|403px|left|thumb|frameless|TBUMPTEX Material Settings]]  
 
[[File:Tbumptex-material1.jpg|403px|left|thumb|frameless|TBUMPTEX Material Settings]]  
 
There are no special material settings for a tbumptex material other than using "m.tbumptex" in the material name.
 
There are no special material settings for a tbumptex material other than using "m.tbumptex" in the material name.
Values you can play with include:
 
:* Diffuse colour
 
:* Diffuse specular
 
:* Specular colour
 
:* Specular intensity.  This gets exported as specular factor.
 
:*  Specular hardness.  This gets exported as shininess exponent.
 
:* Shading Emit.  Exported as emissive factor.
 
:* Ambient.  Exported as ambient factor.
 
  
Be wary of checking Shadeless as this  stops the export of several attributes including: Specular Color, Specular Factor, Shininess Exponent, Reflection Color, Reflection Factor, Specular, and Shininess.  The actual effect of this has not yet been tested.
+
 
 
{{clear}}
 
{{clear}}
  

Revision as of 22:36, 25 November 2016

(Work in progress)

This is very much a work in progress as:

(1) the author learns more about the process, and
(2) N3V are exploring the FBX format.  Please contact the author if you have something to contribute.

Contents

Introduction

This guide provides information for the export of FilmBoX (FBX) files from Blender.


Versions

TANE: 4.5 or later.
Blender: Not sure about this but it does work for Blender 2.77a or later. The FBX exporter is a standard addon for Blender.
FBX format: Binary format only (see discussion below). FBX 2011, FBX2012, FBX2013.
Special requirements: None. Creators will need their preferred image editors and text editors but there are no special requirements for FBX.
Other software: There are free FBX viewers available on the web including the FBX Review program by Autodesk.


The FBX format

A brief discussion on the FBX format history can be found here . FBX can be exported either as an ASCII (i.e. human readable) file or in binary format. TANE will only recognise the binary format.


Blender and FBX

Blender is capable of both importing and exporting FBX. The Blender exporter does not export all possible object attributes and it is likely that TANE will not recognise all those attributes that are exported. The Blender documention contains a list of attributes that are exported.

Included in this guide is a list of attributes that have been observed as exported and treatment/acceptance by TANE. The list is incomplete and so is a work in progress.


Skills Required

For this version of the guide, it is assumed the user has some knowledge of the use of Blender and an understanding of the Trainz asset creation process.


Exporting a mesh object from Blender in FBX format

The FBX exporter addon must be enabled in User Preferences.

Select File->Export->Export FBX and the FBX export panel will show in the bottom left hand corner and should look like the following picture. The panel contents vary significantly between the Binary export version and the ASCII export version so make sure you have Binary selected.

The Main Menu

FBX Main Menu
  • Ignore the Operator Presets for now.
  • Ensure FBX 7.4 binary version is selected.
  • The Main/Geometry/Armatures/Animation buttons provide menu options for the item selected. Select the Main option.
  • Selected Objects. This option needs careful consideration. Unlike the Blender XML exporter, the FBX exporter will export all objects in all layers

which is probably undesirable in many cases and particularly if you have different LOD models in different layers. So, first select those objects within Blender that you want to export and then select Selected Objects in this panel.

  • Scale. Leave the Scale value as 1.00 and deselect the small icon to the right of the Scale value.
  • Forward and Up. Set these to the values :Y forward and Z Up.

The options below are multi select (i.e. you can select more than one). For the time being just leave Mesh selected.

  • Leave the Experimental and Custom Properties as deselected.
  • Leave Path Mode as Auto and Batch Mode as Off.
  • Choose the FBX filename and export using the Export FBX in the top right hand corner. There is no exporter log.

Tip

You can save your preferences for a given situation by clicking on the plus button (+) next to Operator Presets. This is particularly useful for animation.

The Geometry Menu

FBX Geometry Menu
  • Leave these values as shown. (more testing required ;o) )

The Armatures Menu

FBX Armatures Menu
  • Leave these values as shown. (See animation section)

The Animation Menu

FBX Animation Menu
  • Leave these values as shown. (See animation section)


Config.txt

Setting up the CONFIG.TXT

The only changes to the config.txt are in the mesh table. The mesh entries for FBX files now have a "trainzmesh" extention as per the following example:

 mesh-table {
   default {
     auto-create                           1
     mesh                                  "my-mesh.trainzmesh"
   }
 }

Note that for the LM.TXT Level of Detail (LOD) you can still use the LM convention but the LM.TXT file must refer to trainzmesh files.

Files Created

Mesh Files

The file my-mesh.trainzmesh is created during the asset commit. Currently the FBX file is not deleted but bundled into the asset. Since the FBX format is readable by 3D modelling tools, you may want to remove any FBX files from assets uploaded to the DLS or other web sites.

Texture.txt Files

You can provide your own texture.txt files (advisiable) or let the commit process create them for you. The commit process will create suitable files, such as those required for normal maps, but you can provide your own if you have special requirements.

Warnings and Errors

The TrainzDev team are reporting issues back to N3V and many problems have been fixed. The following is provided to assist creators.


Warnings
Warning Help/Explanation
Phong shader not supported You can ignore this as Trainz uses its own shaders. The warning is supposed to be suppressed but still occurs in some circumstances
Number of polys exceeds 10,000 polys This is a standard TANE warning and not related to the FBX importer.
unused unused


Errors
Error Help/Explanation
LOD mesh poly counts are identical which triggers the 20% reduction error. You need to select only those meshes that will be exported for a LOD and ensure that Selected Objects is selected.
No meshes show in game or Preview Asset. This can occur for a number of reasons including material issues but ensure that your mesh has only one UV map.
unused unused


Materials

(This section may be moved to the Materials WiKi pages when the FBX importer is mature)

Treatment of materials is unchanged and no changes to existing textures are required.

Values you can play with in any material include:

  • Diffuse colour
  • Diffuse specular
  • Specular colour
  • Specular intensity. This gets exported as specular factor.
  • Specular hardness. This gets exported as shininess exponent.
  • Shading Emit. Exported as emissive factor.
  • Ambient. Exported as ambient factor.

Be wary of checking Shading->Shadeless as this stops the export of several attributes including: Specular Color, Specular Factor, Shininess Exponent, Reflection Color, Reflection Factor, Specular, and Shininess. The actual effect of this has not yet been tested.

Notes in each material section identify what is exported by the Blender exporter however these attributes may not be recognised by TANE. In particular, there is no point in specifying shader attributes as TANE uses its own shader.

m.notex

NOTEX Material Settings

The material name must be suffixed with "m.notex". For example, "box.m.notex". A notex material has no texture and the colour of the material is derived from a simple RGB colour in the diffuse setting.

m.onetex

NOTEX Material Settings

The material name must be suffixed with "m.notex". For example, "box.m.notex". A notex material has no texture and the colour of the material is derived from a simple RGB colour in the diffuse setting.


m.reflect

(TBD)

m.gloss

(TBD)

m.tbumptex

Material

TBUMPTEX Material Settings

There are no special material settings for a tbumptex material other than using "m.tbumptex" in the material name.


Diffuse Texture

TBUMPTEX Diffuse Texture Setting View 1

This shows the first set of texture settings for a tbumptex diffuse texture.

TBUMPTEX Diffuse Texture Setting View 2

This shows the second set of texture settings for a tbumptex diffuse texture.

Normal Texture

The following are two views of the settings for a normal texture. These settings do work although not all settings may be required.


TBUMPTEX Normal Texture Setting View 1

This shows the first set of texture settings for a tbumptex normal texture.

TBUMPTEX Normal Texture Setting View 2

This shows the second set of texture settings for a tbumptex normal texture.

Tbumptex Example Asset

This is a simple Blender cube asset mapped to a texture with features to demonstrate normal mapping.

Sample tbumptex scenery asset


m.tbumpenv

(TBD)

m.tbumpgloss

(TBD)

Exportable Attributes and TANE

(table here)


(to be continued)

Personal tools