mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-05-06 21:26:06 -05:00
* MeshUtility を UniGLTF 下に移動 * Assets/VRM10 を追加 * JsonSchemaからのコード生成 UniGLTF/Editor/Generator を追加
57 lines
1.8 KiB
C#
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
|
|
}
|
|
}
|