This article relates to the game "Dota 2". Click here for more information.
This article relates to the SDK/Workshop Tools for "Dota 2 Workshop Tools". Click here for more information.
This article's documentation is for Source 2. Click here for more information.

FBX

From Valve Developer Community
Jump to: navigation, search
English (en)中文 (zh)Translate (Translate)

Notes of usage of FBX files in the Dota 2 Workshop Tools.

Material Assignment

Generally FBX files are supported without any special considerations but mapping material assignments on geometry needs some special consideration.

Note that all resource references, including materials, are the mod relative filename of the resource. Unlike the Half-Life 2 Source SDK, there are no implied directories such as materials are in the "materials/..." tree.

The algorithm to match an FBX material assignment to a source material follows these steps.

  1. If there's an string FbxProperty on the FbxSurfaceMaterial named "FBX_vmatPath" then that value is used as is for the material assignment.
  2. If that fails, the name of the FbxSurfaceMaterial itself is attempted to be matched against existing materials in CONTENT and GAME. If one is found, that is used as the material path.
  3. If that fails and the FbxSurfaceMaterial has texture assignments, the filenames of the textures are converted to material filenames and if there's an existing material which matches that is used.
  4. If that fails and the texture filename ends with "_color.*" or "_normal.*", "_color" and "_normal" is stripped, the filename is converted to a material filename and if there's an existing material which matches that is used.

Here's an example of and FBX ASCII file with an "FBX_vmatPath" string property specifying the material to use:

Material: 668812176, "Material::tile_stone_000_75", "" {
	Version: 102
	ShadingModel: "phong"
	MultiLayer: 0
	Properties70:  {
		P: "EmissiveColor", "Color", "", "A",1,1,1
		P: "EmissiveFactor", "Number", "", "A",0
		P: "DiffuseColor", "Color", "", "A",1,1,1
		P: "DiffuseFactor", "Number", "", "A",0.8
		P: "SpecularColor", "Color", "", "A",1,1,1
		P: "SpecularFactor", "Number", "", "A",0.2
		P: "ShininessExponent", "Number", "", "A",256
		P: "ReflectionColor", "Color", "", "A",1,1,1
		P: "ReflectionFactor", "Number", "", "A",0
		P: "FBX_vmatPath", "KString", "", "U", "materials/stone/tile_stone_000_75.vmat"
		P: "Emissive", "Vector3D", "Vector", "",0,0,0
		P: "Ambient", "Vector3D", "Vector", "",0.2,0.2,0.2
		P: "Diffuse", "Vector3D", "Vector", "",0.8,0.8,0.8
		P: "Specular", "Vector3D", "Vector", "",0.2,0.2,0.2
		P: "Shininess", "double", "Number", "",256
		P: "Opacity", "double", "Number", "",1
		P: "Reflectivity", "double", "Number", "",0
	}
}


Houdini

Houdini has a specific method for material assignment.

Dependency Tracking

In the FBXHeaderExtension, if there's an "Original|FileName" string FbxProperty that filename will be added to the asset dependency list.

An example of a properly structured "Original|FileName" specifying the .lxo (Modo) file that the .fbx file was generated from.

FBXHeaderExtension:  {
	FBXHeaderVersion: 1003
	FBXVersion: 7300
	CreationTimeStamp:  {
		Version: 1000
		Year: 2014
		Month: 3
		Day: 25
		Hour: 15
		Minute: 22
		Second: 56
		Millisecond: 976
	}
	Creator: "FBX SDK/FBX Plugins version 2013.3"
	SceneInfo: "SceneInfo::GlobalInfo", "UserData" {
		Type: "UserData"
		Version: 100
		MetaData:  {
			Version: 100
			Title: "test_cube_001"
			Subject: ""
			Author: ""
			Keywords: ""
			Revision: ""
			Comment: ""
		}
		Properties70:  {
			P: "DocumentUrl", "KString", "Url", "", "D:\Dev\main\content\dota\models\test\fbx\test_cube_001.fbx"
			P: "SrcDocumentUrl", "KString", "Url", "", "D:\Dev\main\content\dota\models\test\fbx\test_cube_001.fbx"
			P: "Original", "Compound", "", ""
			P: "Original|ApplicationVendor", "KString", "", "", "The Foundry"
			P: "Original|ApplicationName", "KString", "", "", "MODO"
			P: "Original|ApplicationVersion", "KString", "", "", ""
			P: "Original|DateTime_GMT", "DateTime", "", "", "25/03/2014 22:22:56.976"
			P: "Original|FileName", "KString", "", "", "D:\Dev\main\content\dota\models\test\modo\test_cube_001.lxo"
			P: "LastSaved", "Compound", "", ""
			P: "LastSaved|ApplicationVendor", "KString", "", "", "The Foundry"
			P: "LastSaved|ApplicationName", "KString", "", "", "MODO"
			P: "LastSaved|ApplicationVersion", "KString", "", "", ""
			P: "LastSaved|DateTime_GMT", "DateTime", "", "", "25/03/2014 22:22:56.976"
		}
	}
}

See also