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.

MaterialGroups

From Valve Developer Community
< VMDL(Redirected from Valve Model/MaterialGroups)
Jump to: navigation, search
English (en)Translate (Translate)

Material Groups provide a way to set up different sets of materials on your model, these are commonly referred to as skins.

Display

  • Material Groups are under the "Material Group List" item in the outliner.
  • Selecting a material group item will switch to that material group in the viewport.

Create

Edit

  • To add a material group, select the "Material Group List" item and press the green "+" button in the property editor.
  • To edit a material group, select it in the outliner.
Tip.pngTip:The first item needs to match the default materials on the model, and the additional items all need to match the material count of the model.

Data Structures

The vmdl lod group data looks like this

CVNodeMaterialGroupListReference m_pMaterialGroupList = CVNodeMaterialGroupListReference
{
	NodeMaterialGroupList_t* m_pObject = &NodeMaterialGroupList_t_0
	string m_sFileName = ""
}

m_pMaterialGroupList

The reference to the CVNodeMaterialGroupListReference of the vmdl:

Attribute Friendly Name Description Type Default Value
m_pObject Pointer to the NodeMaterialGroupList_t NodeMaterialGroupList_t*
m_sFileName content relative path to the external material group list string

NodeMaterialGroupList_t

A list of NodeMaterialGroup_t elements. Looks like this in the vmdl:

NodeMaterialGroupList_t NodeMaterialGroupList_t_0
{
	NodeMaterialGroup_t[] m_materialGroups = 
	[
		NodeMaterialGroup_t
		{
			string m_name = "default"
			string[] m_materialList = 
			[
				"models/sdk_character/materials/base.vmat",
                                "models/sdk_character/materials/hair.vmat"
			]
		},
		NodeMaterialGroup_t
		{
			string m_name = "hair_green"
			string[] m_materialList = 
			[
				"models/sdk_character/materials/base.vmat",
                                "models/sdk_character/materials/hair_green.vmat"
			]
		}
	]
}

NodeMaterialGroup_t

Attribute Friendly Name Description Type Default Value
m_name Name Name of the material group string
m_materialList Materials A list of material paths ( content relative ) associated with this group string[]
Note.pngNote:In the above example, switching to material group "hair_green" will keep the body material the same, but switch the hair to the green material.