Destinations/Importing Tutorial

From Valve Developer Community
Jump to: navigation, search

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.
A Turret yesterday.
  • 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.
textures as the appear in Maya.

Exporting FBX

  • 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.
textures as the appear in Maya.
    • Embed Media is the option that will include the assigned textures, and package them into the FBX files, so check this.
textures as the appear in Maya.
  • 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.
textures as the appear in Maya.

Importing into Workshop tools

  • If you havn't already, create a new addon where your model with be used.
textures as the appear in Maya.
  • 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.
textures as the appear in Maya.
  • Open the model editor, this is where we will import the FBX.
textures as the appear in Maya.
  • Under file, select 'create New mesh from file'
textures as the appear in Maya.
  • 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.

textures as the appear in Maya.
    • 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]
textures as the appear in Maya.

Model Editor

  • 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.
textures as the appear in Maya.
  • 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.


Adding animations

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

textures as the appear in Maya.
  • Underneath animations pulldown, select "add animation". This may take a little while depending on the length of your animation.

13_add_animation.png

textures as the appear in Maya.
  • 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.

textures as the appear in Maya.


  • 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.
textures as the appear in Maya.


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.

textures as the appear in Maya.


  • 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.
textures as the appear in Maya.

To create an idle of a static turret change the end frame to 0, effectivly removing all the animation.

textures as the appear in Maya.
1
textures as the appear in Maya.

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

Materials

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
textures as the appear in Maya.
  • 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.
1
textures as the appear in Maya.
  • This has created a reflectance component to the shader and you can see the highlight on the material.
1
textures as the appear in Maya.

By default, the reflectance is looking for a texture, If you have authored a reflectance texture it must live with the unpacked ones made during the import process here. /content/steamtours_addons/portal_turret/materials/models/turret_models/

1
textures as the appear in Maya.

Now you can see the effect of the texture on the highlight.

1
textures as the appear in Maya.
  • You can further tweak the effect of the texture with the reflectance range sliders below.
1
textures as the appear in Maya.

Image

  • 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.
1
textures as the appear in Maya.

Moving the slider to the right increased the strength of the highlight. A lot of shader components have this feature.

1
textures as the appear in Maya.


  • There is a useful history tool at he bottom so you can backtrack if you tweaked yourelf away from a good setting.

Image

remember to save the material one you are done.

Now you have model with animations that you can use in Hammer,

like in this this hammer tutorial.