DEV Community

loading...

TIL Shader Keywords

Sunder Iyer
Gamer. Game Dev.
・1 min read

2021-02-01
A short month begins

So a few months ago, I basically verified for myself that the Godot Engine works on Chromebooks via Linux. There's also a fascinating tool called Material Maker which is built off of Godot and (you guessed it!) it too works on Chromebooks via Linux.
Chromebook Linux Terminal and Material Maker with a shader node graph
With this tool, it's possible to export Unity Materials. I took a peek at the exported files and the only thing that stood out was the .mat file. I opened it and it's a YAML file that describes the material and its properties.

%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
  serializedVersion: 6
  m_ObjectHideFlags: 0
  m_CorrespondingSourceObject: {fileID: 0}
  m_PrefabInstance: {fileID: 0}
  m_PrefabAsset: {fileID: 0}
  m_Name: test
  m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
  m_ShaderKeywords: _METALLICGLOSSMAP _NORMALMAP _PARALLAXMAP
  m_LightmapFlags: 4
Enter fullscreen mode Exit fullscreen mode

The Shader Keywords caught my eye.
Uber Shaders are a shading method I've seen on prior projects; this is where your project has one shader to rule them all but this shader has many "variants" that are generated based on the Shader Keywords. In Unity, the idea is that you can have many materials that use just one shader asset but can look different because of the shader variants.

Discussion (1)

Collapse
kirilllive profile image
Kirill Live

cool! I transferred materials from blender 3d to Unity in much the same way