UniVRM/Assets/VRM10/Runtime/TextureConvert/TextureConvertMaterial.cs
ousttrue d53942a7bd merge vrm10
* MeshUtility を UniGLTF 下に移動
* Assets/VRM10 を追加
* JsonSchemaからのコード生成 UniGLTF/Editor/Generator を追加
2021-01-07 13:37:24 +09:00

57 lines
1.8 KiB
C#

using UnityEngine;
namespace UniVRM10
{
public static class TextureConvertMaterial
{
#region Normalmap
// GLTF data to Unity texture
// ConvertToNormalValueFromRawColorWhenCompressionIsRequired
public static Material GetNormalMapConvertGltfToUnity()
{
return new Material(Shader.Find("UniVRM/NormalMapGltfToUnity"));
}
// Unity texture to GLTF data
// ConvertToRawColorWhenNormalValueIsCompressed
public static Material GetNormalMapConvertUnityToGltf()
{
return new Material(Shader.Find("UniVRM/NormalMapUnityToGltf"));
}
#endregion
#region MetallicRoughness
// GLTF data to Unity texture
public static Material GetMetallicRoughnessGltfToUnity(float roughnessFactor)
{
var material = new Material(Shader.Find("UniVRM/MetallicRoughnessGltfToUnity"));
material.SetFloat("_Roughness", roughnessFactor);
return material;
}
// Unity texture to GLTF data
public static Material GetMetallicRoughnessUnityToGltf(float smoothness)
{
var material = new Material(Shader.Find("UniVRM/MetallicRoughnessUnityToGltf"));
material.SetFloat("_Smoothness", smoothness);
return material;
}
#endregion
#region Occlusion
// GLTF data to Unity texture
public static Material GetOcclusionGltfToUnity()
{
return new Material(Shader.Find("UniVRM/OcclusionGltfToUnity"));
}
// Unity texture to GLTF data
public static Material GetOcclusionUnityToGltf()
{
return new Material(Shader.Find("UniVRM/OcclusionUnityToGltf"));
}
#endregion
}
}