Importing an FBX into Workshop tools
In this tutorial, we will walk through importing an FBX with animations and textures, and run them through the Model and material editor.
- Export Model, as FBX, from authoring package (Autodesk's Maya in this case)
- Export animations, as FBX files.
- Import model into model editor.
- Import animations into model editor
- Editing materials
Authoring the model
- In the case of this Turret model from Portal2, Maya was used to build the model and the animtions, textures were assigned to the meshes within Maya.
- Source2 only deals with skeletal animation. You cannot animate meshes or a group of meshes by themselves, you must either skin the geometry to a skeleton, or you can just parent geometry underneath the relevant bone.
- This model has 4 animations, and uses 4 textures.
- Exporting the model and materials.
- Upon Exporting, there are many options in the FBX exporter, make sure Deformed Models and skins, are checked.
- You can export this FBX wherever you like, when you pull it into the workshop tools the importer will generate the correct directory structure.
- Embed Media is the option that will include the assigned textures, and package them into the FBX files, so check this.
- Exporting the animations.
- In this case the four animations were authored in four separte Maya files, so there is an FBX exported for each animation, for now export these animation FBXs to the same place you exported the model FBX. You only need the skeleton in this export, but it's ok to export the model too. make sure you UNCHECK the embed media box if you do, so you don't have duplicate textures.
Importing into Workshop tools
- If you havn't already, create a new addon where your model with be used.
- Once created, hit the 'Launch Tools' button. this will bring up the asset browser, if this is a new addon it will be empty apart form the soundevents file.
- Open the model editor, this is where we will import the FBX.
- Under file, select 'create New mesh from file'
- This will bring up a warning about the directory structure. click ok to let the tools create the directory structure for you.
It creates a folder under the addon name you gave, for instance, steamapps\common\destinations\content\steamtours_addons\portal_turret\models, it also create a materials directory and unpacks the textures there.
- You are almost there, but you just need to create the folder all the file s assocoated with this model will live under, No upper case letters, spaces or symbols, only lower case letters, numbers and underscores. This seems unnessessary, but if you had lots of different models in your addon adding this named folder for each model would help keep thing tidy. You have to right click the window, create a new folder and name it. Here is called turret_model, select it and hit [Select folder]
- Clicking Ok opens your model in the model editor. Under UI you will find the outliner and the Property editor if they are not up by default.
- If all has gone well, you will see the model with all it's textures. The skeleton and the materials will be displayed in the outliner. You may run into a situation where the model is made out of glowy wireframes, this is most likely a problem with the FBX export.
- Before we import them into the tools, we must copy the animation FBXs to the same directory under models you created earlier, steamtours_addons\portal_turret\models\turret_models.
You will see in there a DMX and a VMDL that the model editor created.
- Underneath animations pulldown, select "add animation". This may take a little while depending on the length of your animation.
- You can see the animations here, so far I only added 3penny_hi.
If you select this animation in the outliner, you can play it using the play controls at the bottom right of the model editor.
- You can add as many animations as you like at a time. So I will grab the three remaining FBXs and add them all at once.
Here in the property editor you can see the lenth of the animation expressed in frames. You start the animation later or end it early by atlerning the numbers in these fields. You can speed up or slow down the animation by changing the FPS, and make the animtion loop. There are more advanced things to do in here.
- You can also create new animation sequences from existing animation. It's often useful to have an idle animation, this can often be just a static animtion. In the case of the turrets, their idle is them just sitting their with the gun foils closed. Since this state exists as the first frame of these animations, we can just that instead of having to export another FBX.
- To do this start by copying one of the animations. a dialog box will pop up asking for a name for this animation, I'm calling it idle.
To create an idle of a static turret change the end frame to 0, effectivly removing all the animation.
Instead of exporting 4 different animations, you could author them as one big sequence, one animation after the other, you could then make four copies of this long animation and clip out the relevant frame ranges from.
Remember to save the model.
When you imported the FBX with embedded media, the importer created basic materials for each texture according the shader you selected upon import, if you don't remember doing that the default is VR_standard, which is a fine choice.
- To edit the material (vmat), double click one in the outliner to open the material editor.
Alternativly, you can do this from the asset editor.1
- Here you can assign other textures to different parts of the material. By default the Vr Standard shader has no Specular. Turn it on with the checkbox.
- This has created a reflectance component to the shader and you can see the highlight on the material.
By default, the reflectance is looking for a texture, the material editor makes a simple grey texture for a placeholder. If you have authored a reflectance texture it must live with the unpacked ones made during the import process. /content/steamtours_addons/portal_turret/materials/models/turret_models/1
Now you can see the effect of the texture on the highlight.1
- You can further tweak the effect of the texture with the reflectance range sliders below.
- If you just want a simple solid color to define the reflectance, you can hit the gradient button that switches the texture path to a slider.
Moving the slider to the right increased the strength of the highlight. A lot of shader components have this feature.1
Looking at the eye material, it need to glow. One way of doing this is to use self illumintaion. this looks at the color texture, and makes it incandescent. Check the 'sefl illum' box in the left, which enables a slider to increase the effect.1
Remember to save the material one you are done.
Now you have model with animations that you can use in Hammer,