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.
Keyword | Use |
---|---|
_NORMALMAP | Normal mapping |
_ALPHATEST_ON | "Cut out" transparency |
_ALPHABLEND_ON | "Fade" transparency |
_ALPHAPREMULTIPLY_ON | "Transparent" transparency |
_EMISSION | Emission colour or Emission mapping |
_PARALLAXMAP | Height mapping |
_DETAIL_MULX2 | Secondary "detail" maps |
_METALLICGLOSSMAP | Metallic/smoothness mapping |
_SPECGLOSSMAP | Specular/smoothness mapping |
Full list of properties on a Unity Standard Shader.
Index | Property Name | Type | Maps to |
---|---|---|---|
0 | _Color | Color | Named material property. |
1 | _EmissionColor | Color | Named material property. |
2 | _EmissionColorUI | Color | Named material property. |
3 | _EmissionColorWithMapUI | Color | Named material property. |
4 | _Specular | Color | Named material property. |
5 | _AlphaTestRef | Float | Named material property. |
6 | _BumpScale | Float | Named material property. |
7 | _Cutoff | Float | Named material property. |
8 | _DetailNormalMapScale | Float | Named material property. |
9 | _DstBlend | Float | Named material property. |
10 | _EmissionScaleUI | Float | Named material property. |
11 | _GlossMapScale | Float | Named material property. |
12 | _Glossiness | Float | Named material property. |
13 | _GlossyReflections | Float | Named material property. |
14 | _Lightmapping | Float | Named material property. |
15 | _Metallic | Float | Named material property. |
16 | _Mode | Float | Named material property. |
17 | _OcclusionStrength | Float | Named material property. |
18 | _Parallax | Float | Named material property. |
19 | _SmoothnessTextureChannel | Float | Named material property. |
20 | _SpecularHighlights | Float | Named material property. |
21 | _SrcBlend | Float | Named material property. |
22 | _UVSec | Float | Named material property. |
23 | _ZWrite | Float | Named material property. |
24 | _BumpMap | Texture Map (LinkOnly) | Named material property. |
25 | _Detail | Texture Map (LinkOnly) | Named material property. |
26 | _DetailAlbedoMap | Texture Map (LinkOnly) | Named material property. |
27 | _DetailMask | Texture Map (LinkOnly) | Named material property. |
28 | _DetailNormalMap | Texture Map (LinkOnly) | Named material property. |
29 | _EmissionMap | Texture Map (LinkOnly) | Named material property. |
30 | _MainTex | Texture Map (LinkOnly) | Named material property. |
31 | _MetallicGlossMap | Texture Map (LinkOnly) | Named material property. |
32 | _Occlusion | Texture Map (LinkOnly) | Named material property. |
33 | _OcclusionMap | Texture Map (LinkOnly) | Named material property. |
34 | _ParallaxMap | Texture Map (LinkOnly) | Named material property. |
35 | RenderQueue | Queue number (int) | The render queue int directly. |
36 | LightmapFlags | Flags (int) | The LightmapFlags (which is an enum, needs casting). |
37 | SpecularSetup | Bool | Doesn't map, just defines which of the shaders needs loading. |
38 | _NORMALMAP | Shader Keywords (bool) | Doesn't map, but if true, you need to enable that shader keyword. |
39 | _ALPHATEST_ON | Shader Keywords (bool) | Doesn't map, but if true, you need to enable that shader keyword. |
40 | _ALPHABLEND_ON | Shader Keywords (bool) | Doesn't map, but if true, you need to enable that shader keyword. |
41 | _ALPHAPREMULTIPLY_ON | Shader Keywords (bool) | Doesn't map, but if true, you need to enable that shader keyword. |
42 | _EMISSION | Shader Keywords (bool) | Doesn't map, but if true, you need to enable that shader keyword. |
43 | _PARALLAXMAP | Shader Keywords (bool) | Doesn't map, but if true, you need to enable that shader keyword. |
44 | _DETAIL_MULX2 | Shader Keywords (bool) | Doesn't map, but if true, you need to enable that shader keyword. |
45 | _METALLICGLOSSMAP | Shader Keywords (bool) | Doesn't map, but if true, you need to enable that shader keyword. |
46 | _SPECGLOSSMAP | Shader 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.