S2ENGINE HD  1.4.6
Official manual about S2Engine HD editor and programming
Importing FBX into S2Engine

Several file formats are supported by S2ENGINE importing plugins.

Here we describe how to import models from the well-known FBX format.
When you want to import a model you must click on IMPORT button of the prefabs browser as showed into the following image:

import01.jpg
Note
You can choose the folder in which to import your model by exploring the prefabs browser.

When clicking on the IMPORT button a file dialog appear for selecting the file to import.
Choose the file and click on Open.
Basing on the file format of the model to import a plugin is chosen by the system. The chosen plugin will show its own import options dialog.
In the case of the FBX file format the dialog will appear as in the following image:

import02.jpg

The most important parameters are:

  • rescale: Rescale the model before importing it by the specified factor
  • importGeometry: Import the model geometry (you can set it to false in the case you have to import only model animation)
  • importAnimation: Import model animation if it exists. (default value is false)
  • collapseFBX: If true this parameter makes the additional nodes created by FBX exporter (see Setup Mesh) to be collapsed. An example of use will be showed below.
Note
If you are importing the model for the second time, as in the case of picture before,
the system will ask you if you also want to overwrite materials already generated during previous importing.

If you do not choose a folder in which to import the model, the plugin automatically creates a folder named as the FBX file to import and use it as destination for all assets.

For every model into the FBX file the plugin creates a prefab associated with the model, the filename of the prefab is the same as name of the model.
The prefabs are placed inside the destination folder as said, BUT you can change the destination folder of the associated resources (model, textures, animations, materials) by changing the following parameters:

  • ModelsFolder: Folder in which to put models
  • TextureFolder: Folder in which to put textures
  • MaterialsFolder: Folder in which to put materials
  • AnimationsFolder: Folder in which to put animations
import03.jpg

Importing Static mesh from FBX

To import static meshes simply click import button of the import dialog, if all goes well the engine will create:

  • A single mesh model file (.SM2)
  • All materials associated with it
  • All textures used by materials
  • And finally a prefab containing the model imported.

To view the prefab created:

  • Open the Prefabs Browser
  • Go into the folder in which the prefab must be
  • Right-click mouse button and choose Inspect from the drop-down menu, as showed into the following image:
    import04.jpg

The prefab Viewport and Prefab Tool will be showed containing the created prefab.
To inspect the model associated with the prefab right-click mouse button on the model parameter and choose Inspect from the appearing drop-down menu, as showed into the following image:

import05.jpg

At this point we come back to talk about FBX collapsing. If you haven't Freezed transformations in Maya before exporting (see Preparing FBX Models in Maya for S2Engine), or if you haven't check the collapseFBX parameter into the import plugin dialog, the model you see will be like the following:

import06.jpg
Note
Multiple nodes created.
In this case a hierarchy model has been creates (.SH2 file format), instead of a single mesh (.SM2), 'cause the system has find more than one node inside the source model.
This is of course a waste of resources. To avoid this and make system to import model correctly you have to set true the CollapseFBX parameter of the import plugin dialog:
import07.jpg

In this case all redundant nodes are collapsed in a single one and a single mesh is created:

import08.jpg

Importing Hierarchical mesh from FBX

To import hierarchical meshes simply click import button of the import dialog, if all goes well the engine will create:

  • A hierarchical mesh model file (.SH2)
  • All materials associated with it
  • All textures used by materials
  • And finally a prefab containing a custom entity class object with associated model imported.

If you have setup hierarchical model correctly (see Hierarchical Mesh Models) There is no need to check CollapseFBX option in the model importer as for static and skinned meshes.
This is due to the fact that, in the correct case, the pivots of the meshes have all transformations correctly Freezed.
If your model isn't correctly built in Maya the result of import should look like the following image:

import_hierarchy10.jpg
Note the additional created nodes


The following image, instead, shows the correct result:

import_hierarchy11.jpg


Importing Skinned mesh from FBX

To import skinnedmodels simply click import button of the import dialog, if all goes well the engine will create:

  • A skinned model file (.SK2)
  • All materials associated with it
  • All textures used by materials
  • And finally a prefab containing a character class object with associated skinned model.
Note
Avoid additional nodes.
As showed in the case of single meshes (and also in the case of hierarchical meshes) FBX importer will create additional nodes containing pivot transformations.
This is undesirable because we want our model containing the minimal number of nodes.
To avoid this and make system to import model correctly you have to set true the CollapseFBX parameter of the import plugin dialog:
import07.jpg

Note that in the case of skinned model this option is mandatory in order to import model correctly.

As showed in Skinned models before exporting the skinned model you must be sure the root node has pivot reset.
The following is an image showing what happens if you don't reset pivot of root and import model WITHOUT CollapseFBX option:

import_skinned09.jpg
Note
In this case, if you try to check the CollapseFBX option the skinned meshes of the model will not be imported.