Difference between revisions of "Destinations/Importing Tutorial"

From Valve Developer Community
Jump to: navigation, search
(Created page with "= 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 ed...")
 
(Redirect)
 
(20 intermediate revisions by 4 users not shown)
Line 1: Line 1:
= Importing an FBX into Workshop tools  =
+
#redirect [[SteamVR/Environments/Importing_Tutorial]]
 
 
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.
 
 
 
[[Image]]
 
 
 
[[Image]]
 
 
 
* Source2 only deals with skeletal animation.  You cannot animate meshes or a group of meshes by themselfs, you must either skin the geometry to the skeleton, or alternatively you can just parent geometry underneath the relevant bone.
 
 
 
* This model has 4 animations, and uses 4 textures.
 
 
 
== 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.
 
 
 
 
 
[[image]]
 
 
 
** Embed Media is the option that will include the assigned textures, and package them into the FBX files, so check this.
 
 
 
[[image]]
 
 
 
* 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.
 
 
 
[[Image]]
 
 
 
* Once created, hit teh 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.
 
 
 
[[Image]]
 
 
 
* 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]
 
 
 
== 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.
 
 
 
* 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 means you have not successfully imported your materials, this is most likely a problem with the FBX export.
 
 
 
[[Image]]
 
 
 
== 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.
 
 
 
[[Image]]
 
 
 
* Underneath animations pulldown, select "add animation". This may take a little while depending on the length of your animation.
 
 
 
[[Image]]
 
 
 
* 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.
 
 
 
[[Image]]
 
 
 
* 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.
 
 
 
[[Image]]
 
 
 
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 that We'll not mess with today.
 
 
 
[[Image]]
 
 
 
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 in d
 
 
 
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.
 
 
 
[[Image]]
 
 
 
To create an adle of a static turret  change the end frame to 0 as well.
 
 
 
[[Image]]
 
 
 
[[Image]]
 
 
 
== 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.
 
 
 
[[Image]]
 
 
 
* 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.
 
 
 
[[Image]]
 
 
 
* 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, 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/
 
 
 
* You can tweak the effect with the reflectance range sliders below.
 
[[Image]]
 
 
 
[[Image]]
 
 
 
* Alternativley you can hit the gradient button that switches the texture path to a slider if you just want a simple solid color to define the reflectance. moving the slider to the right increased the strenght of the highlight.  A lot of shader components have this feature.
 
 
 
[[Image]]
 
 
 
[[Image]]
 
 
 
* 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,
 
 
 
[https://developer.valvesoftware.com/wiki/Destinations/Turret_Tutorial check out this hammer tutorial].
 

Latest revision as of 22:26, 28 June 2017