-
Notifications
You must be signed in to change notification settings - Fork 7
Using the Blender Add on
- Refer to this guide on how to install the Blender Add-on.
- The directory can be selected using the button. This directory can be the asset directory of the game where the files can be exported directly. An existing module directory can be selected and the files are exported there. Click here for a tutorial on how to setup Terasology development environment.
- The directory can also be selected using the button to export the module. Further details are provided below.
- As an example the skeleton model can be used to follow along for this tutorial. It contains model, texture and animations for the skeleton.
The directory path can be saved by navigating to File->User Preferences->Save User Settings.
-
The model created in Blender can be exported for Terasology in .md5mesh format.
-
The mesh will be exported in the directory specified in a folder called skeletalMesh.
-
Click Export .md5mesh to export the mesh.
Make sure the model has UV laid out otherwise the script will throw an error.
Make sure all the actions are created under a new scene and the scene has the same name as that of action.
- Animations are exported in a .md5anim format.
- List of animations to be exported can be selected in the UI. The animations that are selected will be exported to a folder called animations inside the directory that is selected.
- After selecting the animations click the Export Selected Animations button to export the animations to the directory.
Prefab contains a basic definition for the model that can be spawned using the spawnPrefab
command.
The structure of prefab looks like this:
{
"skeletalmesh" : {
"mesh" : "",
"heightOffset" : -0.8,
"material" : "",
"animation" : "",
"loop" : true
},
"Behavior" : {
"tree" : "stray"
},
"FleeOnHit" : {
"minDistance" : 5,
"speedMultiplier" : 1.2
},
"StrayIfIdle" : {
"defaultSpeedMultiplier" : 0.3
},
"BlockDropGrammar": {
"blockDrops": [],
"itemDrops": ["2*WildAnimals:meat"]
},
"Stand" :{
"animationPool": []
},
"Walk" :{
"animationPool": []
},
"Die" :{
"animationPool": []
},
"persisted" : true,
"location" : {},
"Character" : {},
"AliveCharacter": {},
"WildAnimal" : {
"name": "",
"icon": ""
},
"NPCMovement" : {},
"CreatureNameGenerator" : {
"genderRatio" : 0.5,
"nobility" : 0.5,
"theme": "DWARF"
},
"CharacterMovement" : {
"groundFriction" : 16,
"speedMultiplier" : 0.3,
"distanceBetweenFootsteps" : 0.2,
"distanceBetweenSwimStrokes" : 2.5,
"height" : 1.6,
"radius" : 0.3,
"jumpSpeed" : 12
},
"CharacterSound" : {
"footstepSounds" : ["FootGrass1", "FootGrass2", "FootGrass3", "FootGrass4", "FootGrass5"],
"footstepVolume" : 0.03
},
"Network" :{},
"MinionMove" : {},
"Health" : {
"destroyEntityOnNoHealth" : true,
"currentHealth": 7
},
"BoxShape" : {
"extents" : [1.5, 1.5, 1.5]
},
"Trigger" : {
"detectGroups" : ["engine:debris", "engine:sensor"]
}
}
-
skeletalmesh->mesh
defines the name of the mesh that is to be used (Example for a model namedeer
the mesh field should bedeer
) -
skeletalmesh->material
contains the name of the material file (.mat) which will be used for the mesh. Further details about the material file are given below. - Fields like
Stand
,Walk
,Die
contains the list of animations out of which one is played at random. These fields are filled according to the naming convention of the animations. Further modifications can be done by the user.
The prefab is exported inside a folder called prefabs in the directory that is selected. The prefab is created from a template file. Actions present in the blender file are added to the prefab file according to their name.
- Action name containing stand or idle in their name are put under the Stand "animation Pool".
- Action name containing walk in their name are put under Walk "animation Pool".
- Action name containing die in their name are put under Die "animation Pool".
- All other actions are put under Stand "animation Pool".
The texture must be present in the directory of the folder of .blend file. named modelNameTexture.png.
The texture is exported inside a folder called textures in the directory that is selected.
The material file contains details about the texture that the model needs to use. Its structure looks something like this:
{
"shader" : "engine:genericMeshMaterial",
"params" : {
"diffuse" : "deer",
"colorOffset" : [1.0, 1.0, 1.0],
"textured" : true
}
}
- The
params->diffuse
field contains the texture file name that needs to be used.
The entire module can be exported using the button in the Panel.
After the export the default directory path becomes the one where the module was exported. This facilitates in exporting modified content for the same module.
- Navigate to File->Export->Export zip for Terasology.
- Select the directory to export and click Export Zip.
The file exported is a ready to use module file. It can be copied into the modules folder(or better created there) and can be activated in game.
The command spawnPrefab modelName can be used to spawn an entity.
The model can be spawned in game using the spawnPrefab
command.
- Press the ` in game to open up the console.
- Type
spawnPrefab
followed by the file name of the model. For example if the the model name is "deer.blend" the command would bespawnPrefab deer
. This will spawn a deer which the definitions from the prefab file. The prefab file can be edited as mentioned above for various customization.