Material - ousttrue/UniGLTF GitHub Wiki
- https://github.com/ousttrue/UniGLTF/issues/12
- https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#reference-material
- https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Khronos/KHR_materials_unlit/README.md
✅ Color
| GLTF | Unity | |
|---|---|---|
/materials/*/pbrMetallicRoughness/baseColorFactor |
material.color |
shorthand of material.SetColor("_Color", color) |
/materials/*/pbrMetallicRoughness/baseColorTexture |
material.mainTexture |
shorthand of material.SetTexture("_MainTex", texture) |
Metallic Roughness & Occlusion
- Incompatible texture format
✅ Import
// gltf to unity
static Color32 ConvertMetallicRoughnessOcclusion(Color32 src)
{
return new Color32
{
r = src.b, // metallic
g = src.r, // occlusion
b = 0,
a = (byte)(255 - src.g), // smoothness
};
}
[ ] Export
NormalMap
✅ Import
✅ Export
- Unpack DXT5 Texture
Emission
✅ Import
[ ] Export
Alpha
| Unity RenderType Tag | glTFのmaterial.alphaModeプロパティ |
|---|---|
| Opaque | OPAQUE (デフォルトなので出力は不要) |
| Transparent | BLEND |
| TransparentCutout | MASK |
[ ] Import
✅ Export
[ ] DoubleSided=true
Require custom shader
[ ] VertexColor
Require custom shader