Materials

Materials only contain a name, the UV Map Index, and the list of Logic Graphs that represent this material. These logic graphs may in the future have an auto-conversion method to go between them. At the moment, they need to be separately created.

message Material {
MaterialReference MaterialReference = 1;
string Name = 2;
map<string, LogicGraphReference> LogicGraphReferences = 3;
int32 UVMapIndex = 4;
}

There are a number of ways you can interact with the material:

  • CreateModel & bundle the materail.
  • CRUD direct on material.
  • Updating the associated logic graphs, will also end up changing the material.

Updating Materials

The direct update materials command should only be used for modifying the name and other peripherals like active UV map. Updating the actual contents (ie. the Logic Graph) requires direct editing of the Logic Graph, (see updating a logic graph)

Unity Standard Shader

Unity's standard shader is basically lots of physically based rendering shaders rolled into one. This means you must enable or disable the keywords to use different parts of the shader.

KeywordUse
_NORMALMAPNormal mapping
_ALPHATEST_ON"Cut out" transparency
_ALPHABLEND_ON"Fade" transparency
_ALPHAPREMULTIPLY_ON"Transparent" transparency
_EMISSIONEmission colour or Emission mapping
_PARALLAXMAPHeight mapping
_DETAIL_MULX2Secondary "detail" maps
_METALLICGLOSSMAPMetallic/smoothness mapping
_SPECGLOSSMAPSpecular/smoothness mapping

Full list of properties on a Unity Standard Shader.

IndexProperty NameTypeMaps to
0_ColorColorNamed material property.
1_EmissionColorColorNamed material property.
2_EmissionColorUIColorNamed material property.
3_EmissionColorWithMapUIColorNamed material property.
4_SpecularColorNamed material property.
5_AlphaTestRefFloatNamed material property.
6_BumpScaleFloatNamed material property.
7_CutoffFloatNamed material property.
8_DetailNormalMapScaleFloatNamed material property.
9_DstBlendFloatNamed material property.
10_EmissionScaleUIFloatNamed material property.
11_GlossMapScaleFloatNamed material property.
12_GlossinessFloatNamed material property.
13_GlossyReflectionsFloatNamed material property.
14_LightmappingFloatNamed material property.
15_MetallicFloatNamed material property.
16_ModeFloatNamed material property.
17_OcclusionStrengthFloatNamed material property.
18_ParallaxFloatNamed material property.
19_SmoothnessTextureChannelFloatNamed material property.
20_SpecularHighlightsFloatNamed material property.
21_SrcBlendFloatNamed material property.
22_UVSecFloatNamed material property.
23_ZWriteFloatNamed material property.
24_BumpMapTexture Map (LinkOnly)Named material property.
25_DetailTexture Map (LinkOnly)Named material property.
26_DetailAlbedoMapTexture Map (LinkOnly)Named material property.
27_DetailMaskTexture Map (LinkOnly)Named material property.
28_DetailNormalMapTexture Map (LinkOnly)Named material property.
29_EmissionMapTexture Map (LinkOnly)Named material property.
30_MainTexTexture Map (LinkOnly)Named material property.
31_MetallicGlossMapTexture Map (LinkOnly)Named material property.
32_OcclusionTexture Map (LinkOnly)Named material property.
33_OcclusionMapTexture Map (LinkOnly)Named material property.
34_ParallaxMapTexture Map (LinkOnly)Named material property.
35RenderQueueQueue number (int)The render queue int directly.
36LightmapFlagsFlags (int)The LightmapFlags (which is an enum, needs casting).
37SpecularSetupBoolDoesn't map, just defines which of the shaders needs loading.
38_NORMALMAPShader Keywords (bool)Doesn't map, but if true, you need to enable that shader keyword.
39_ALPHATEST_ONShader Keywords (bool)Doesn't map, but if true, you need to enable that shader keyword.
40_ALPHABLEND_ONShader Keywords (bool)Doesn't map, but if true, you need to enable that shader keyword.
41_ALPHAPREMULTIPLY_ONShader Keywords (bool)Doesn't map, but if true, you need to enable that shader keyword.
42_EMISSIONShader Keywords (bool)Doesn't map, but if true, you need to enable that shader keyword.
43_PARALLAXMAPShader Keywords (bool)Doesn't map, but if true, you need to enable that shader keyword.
44_DETAIL_MULX2Shader Keywords (bool)Doesn't map, but if true, you need to enable that shader keyword.
45_METALLICGLOSSMAPShader Keywords (bool)Doesn't map, but if true, you need to enable that shader keyword.
46_SPECGLOSSMAPShader Keywords (bool)Doesn't map, but if true, you need to enable that shader keyword.

The keywords are listed on the Unity Materials Documentation. A great reference for how to organise these keywords based on Blend Mode can be found in this thread.