From 9e0bf553bfd64eaa4e4c63b9682a7b51fdc7e108 Mon Sep 17 00:00:00 2001 From: Andreas Atteneder Date: Thu, 18 Apr 2024 07:55:22 +0200 Subject: [PATCH 01/18] Post Release 6.4.0 --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 243e4e19..9f257ed7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] - + ## [6.4.0] - 2024-04-17 ### Added From 343361c21d50cedf7203be7b5ea48e9bd58c5990 Mon Sep 17 00:00:00 2001 From: Andreas Atteneder Date: Mon, 22 Apr 2024 14:58:59 +0200 Subject: [PATCH 02/18] feat: Batch jobs by default (#129) * feat: Using Unity Collections package (com.unity.collections) instead of deprecated Jobs package (com.unity.jobs). * refactor: Removed redundant code. Definitely using `IJobParallelForBatch` over `IJobParallelFor`, since it's been stable and available for a while now. In best cases it performs a lot faster (up to 60% with Unity 2020 LTS), in the worst case it's circa equal in performance. This will add com.unity.collections as dependency. * doc: Fixed cref link --- CHANGELOG.md | 11 + Documentation~/config.json | 2 +- Runtime/Scripts/GltfImport.cs | 2 +- Runtime/Scripts/Jobs.cs | 767 ++++++--------------- Runtime/Scripts/VertexBufferBones.cs | 26 +- Runtime/Scripts/VertexBufferColors.cs | 20 +- Runtime/Scripts/VertexBufferConfigBase.cs | 86 +-- Runtime/Scripts/VertexBufferTexCoords.cs | 46 +- Runtime/Scripts/glTFast.asmdef | 6 - Tests/Runtime/Scripts/JobTests.cs | 98 +-- Tests/Runtime/Scripts/glTFast.Tests.asmdef | 1 + package.json | 3 +- 12 files changed, 253 insertions(+), 815 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f257ed7..e6ed090a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] - +### Added +- Dependency on [Unity Collections package][Collections]. + +### Changed +- Faster buffer conversion jobs due to batching via [`IJobParallelForBatch`](https://docs.unity3d.com/Packages/com.unity.collections@2.4/api/Unity.Jobs.IJobParallelForBatch.html). + +### Removed +- Soft dependency on deprecated [Unity Jobs package][JobsPkg]. + ## [6.4.0] - 2024-04-17 ### Added @@ -1128,6 +1137,8 @@ This release contains multiple breaking changes. Please read the [upgrade guide] - initial version [Entities1.0]: https://docs.unity3d.com/Packages/com.unity.entities@1.0 +[Collections]: https://docs.unity3d.com/Packages/com.unity.collections@latest/ +[JobsPkg]: https://docs.unity3d.com/Packages/com.unity.jobs@latest/ [KtxUnity]: https://github.com/atteneder/KtxUnity [KtxForUnity]: https://docs.unity3d.com/Packages/com.unity.cloud.ktx@latest/ [DanDovi]: https://github.com/DanDovi diff --git a/Documentation~/config.json b/Documentation~/config.json index 8ade3da3..aefb35be 100644 --- a/Documentation~/config.json +++ b/Documentation~/config.json @@ -1,3 +1,3 @@ { - "DefineConstants": "DRACO_UNITY;KTX_UNITY;KTX_UNITY_1_3_OR_NEWER;KTX_UNITY_2_2_OR_NEWER;USING_URP;USING_HDRP;USING_HDRP_10_OR_NEWER;UNITY_PHYSICS;UNITY_IMAGECONVERSION;UNITY_WEBREQUEST_TEXTURE;UNITY_JOBS;MESHOPT;USING_URP_12_OR_NEWER;UNITY_SHADER_GRAPH_12_OR_NEWER;UNITY_ANIMATION;UNITY_ENTITIES_GRAPHICS;NEWTONSOFT_JSON" + "DefineConstants": "DRACO_UNITY;KTX_UNITY;KTX_UNITY_1_3_OR_NEWER;KTX_UNITY_2_2_OR_NEWER;USING_URP;USING_HDRP;USING_HDRP_10_OR_NEWER;UNITY_PHYSICS;UNITY_IMAGECONVERSION;UNITY_WEBREQUEST_TEXTURE;MESHOPT;USING_URP_12_OR_NEWER;UNITY_SHADER_GRAPH_12_OR_NEWER;UNITY_ANIMATION;UNITY_ENTITIES_GRAPHICS;NEWTONSOFT_JSON" } \ No newline at end of file diff --git a/Runtime/Scripts/GltfImport.cs b/Runtime/Scripts/GltfImport.cs index 50439b42..af2803fc 100644 --- a/Runtime/Scripts/GltfImport.cs +++ b/Runtime/Scripts/GltfImport.cs @@ -117,7 +117,7 @@ public abstract class GltfImportBase : IGltfReadable, IGltfBuffers, IDisposable /// /// Default value for a C# Job's innerloopBatchCount parameter. /// - /// + /// internal const int DefaultBatchCount = 512; /// diff --git a/Runtime/Scripts/Jobs.cs b/Runtime/Scripts/Jobs.cs index 35f328fe..6eb0854b 100644 --- a/Runtime/Scripts/Jobs.cs +++ b/Runtime/Scripts/Jobs.cs @@ -560,14 +560,8 @@ public void Execute(int i) // } [BurstCompile] - unsafe struct ConvertUVsUInt8ToFloatInterleavedJob : -#if UNITY_JOBS - IJobParallelForBatch -#else - IJobParallelFor -#endif + unsafe struct ConvertUVsUInt8ToFloatInterleavedJob : IJobParallelForBatch { - [ReadOnly] public int inputByteStride; @@ -582,25 +576,18 @@ unsafe struct ConvertUVsUInt8ToFloatInterleavedJob : [NativeDisableUnsafePtrRestriction] public float2* result; -#if UNITY_JOBS - public void Execute(int index, int count) { - var resultV = (float2*) ((byte*)result + index*outputByteStride); - var off = input + (index*inputByteStride); + public void Execute(int index, int count) + { + var resultV = (float2*)((byte*)result + index * outputByteStride); + var off = input + (index * inputByteStride); - for (var x = 0; x < count; x++) { + for (var x = 0; x < count; x++) + { *resultV = new float2(off[0], 1 - off[1]); resultV = (float2*)((byte*)resultV + outputByteStride); off += inputByteStride; } } -#else - public void Execute(int i) - { - var resultV = (float2*)(((byte*)result) + (i * outputByteStride)); - var off = input + inputByteStride * i; - *resultV = new float2(off[0], 1 - off[1]); - } -#endif } [BurstCompile] @@ -635,12 +622,7 @@ public void Execute(int i) } [BurstCompile] - unsafe struct ConvertUVsUInt16ToFloatInterleavedJob : -#if UNITY_JOBS - IJobParallelForBatch -#else - IJobParallelFor -#endif + unsafe struct ConvertUVsUInt16ToFloatInterleavedJob : IJobParallelForBatch { [ReadOnly] @@ -657,25 +639,18 @@ unsafe struct ConvertUVsUInt16ToFloatInterleavedJob : [NativeDisableUnsafePtrRestriction] public float2* result; -#if UNITY_JOBS - public void Execute(int i, int count) { - var resultV = (float2*) ((byte*)result + i*outputByteStride); - var uv = (ushort*) (input + i*inputByteStride); + public void Execute(int i, int count) + { + var resultV = (float2*)((byte*)result + i * outputByteStride); + var uv = (ushort*)(input + i * inputByteStride); - for (var x = 0; x < count; x++) { - *resultV = new float2 (uv[0], 1 - uv[1] ); + for (var x = 0; x < count; x++) + { + *resultV = new float2(uv[0], 1 - uv[1]); resultV = (float2*)((byte*)resultV + outputByteStride); uv = (ushort*)((byte*)uv + inputByteStride); } } -#else - public void Execute(int i) - { - var resultV = (float2*)(((byte*)result) + (i * outputByteStride)); - var uv = (ushort*)(input + inputByteStride * i); - *resultV = new float2(uv[0], 1 - uv[1]); - } -#endif } [BurstCompile] @@ -710,12 +685,7 @@ public void Execute(int i) } [BurstCompile] - unsafe struct ConvertUVsInt16ToFloatInterleavedJob : -#if UNITY_JOBS - IJobParallelForBatch -#else - IJobParallelFor -#endif + unsafe struct ConvertUVsInt16ToFloatInterleavedJob : IJobParallelForBatch { [ReadOnly] @@ -732,34 +702,22 @@ unsafe struct ConvertUVsInt16ToFloatInterleavedJob : [NativeDisableUnsafePtrRestriction] public float2* result; -#if UNITY_JOBS - public void Execute(int i, int count) { - var resultV = (float2*) ((byte*)result + i*outputByteStride); - var uv = (short*) ((byte*)input + i*inputByteStride); + public void Execute(int i, int count) + { + var resultV = (float2*)((byte*)result + i * outputByteStride); + var uv = (short*)((byte*)input + i * inputByteStride); - for (var x = 0; x < count; x++) { - *resultV = new float2(uv[0],1 - uv[1]); + for (var x = 0; x < count; x++) + { + *resultV = new float2(uv[0], 1 - uv[1]); resultV = (float2*)((byte*)resultV + outputByteStride); uv = (short*)((byte*)uv + inputByteStride); } } -#else - public void Execute(int i) - { - var resultV = (float2*)(((byte*)result) + (i * outputByteStride)); - var uv = (short*)((byte*)input + inputByteStride * i); - *resultV = new float2(uv[0], 1 - uv[1]); - } -#endif } [BurstCompile] - unsafe struct ConvertUVsInt16ToFloatInterleavedNormalizedJob : -#if UNITY_JOBS - IJobParallelForBatch -#else - IJobParallelFor -#endif + unsafe struct ConvertUVsInt16ToFloatInterleavedNormalizedJob : IJobParallelForBatch { [ReadOnly] @@ -776,12 +734,13 @@ unsafe struct ConvertUVsInt16ToFloatInterleavedNormalizedJob : [NativeDisableUnsafePtrRestriction] public float2* result; -#if UNITY_JOBS - public void Execute(int i, int count) { - var resultV = (float2*) ((byte*)result + i*outputByteStride); - var uv = (short*) ((byte*)input + i*inputByteStride); + public void Execute(int i, int count) + { + var resultV = (float2*)((byte*)result + i * outputByteStride); + var uv = (short*)((byte*)input + i * inputByteStride); - for (var x = 0; x < count; x++) { + for (var x = 0; x < count; x++) + { var tmp = new float2(uv[0], uv[1]) / short.MaxValue; var tmp2 = max(tmp, -1f); tmp2.y = 1 - tmp2.y; @@ -791,27 +750,10 @@ public void Execute(int i, int count) { uv = (short*)((byte*)uv + inputByteStride); } } -#else - public void Execute(int i) - { - var resultV = (float2*)(((byte*)result) + (i * outputByteStride)); - var uv = (short*)((byte*)input + inputByteStride * i); - - var tmp = new float2(uv[0], uv[1]) / short.MaxValue; - var tmp2 = max(tmp, -1f); - tmp2.y = 1 - tmp2.y; - *resultV = tmp2; - } -#endif } [BurstCompile] - unsafe struct ConvertUVsInt8ToFloatInterleavedJob : -#if UNITY_JOBS - IJobParallelForBatch -#else - IJobParallelFor -#endif + unsafe struct ConvertUVsInt8ToFloatInterleavedJob : IJobParallelForBatch { [ReadOnly] @@ -828,34 +770,22 @@ unsafe struct ConvertUVsInt8ToFloatInterleavedJob : [NativeDisableUnsafePtrRestriction] public float2* result; -#if UNITY_JOBS - public void Execute(int i, int count) { - var resultV = (float2*) ((byte*)result + i*outputByteStride); - var off = input + i*inputByteStride; + public void Execute(int i, int count) + { + var resultV = (float2*)((byte*)result + i * outputByteStride); + var off = input + i * inputByteStride; - for (var x = 0; x < count; x++) { - *resultV = new float2(off[0],1 - off[1]); + for (var x = 0; x < count; x++) + { + *resultV = new float2(off[0], 1 - off[1]); resultV = (float2*)((byte*)resultV + outputByteStride); off += inputByteStride; } } -#else - public void Execute(int i) - { - var resultV = (float2*)(((byte*)result) + (i * outputByteStride)); - var off = input + inputByteStride * i; - *resultV = new float2(off[0], 1 - off[1]); - } -#endif } [BurstCompile] - unsafe struct ConvertUVsInt8ToFloatInterleavedNormalizedJob : -#if UNITY_JOBS - IJobParallelForBatch -#else - IJobParallelFor -#endif + unsafe struct ConvertUVsInt8ToFloatInterleavedNormalizedJob : IJobParallelForBatch { [ReadOnly] @@ -872,32 +802,22 @@ unsafe struct ConvertUVsInt8ToFloatInterleavedNormalizedJob : [NativeDisableUnsafePtrRestriction] public float2* result; -#if UNITY_JOBS - public void Execute(int i, int count) { - var resultV = (float2*) ((byte*)result + i*outputByteStride); - var off = input + i*inputByteStride; + public void Execute(int i, int count) + { + var resultV = (float2*)((byte*)result + i * outputByteStride); + var off = input + i * inputByteStride; - for (var x = 0; x < count; x++) { - var tmp = new float2(off[0],off[1]) / 127f; + for (var x = 0; x < count; x++) + { + var tmp = new float2(off[0], off[1]) / 127f; var tmp2 = max(tmp, -1f); - tmp2.y = 1-tmp2.y; + tmp2.y = 1 - tmp2.y; *resultV = tmp2; resultV = (float2*)((byte*)resultV + outputByteStride); off += inputByteStride; } } -#else - public void Execute(int i) - { - var resultV = (float2*)(((byte*)result) + (i * outputByteStride)); - var off = input + inputByteStride * i; - var tmp = new float2(off[0], off[1]) / 127f; - var tmp2 = max(tmp, -1f); - tmp2.y = 1 - tmp2.y; - *resultV = tmp2; - } -#endif } [BurstCompile] @@ -971,12 +891,7 @@ public void Execute(int i) } [BurstCompile] - unsafe struct ConvertColorsRgbaUInt16ToRGBAFloatJob : -#if UNITY_JOBS - IJobParallelForBatch -#else - IJobParallelFor -#endif + unsafe struct ConvertColorsRgbaUInt16ToRGBAFloatJob : IJobParallelForBatch { [ReadOnly] @@ -990,12 +905,13 @@ unsafe struct ConvertColorsRgbaUInt16ToRGBAFloatJob : [NativeDisableUnsafePtrRestriction] public float4* result; -#if UNITY_JOBS - public void Execute(int i, int count) { - var src = (ushort*)((byte*)input + i*inputByteStride); + public void Execute(int i, int count) + { + var src = (ushort*)((byte*)input + i * inputByteStride); var endIndex = i + count; - for (var x = i; x < endIndex; x++) { - result[x] = new float4 ( + for (var x = i; x < endIndex; x++) + { + result[x] = new float4( src[0] / (float)ushort.MaxValue, src[1] / (float)ushort.MaxValue, src[2] / (float)ushort.MaxValue, @@ -1004,27 +920,10 @@ public void Execute(int i, int count) { src = (ushort*)((byte*)src + inputByteStride); } } -#else - public void Execute(int i) - { - ushort* src = (ushort*)(((byte*)input) + (i * inputByteStride)); - result[i] = new float4( - src[0] / (float)ushort.MaxValue, - src[1] / (float)ushort.MaxValue, - src[2] / (float)ushort.MaxValue, - src[3] / (float)ushort.MaxValue - ); - } -#endif } [BurstCompile] - unsafe struct ConvertColorsRGBAFloatToRGBAFloatJob : -#if UNITY_JOBS - IJobParallelForBatch -#else - IJobParallelFor -#endif + unsafe struct ConvertColorsRGBAFloatToRGBAFloatJob : IJobParallelForBatch { [ReadOnly] @@ -1038,22 +937,16 @@ unsafe struct ConvertColorsRGBAFloatToRGBAFloatJob : [NativeDisableUnsafePtrRestriction] public float4* result; -#if UNITY_JOBS - public void Execute(int i, int count) { - var src = (float4*)(input + i*inputByteStride); + public void Execute(int i, int count) + { + var src = (float4*)(input + i * inputByteStride); var endIndex = i + count; - for (var x = i; x < endIndex; x++) { + for (var x = i; x < endIndex; x++) + { result[x] = *src; src = (float4*)((byte*)src + inputByteStride); } } -#else - public void Execute(int i) - { - var src = (float4*)(input + (i * inputByteStride)); - result[i] = *src; - } -#endif } [BurstCompile] @@ -1193,12 +1086,7 @@ public void Execute(int i) } [BurstCompile] - unsafe struct ConvertUVsFloatToFloatInterleavedJob : -#if UNITY_JOBS - IJobParallelForBatch -#else - IJobParallelFor -#endif + unsafe struct ConvertUVsFloatToFloatInterleavedJob : IJobParallelForBatch { [ReadOnly] @@ -1215,42 +1103,28 @@ unsafe struct ConvertUVsFloatToFloatInterleavedJob : [NativeDisableUnsafePtrRestriction] public float2* result; -#if UNITY_JOBS - public void Execute(int i, int count) { - var resultV = (float2*) ((byte*)result + i*outputByteStride); - var off = (float2*) (input + i*inputByteStride); + public void Execute(int i, int count) + { + var resultV = (float2*)((byte*)result + i * outputByteStride); + var off = (float2*)(input + i * inputByteStride); - for (var x = 0; x < count; x++) { + for (var x = 0; x < count; x++) + { var tmp = *off; - tmp.y = 1-tmp.y; + tmp.y = 1 - tmp.y; *resultV = tmp; resultV = (float2*)((byte*)resultV + outputByteStride); off = (float2*)((byte*)off + inputByteStride); } } -#else - public void Execute(int i) - { - var resultV = (float2*)(((byte*)result) + (i * outputByteStride)); - var off = (float2*)(input + (i * inputByteStride)); - var tmp = *off; - tmp.y = 1 - tmp.y; - *resultV = tmp; - } -#endif } /// /// General purpose vector 3 (position or normal) conversion /// [BurstCompile] - unsafe struct ConvertVector3FloatToFloatInterleavedJob : -#if UNITY_JOBS - IJobParallelForBatch -#else - IJobParallelFor -#endif + unsafe struct ConvertVector3FloatToFloatInterleavedJob : IJobParallelForBatch { [ReadOnly] @@ -1267,12 +1141,13 @@ unsafe struct ConvertVector3FloatToFloatInterleavedJob : [NativeDisableUnsafePtrRestriction] public float3* result; -#if UNITY_JOBS - public void Execute(int i, int count) { - var resultV = (float3*) ((byte*)result + i*outputByteStride); - var off = (float3*) (input + i*inputByteStride); + public void Execute(int i, int count) + { + var resultV = (float3*)((byte*)result + i * outputByteStride); + var off = (float3*)(input + i * inputByteStride); - for (var x = 0; x < count; x++) { + for (var x = 0; x < count; x++) + { var tmp = *off; tmp.x *= -1; *resultV = tmp; @@ -1281,16 +1156,6 @@ public void Execute(int i, int count) { off = (float3*)((byte*)off + inputByteStride); } } -#else - public void Execute(int i) - { - var resultV = (float3*)(((byte*)result) + (i * outputByteStride)); - var off = (float3*)(input + i * inputByteStride); - var tmp = *off; - tmp.x *= -1; - *resultV = tmp; - } -#endif } /// @@ -1331,12 +1196,7 @@ public void Execute(int i) } [BurstCompile] - unsafe struct ConvertTangentsFloatToFloatInterleavedJob : -#if UNITY_JOBS - IJobParallelForBatch -#else - IJobParallelFor -#endif + unsafe struct ConvertTangentsFloatToFloatInterleavedJob : IJobParallelForBatch { [ReadOnly] @@ -1353,12 +1213,13 @@ unsafe struct ConvertTangentsFloatToFloatInterleavedJob : [NativeDisableUnsafePtrRestriction] public float4* result; -#if UNITY_JOBS - public void Execute(int i, int count) { - var resultV = (float4*) ((byte*)result + i*outputByteStride); - var off = (float4*) (input + i*inputByteStride); + public void Execute(int i, int count) + { + var resultV = (float4*)((byte*)result + i * outputByteStride); + var off = (float4*)(input + i * inputByteStride); - for (var x = 0; x < count; x++) { + for (var x = 0; x < count; x++) + { var tmp = *off; tmp.z *= -1; *resultV = tmp; @@ -1367,25 +1228,10 @@ public void Execute(int i, int count) { off = (float4*)((byte*)off + inputByteStride); } } -#else - public void Execute(int i) - { - float4* resultV = (float4*)(((byte*)result) + (i * outputByteStride)); - byte* off = input + (i * inputByteStride); - var tmp = *((float4*)off); - tmp.z *= -1; - *resultV = tmp; - } -#endif } [BurstCompile] - unsafe struct ConvertBoneWeightsFloatToFloatInterleavedJob : -#if UNITY_JOBS - IJobParallelForBatch -#else - IJobParallelFor -#endif + unsafe struct ConvertBoneWeightsFloatToFloatInterleavedJob : IJobParallelForBatch { [ReadOnly] @@ -1402,34 +1248,22 @@ unsafe struct ConvertBoneWeightsFloatToFloatInterleavedJob : [NativeDisableUnsafePtrRestriction] public float4* result; -#if UNITY_JOBS - public void Execute(int i, int count) { - var resultV = (float4*) ((byte*)result + i*outputByteStride); - var off = (float4*) (input + i*inputByteStride); + public void Execute(int i, int count) + { + var resultV = (float4*)((byte*)result + i * outputByteStride); + var off = (float4*)(input + i * inputByteStride); - for (var x = 0; x < count; x++) { + for (var x = 0; x < count; x++) + { *resultV = *off; resultV = (float4*)((byte*)resultV + outputByteStride); off = (float4*)((byte*)off + inputByteStride); } } -#else - public void Execute(int i) - { - var resultV = (float4*)(((byte*)result) + (i * outputByteStride)); - var off = input + (i * inputByteStride); - *resultV = *((float4*)off); - } -#endif } [BurstCompile] - unsafe struct ConvertBoneWeightsUInt8ToFloatInterleavedJob : -#if UNITY_JOBS - IJobParallelForBatch -#else - IJobParallelFor -#endif + unsafe struct ConvertBoneWeightsUInt8ToFloatInterleavedJob : IJobParallelForBatch { [ReadOnly] @@ -1446,12 +1280,13 @@ unsafe struct ConvertBoneWeightsUInt8ToFloatInterleavedJob : [NativeDisableUnsafePtrRestriction] public float4* result; -#if UNITY_JOBS - public void Execute(int i, int count) { - var resultV = (float4*) ((byte*)result + i*outputByteStride); - var off = input + i*inputByteStride; + public void Execute(int i, int count) + { + var resultV = (float4*)((byte*)result + i * outputByteStride); + var off = input + i * inputByteStride; - for (var x = 0; x < count; x++) { + for (var x = 0; x < count; x++) + { *resultV = new float4( off[0] / 255f, off[1] / 255f, @@ -1462,28 +1297,10 @@ public void Execute(int i, int count) { off += inputByteStride; } } -#else - public void Execute(int i) - { - var resultV = (float4*)(((byte*)result) + (i * outputByteStride)); - var off = input + (i * inputByteStride); - *resultV = new float4( - off[0] / 255f, - off[1] / 255f, - off[2] / 255f, - off[3] / 255f - ); - } -#endif } [BurstCompile] - unsafe struct ConvertBoneWeightsUInt16ToFloatInterleavedJob : -#if UNITY_JOBS - IJobParallelForBatch -#else - IJobParallelFor -#endif + unsafe struct ConvertBoneWeightsUInt16ToFloatInterleavedJob : IJobParallelForBatch { [ReadOnly] @@ -1500,44 +1317,27 @@ unsafe struct ConvertBoneWeightsUInt16ToFloatInterleavedJob : [NativeDisableUnsafePtrRestriction] public float4* result; -#if UNITY_JOBS - public void Execute(int i, int count) { - var resultV = (float4*) ((byte*)result + i*outputByteStride); - var off = (ushort*) (input + i*inputByteStride); + public void Execute(int i, int count) + { + var resultV = (float4*)((byte*)result + i * outputByteStride); + var off = (ushort*)(input + i * inputByteStride); - for (var x = 0; x < count; x++) { + for (var x = 0; x < count; x++) + { *resultV = new float4( - off[0] / (float) ushort.MaxValue, - off[1] / (float) ushort.MaxValue, - off[2] / (float) ushort.MaxValue, - off[3] / (float) ushort.MaxValue + off[0] / (float)ushort.MaxValue, + off[1] / (float)ushort.MaxValue, + off[2] / (float)ushort.MaxValue, + off[3] / (float)ushort.MaxValue ); resultV = (float4*)((byte*)resultV + outputByteStride); - off = (ushort*) ((byte*)off + inputByteStride); + off = (ushort*)((byte*)off + inputByteStride); } } -#else - public void Execute(int i) - { - var resultV = (float4*)(((byte*)result) + (i * outputByteStride)); - var off = (ushort*)(input + i * inputByteStride); - *resultV = new float4( - off[0] / (float)ushort.MaxValue, - off[1] / (float)ushort.MaxValue, - off[2] / (float)ushort.MaxValue, - off[3] / (float)ushort.MaxValue - ); - } -#endif } [BurstCompile] - unsafe struct ConvertTangentsInt16ToFloatInterleavedNormalizedJob : -#if UNITY_JOBS - IJobParallelForBatch -#else - IJobParallelFor -#endif + unsafe struct ConvertTangentsInt16ToFloatInterleavedNormalizedJob : IJobParallelForBatch { [ReadOnly] @@ -1554,13 +1354,14 @@ unsafe struct ConvertTangentsInt16ToFloatInterleavedNormalizedJob : [NativeDisableUnsafePtrRestriction] public float4* result; -#if UNITY_JOBS - public void Execute(int i, int count) { - var resultV = (float4*) ((byte*)result + i*outputByteStride); - var off = (short*) ((byte*)input + i*inputByteStride); + public void Execute(int i, int count) + { + var resultV = (float4*)((byte*)result + i * outputByteStride); + var off = (short*)((byte*)input + i * inputByteStride); - for (var x = 0; x < count; x++) { - var tmp = new float4(off[0],off[1],off[2],off[3]) / short.MaxValue; + for (var x = 0; x < count; x++) + { + var tmp = new float4(off[0], off[1], off[2], off[3]) / short.MaxValue; var tmp2 = max(tmp, -1f); tmp2.z *= -1; *resultV = normalize(tmp2); @@ -1569,26 +1370,10 @@ public void Execute(int i, int count) { off = (short*)((byte*)off + inputByteStride); } } -#else - public void Execute(int i) - { - var resultV = (float4*)(((byte*)result) + (i * outputByteStride)); - var off = (short*)(((byte*)input) + (i * inputByteStride)); - var tmp = new float4(off[0], off[1], off[2], off[3]) / short.MaxValue; - var tmp2 = max(tmp, -1f); - tmp2.z *= -1; - *resultV = normalize(tmp2); - } -#endif } [BurstCompile] - unsafe struct ConvertTangentsInt8ToFloatInterleavedNormalizedJob : -#if UNITY_JOBS - IJobParallelForBatch -#else - IJobParallelFor -#endif + unsafe struct ConvertTangentsInt8ToFloatInterleavedNormalizedJob : IJobParallelForBatch { [ReadOnly] @@ -1605,13 +1390,14 @@ unsafe struct ConvertTangentsInt8ToFloatInterleavedNormalizedJob : [NativeDisableUnsafePtrRestriction] public float4* result; -#if UNITY_JOBS - public void Execute(int i, int count) { - var resultV = (float4*) ((byte*)result + i*outputByteStride); - var off = input + i*inputByteStride; + public void Execute(int i, int count) + { + var resultV = (float4*)((byte*)result + i * outputByteStride); + var off = input + i * inputByteStride; - for (var x = 0; x < count; x++) { - var tmp = new float4(off[0],off[1],off[2],off[3]) / 127f; + for (var x = 0; x < count; x++) + { + var tmp = new float4(off[0], off[1], off[2], off[3]) / 127f; var tmp2 = max(tmp, -1f); tmp2.z *= -1; *resultV = normalize(tmp2); @@ -1620,26 +1406,10 @@ public void Execute(int i, int count) { off += inputByteStride; } } -#else - public void Execute(int i) - { - var resultV = (float4*)(((byte*)result) + (i * outputByteStride)); - var off = input + (i * inputByteStride); - var tmp = new float4(off[0], off[1], off[2], off[3]) / 127f; - var tmp2 = max(tmp, -1f); - tmp2.z *= -1; - *resultV = normalize(tmp2); - } -#endif } [BurstCompile] - unsafe struct ConvertPositionsUInt16ToFloatInterleavedJob : -#if UNITY_JOBS - IJobParallelForBatch -#else - IJobParallelFor -#endif + unsafe struct ConvertPositionsUInt16ToFloatInterleavedJob : IJobParallelForBatch { [ReadOnly] @@ -1656,34 +1426,22 @@ unsafe struct ConvertPositionsUInt16ToFloatInterleavedJob : [NativeDisableUnsafePtrRestriction] public float3* result; -#if UNITY_JOBS - public void Execute(int i, int count) { - var resultV = (float3*) ((byte*)result + i*outputByteStride); - var off = (ushort*) (input + i*inputByteStride); + public void Execute(int i, int count) + { + var resultV = (float3*)((byte*)result + i * outputByteStride); + var off = (ushort*)(input + i * inputByteStride); - for (var x = 0; x < count; x++) { + for (var x = 0; x < count; x++) + { *resultV = new float3(-(float)off[0], off[1], off[2]); resultV = (float3*)((byte*)resultV + outputByteStride); off = (ushort*)((byte*)off + inputByteStride); } } -#else - public void Execute(int i) - { - var resultV = (float3*)(((byte*)result) + (i * outputByteStride)); - var off = (ushort*)(input + (inputByteStride * i)); - *resultV = new float3(-(float)off[0], off[1], off[2]); - } -#endif } [BurstCompile] - unsafe struct ConvertPositionsUInt16ToFloatInterleavedNormalizedJob : -#if UNITY_JOBS - IJobParallelForBatch -#else - IJobParallelFor -#endif + unsafe struct ConvertPositionsUInt16ToFloatInterleavedNormalizedJob : IJobParallelForBatch { [ReadOnly] public int inputByteStride; @@ -1699,43 +1457,27 @@ unsafe struct ConvertPositionsUInt16ToFloatInterleavedNormalizedJob : [NativeDisableUnsafePtrRestriction] public float3* result; -#if UNITY_JOBS - public void Execute(int i, int count) { - var resultV = (float3*) ((byte*)result + i*outputByteStride); - var off = (ushort*) (input + i*inputByteStride); + public void Execute(int i, int count) + { + var resultV = (float3*)((byte*)result + i * outputByteStride); + var off = (ushort*)(input + i * inputByteStride); - for (var x = 0; x < count; x++) { + for (var x = 0; x < count; x++) + { var tmp = new float3( - -(off[0] / (float) ushort.MaxValue), - off[1] / (float) ushort.MaxValue, - off[2] / (float) ushort.MaxValue + -(off[0] / (float)ushort.MaxValue), + off[1] / (float)ushort.MaxValue, + off[2] / (float)ushort.MaxValue ); *resultV = tmp; resultV = (float3*)((byte*)resultV + outputByteStride); off = (ushort*)((byte*)off + inputByteStride); } } -#else - public void Execute(int i) - { - var resultV = (float3*)(((byte*)result) + (i * outputByteStride)); - var off = (ushort*)(input + (inputByteStride * i)); - *resultV = new float3( - -(off[0] / (float)ushort.MaxValue), - off[1] / (float)ushort.MaxValue, - off[2] / (float)ushort.MaxValue - ); - } -#endif } [BurstCompile] - unsafe struct ConvertPositionsInt16ToFloatInterleavedJob : -#if UNITY_JOBS - IJobParallelForBatch -#else - IJobParallelFor -#endif + unsafe struct ConvertPositionsInt16ToFloatInterleavedJob : IJobParallelForBatch { [ReadOnly] @@ -1753,25 +1495,18 @@ unsafe struct ConvertPositionsInt16ToFloatInterleavedJob : [ReadOnly] public int outputByteStride; -#if UNITY_JOBS - public void Execute(int i, int count) { - var resultV = (float3*) ((byte*)result + i*outputByteStride); - var off = (short*) (input + i*inputByteStride); + public void Execute(int i, int count) + { + var resultV = (float3*)((byte*)result + i * outputByteStride); + var off = (short*)(input + i * inputByteStride); - for (var x = 0; x < count; x++) { - *resultV = new float3(-off[0],off[1],off[2]); + for (var x = 0; x < count; x++) + { + *resultV = new float3(-off[0], off[1], off[2]); resultV = (float3*)((byte*)resultV + outputByteStride); off = (short*)((byte*)off + inputByteStride); } } -#else - public void Execute(int i) - { - var resultV = (float3*)(((byte*)result) + (i * outputByteStride)); - var off = (short*)(input + (i * inputByteStride)); - *resultV = new float3(-(float)off[0], off[1], off[2]); - } -#endif } /// @@ -1779,12 +1514,7 @@ public void Execute(int i) /// Result is not normalized (scaled to unit length) /// [BurstCompile] - unsafe struct ConvertVector3Int16ToFloatInterleavedNormalizedJob : -#if UNITY_JOBS - IJobParallelForBatch -#else - IJobParallelFor -#endif + unsafe struct ConvertVector3Int16ToFloatInterleavedNormalizedJob : IJobParallelForBatch { [ReadOnly] @@ -1801,12 +1531,13 @@ unsafe struct ConvertVector3Int16ToFloatInterleavedNormalizedJob : [NativeDisableUnsafePtrRestriction] public float3* result; -#if UNITY_JOBS - public void Execute(int i, int count) { - var resultV = (float3*) ((byte*)result + i*outputByteStride); - var off = (short*) (input + i*inputByteStride); + public void Execute(int i, int count) + { + var resultV = (float3*)((byte*)result + i * outputByteStride); + var off = (short*)(input + i * inputByteStride); - for (var x = 0; x < count; x++) { + for (var x = 0; x < count; x++) + { var tmp = new float3(off[0], off[1], off[2]) / short.MaxValue; var tmp2 = max(tmp, -1f); tmp2.x *= -1; @@ -1816,18 +1547,6 @@ public void Execute(int i, int count) { off = (short*)((byte*)off + inputByteStride); } } -#else - public void Execute(int i) - { - var resultV = (float3*)(((byte*)result) + (i * outputByteStride)); - var off = (short*)(input + (i * inputByteStride)); - - var tmp = new float3(off[0], off[1], off[2]) / short.MaxValue; - var tmp2 = max(tmp, -1f); - tmp2.x *= -1; - *resultV = tmp2; - } -#endif } /// @@ -1835,12 +1554,7 @@ public void Execute(int i) /// Result is normalized (scaled to unit length) /// [BurstCompile] - unsafe struct ConvertNormalsInt16ToFloatInterleavedNormalizedJob : -#if UNITY_JOBS - IJobParallelForBatch -#else - IJobParallelFor -#endif + unsafe struct ConvertNormalsInt16ToFloatInterleavedNormalizedJob : IJobParallelForBatch { [ReadOnly] @@ -1857,12 +1571,13 @@ unsafe struct ConvertNormalsInt16ToFloatInterleavedNormalizedJob : [NativeDisableUnsafePtrRestriction] public float3* result; -#if UNITY_JOBS - public void Execute(int i, int count) { - var resultV = (float3*) ((byte*)result + i*outputByteStride); - var off = (short*) (input + i*inputByteStride); + public void Execute(int i, int count) + { + var resultV = (float3*)((byte*)result + i * outputByteStride); + var off = (short*)(input + i * inputByteStride); - for (var x = 0; x < count; x++) { + for (var x = 0; x < count; x++) + { var tmp = new float3(off[0], off[1], off[2]) / short.MaxValue; var tmp2 = max(tmp, -1f); tmp2.x *= -1; @@ -1872,27 +1587,10 @@ public void Execute(int i, int count) { off = (short*)((byte*)off + inputByteStride); } } -#else - public void Execute(int i) - { - var resultV = (float3*)(((byte*)result) + (i * outputByteStride)); - var off = (short*)(input + (i * inputByteStride)); - - var tmp = new float3(off[0], off[1], off[2]) / short.MaxValue; - var tmp2 = max(tmp, -1f); - tmp2.x *= -1; - *resultV = normalize(tmp2); - } -#endif } [BurstCompile] - unsafe struct ConvertPositionsInt8ToFloatInterleavedJob : -#if UNITY_JOBS - IJobParallelForBatch -#else - IJobParallelFor -#endif + unsafe struct ConvertPositionsInt8ToFloatInterleavedJob : IJobParallelForBatch { [ReadOnly] @@ -1909,25 +1607,18 @@ unsafe struct ConvertPositionsInt8ToFloatInterleavedJob : [NativeDisableUnsafePtrRestriction] public float3* result; -#if UNITY_JOBS - public void Execute(int i, int count) { - var resultV = (float3*) ((byte*)result + i*outputByteStride); - var off = input + i*inputByteStride; + public void Execute(int i, int count) + { + var resultV = (float3*)((byte*)result + i * outputByteStride); + var off = input + i * inputByteStride; - for (var x = 0; x < count; x++) { + for (var x = 0; x < count; x++) + { *resultV = new float3(-off[0], off[1], off[2]); resultV = (float3*)((byte*)resultV + outputByteStride); off += inputByteStride; } } -#else - public void Execute(int i) - { - var resultV = (float3*)(((byte*)result) + (i * outputByteStride)); - var off = input + (inputByteStride * i); - *resultV = new float3(-(float)off[0], off[1], off[2]); - } -#endif } /// @@ -1935,12 +1626,7 @@ public void Execute(int i) /// Result is not normalized (scaled to unit length) /// [BurstCompile] - unsafe struct ConvertVector3Int8ToFloatInterleavedNormalizedJob : -#if UNITY_JOBS - IJobParallelForBatch -#else - IJobParallelFor -#endif + unsafe struct ConvertVector3Int8ToFloatInterleavedNormalizedJob : IJobParallelForBatch { [ReadOnly] @@ -1957,12 +1643,13 @@ unsafe struct ConvertVector3Int8ToFloatInterleavedNormalizedJob : [NativeDisableUnsafePtrRestriction] public float3* result; -#if UNITY_JOBS - public void Execute(int i, int count) { - var resultV = (float3*) ((byte*)result + i*outputByteStride); - var off = input + i*inputByteStride; + public void Execute(int i, int count) + { + var resultV = (float3*)((byte*)result + i * outputByteStride); + var off = input + i * inputByteStride; - for (var x = 0; x < count; x++) { + for (var x = 0; x < count; x++) + { var tmp = new float3(off[0], off[1], off[2]) / 127f; var tmp2 = max(tmp, -1); tmp2.x *= -1; @@ -1972,18 +1659,6 @@ public void Execute(int i, int count) { off += inputByteStride; } } -#else - public void Execute(int i) - { - var resultV = (float3*)(((byte*)result) + (i * outputByteStride)); - var off = input + (inputByteStride * i); - - var tmp = new float3(off[0], off[1], off[2]) / 127f; - var tmp2 = max(tmp, -1); - tmp2.x *= -1; - *resultV = tmp2; - } -#endif } /// @@ -1991,12 +1666,7 @@ public void Execute(int i) /// Result is normalized (scaled to unit length) /// [BurstCompile] - unsafe struct ConvertNormalsInt8ToFloatInterleavedNormalizedJob : -#if UNITY_JOBS - IJobParallelForBatch -#else - IJobParallelFor -#endif + unsafe struct ConvertNormalsInt8ToFloatInterleavedNormalizedJob : IJobParallelForBatch { [ReadOnly] @@ -2013,12 +1683,13 @@ unsafe struct ConvertNormalsInt8ToFloatInterleavedNormalizedJob : [NativeDisableUnsafePtrRestriction] public float3* result; -#if UNITY_JOBS - public void Execute(int i, int count) { - var resultV = (float3*) ((byte*)result + i*outputByteStride); - var off = input + i*inputByteStride; + public void Execute(int i, int count) + { + var resultV = (float3*)((byte*)result + i * outputByteStride); + var off = input + i * inputByteStride; - for (var x = 0; x < count; x++) { + for (var x = 0; x < count; x++) + { var tmp = new float3(off[0], off[1], off[2]) / 127f; var tmp2 = max(tmp, -1); tmp2.x *= -1; @@ -2028,27 +1699,10 @@ public void Execute(int i, int count) { off += inputByteStride; } } -#else - public void Execute(int i) - { - var resultV = (float3*)(((byte*)result) + (i * outputByteStride)); - var off = input + (inputByteStride * i); - - var tmp = new float3(off[0], off[1], off[2]) / 127f; - var tmp2 = max(tmp, -1); - tmp2.x *= -1; - *resultV = normalize(tmp2); - } -#endif } [BurstCompile] - unsafe struct ConvertPositionsUInt8ToFloatInterleavedJob : -#if UNITY_JOBS - IJobParallelForBatch -#else - IJobParallelFor -#endif + unsafe struct ConvertPositionsUInt8ToFloatInterleavedJob : IJobParallelForBatch { [ReadOnly] @@ -2065,34 +1719,22 @@ unsafe struct ConvertPositionsUInt8ToFloatInterleavedJob : [NativeDisableUnsafePtrRestriction] public float3* result; -#if UNITY_JOBS - public void Execute(int i, int count) { - var resultV = (float3*) ((byte*)result + i*outputByteStride); - var off = input + i*inputByteStride; + public void Execute(int i, int count) + { + var resultV = (float3*)((byte*)result + i * outputByteStride); + var off = input + i * inputByteStride; - for (var x = 0; x < count; x++) { - *resultV = new float3(-(float)off[0],off[1],off[2]); + for (var x = 0; x < count; x++) + { + *resultV = new float3(-(float)off[0], off[1], off[2]); resultV = (float3*)((byte*)resultV + outputByteStride); off += inputByteStride; } } -#else - public void Execute(int i) - { - var off = input + (i * inputByteStride); - var resultV = (float3*)(((byte*)result) + (i * outputByteStride)); - *resultV = new float3(-(float)off[0], off[1], off[2]); - } -#endif } [BurstCompile] - unsafe struct ConvertPositionsUInt8ToFloatInterleavedNormalizedJob : -#if UNITY_JOBS - IJobParallelForBatch -#else - IJobParallelFor -#endif + unsafe struct ConvertPositionsUInt8ToFloatInterleavedNormalizedJob : IJobParallelForBatch { [ReadOnly] @@ -2109,12 +1751,13 @@ unsafe struct ConvertPositionsUInt8ToFloatInterleavedNormalizedJob : [NativeDisableUnsafePtrRestriction] public float3* result; -#if UNITY_JOBS - public void Execute(int i, int count) { - var resultV = (float3*) ((byte*)result + i*outputByteStride); - var off = input + i*inputByteStride; + public void Execute(int i, int count) + { + var resultV = (float3*)((byte*)result + i * outputByteStride); + var off = input + i * inputByteStride; - for (var x = 0; x < count; x++) { + for (var x = 0; x < count; x++) + { *resultV = new float3( -(off[0] / 255f), off[1] / 255f, @@ -2124,18 +1767,6 @@ public void Execute(int i, int count) { off += inputByteStride; } } -#else - public void Execute(int i) - { - var resultV = (float3*)(((byte*)result) + (i * outputByteStride)); - var off = input + (i * inputByteStride); - *resultV = new float3( - -(off[0] / 255f), - off[1] / 255f, - off[2] / 255f - ); - } -#endif } [BurstCompile] diff --git a/Runtime/Scripts/VertexBufferBones.cs b/Runtime/Scripts/VertexBufferBones.cs index 8c24566b..604518f8 100644 --- a/Runtime/Scripts/VertexBufferBones.cs +++ b/Runtime/Scripts/VertexBufferBones.cs @@ -130,7 +130,7 @@ int jointsAccessorIndex bones = m_Data, skinWeights = math.max(1, skinWeights) }; - jobHandle = job.Schedule(m_Data.Length, GltfImport.DefaultBatchCount, jobHandle); + jobHandle = job.Schedule(m_Data.Length, GltfImportBase.DefaultBatchCount, jobHandle); } #if GLTFAST_SAFE else { @@ -138,7 +138,7 @@ int jointsAccessorIndex var job = new RenormalizeBoneWeightsJob { bones = m_Data, }; - jobHandle = job.Schedule(m_Data.Length, GltfImport.DefaultBatchCount, jobHandle); + jobHandle = job.Schedule(m_Data.Length, GltfImportBase.DefaultBatchCount, jobHandle); } #endif @@ -186,11 +186,7 @@ int outputByteStride jobTangentI.input = (byte*)input; jobTangentI.outputByteStride = outputByteStride; jobTangentI.result = output; -#if UNITY_JOBS - jobHandle = jobTangentI.ScheduleBatch(count,GltfImport.DefaultBatchCount); -#else - jobHandle = jobTangentI.Schedule(count, GltfImport.DefaultBatchCount); -#endif + jobHandle = jobTangentI.ScheduleBatch(count, GltfImportBase.DefaultBatchCount); break; case GltfComponentType.UnsignedShort: { @@ -201,11 +197,7 @@ int outputByteStride outputByteStride = outputByteStride, result = output }; -#if UNITY_JOBS - jobHandle = job.ScheduleBatch(count,GltfImport.DefaultBatchCount); -#else - jobHandle = job.Schedule(count, GltfImport.DefaultBatchCount); -#endif + jobHandle = job.ScheduleBatch(count, GltfImportBase.DefaultBatchCount); break; } case GltfComponentType.UnsignedByte: @@ -217,11 +209,7 @@ int outputByteStride outputByteStride = outputByteStride, result = output }; -#if UNITY_JOBS - jobHandle = job.ScheduleBatch(count,GltfImport.DefaultBatchCount); -#else - jobHandle = job.Schedule(count, GltfImport.DefaultBatchCount); -#endif + jobHandle = job.ScheduleBatch(count, GltfImportBase.DefaultBatchCount); break; } default: @@ -254,7 +242,7 @@ ICodeLogger logger jointsUInt8Job.input = (byte*)input; jointsUInt8Job.outputByteStride = outputByteStride; jointsUInt8Job.result = output; - jobHandle = jointsUInt8Job.Schedule(count, GltfImport.DefaultBatchCount); + jobHandle = jointsUInt8Job.Schedule(count, GltfImportBase.DefaultBatchCount); break; case GltfComponentType.UnsignedShort: var jointsUInt16Job = new ConvertBoneJointsUInt16ToUInt32Job(); @@ -262,7 +250,7 @@ ICodeLogger logger jointsUInt16Job.input = (byte*)input; jointsUInt16Job.outputByteStride = outputByteStride; jointsUInt16Job.result = output; - jobHandle = jointsUInt16Job.Schedule(count, GltfImport.DefaultBatchCount); + jobHandle = jointsUInt16Job.Schedule(count, GltfImportBase.DefaultBatchCount); break; default: logger?.Error(LogCode.TypeUnsupported, "Joints", inputType.ToString()); diff --git a/Runtime/Scripts/VertexBufferColors.cs b/Runtime/Scripts/VertexBufferColors.cs index 7c88068a..4fc44c18 100644 --- a/Runtime/Scripts/VertexBufferColors.cs +++ b/Runtime/Scripts/VertexBufferColors.cs @@ -115,7 +115,7 @@ NativeArray output inputByteStride = inputByteStride > 0 ? inputByteStride : 3, result = output }; - jobHandle = job.Schedule(output.Length, GltfImport.DefaultBatchCount); + jobHandle = job.Schedule(output.Length, GltfImportBase.DefaultBatchCount); } break; case GltfComponentType.Float: @@ -126,7 +126,7 @@ NativeArray output inputByteStride = inputByteStride > 0 ? inputByteStride : 12, result = (float4*)output.GetUnsafePtr() }; - jobHandle = job.Schedule(output.Length, GltfImport.DefaultBatchCount); + jobHandle = job.Schedule(output.Length, GltfImportBase.DefaultBatchCount); } break; case GltfComponentType.UnsignedShort: @@ -137,7 +137,7 @@ NativeArray output inputByteStride = inputByteStride > 0 ? inputByteStride : 6, result = output }; - jobHandle = job.Schedule(output.Length, GltfImport.DefaultBatchCount); + jobHandle = job.Schedule(output.Length, GltfImportBase.DefaultBatchCount); } break; default: @@ -157,7 +157,7 @@ NativeArray output inputByteStride = inputByteStride > 0 ? inputByteStride : 4, result = output }; - jobHandle = job.Schedule(output.Length, GltfImport.DefaultBatchCount); + jobHandle = job.Schedule(output.Length, GltfImportBase.DefaultBatchCount); } break; case GltfComponentType.Float: @@ -180,11 +180,7 @@ NativeArray output inputByteStride = inputByteStride, result = (float4*)output.GetUnsafePtr() }; -#if UNITY_JOBS - jobHandle = job.ScheduleBatch(output.Length,GltfImport.DefaultBatchCount); -#else - jobHandle = job.Schedule(output.Length, GltfImport.DefaultBatchCount); -#endif + jobHandle = job.ScheduleBatch(output.Length, GltfImportBase.DefaultBatchCount); } } break; @@ -196,11 +192,7 @@ NativeArray output inputByteStride = inputByteStride > 0 ? inputByteStride : 8, result = (float4*)output.GetUnsafePtr() }; -#if UNITY_JOBS - jobHandle = job.ScheduleBatch(output.Length,GltfImport.DefaultBatchCount); -#else - jobHandle = job.Schedule(output.Length, GltfImport.DefaultBatchCount); -#endif + jobHandle = job.ScheduleBatch(output.Length, GltfImportBase.DefaultBatchCount); } break; default: diff --git a/Runtime/Scripts/VertexBufferConfigBase.cs b/Runtime/Scripts/VertexBufferConfigBase.cs index b6039c75..f238aa59 100644 --- a/Runtime/Scripts/VertexBufferConfigBase.cs +++ b/Runtime/Scripts/VertexBufferConfigBase.cs @@ -97,11 +97,7 @@ int jointsAccessorIndex outputByteStride = outputByteStride, result = output }; -#if UNITY_JOBS - jobHandle = job.ScheduleBatch(count,GltfImport.DefaultBatchCount); -#else - jobHandle = job.Schedule(count, GltfImport.DefaultBatchCount); -#endif + jobHandle = job.ScheduleBatch(count, GltfImportBase.DefaultBatchCount); } else if (inputType == GltfComponentType.UnsignedShort) @@ -115,11 +111,7 @@ int jointsAccessorIndex outputByteStride = outputByteStride, result = output }; -#if UNITY_JOBS - jobHandle = job.ScheduleBatch(count,GltfImport.DefaultBatchCount); -#else - jobHandle = job.Schedule(count, GltfImport.DefaultBatchCount); -#endif + jobHandle = job.ScheduleBatch(count, GltfImportBase.DefaultBatchCount); } else { @@ -130,11 +122,7 @@ int jointsAccessorIndex outputByteStride = outputByteStride, result = output }; -#if UNITY_JOBS - jobHandle = job.ScheduleBatch(count,GltfImport.DefaultBatchCount); -#else - jobHandle = job.Schedule(count, GltfImport.DefaultBatchCount); -#endif + jobHandle = job.ScheduleBatch(count, GltfImportBase.DefaultBatchCount); } } else @@ -152,11 +140,7 @@ int jointsAccessorIndex outputByteStride = outputByteStride, result = output }; -#if UNITY_JOBS - jobHandle = job.ScheduleBatch(count,GltfImport.DefaultBatchCount); -#else - jobHandle = job.Schedule(count, GltfImport.DefaultBatchCount); -#endif + jobHandle = job.ScheduleBatch(count, GltfImportBase.DefaultBatchCount); } else { @@ -167,11 +151,7 @@ int jointsAccessorIndex outputByteStride = outputByteStride, result = output }; -#if UNITY_JOBS - jobHandle = job.ScheduleBatch(count,GltfImport.DefaultBatchCount); -#else - jobHandle = job.Schedule(count, GltfImport.DefaultBatchCount); -#endif + jobHandle = job.ScheduleBatch(count, GltfImportBase.DefaultBatchCount); } } else @@ -183,11 +163,7 @@ int jointsAccessorIndex outputByteStride = outputByteStride, result = output }; -#if UNITY_JOBS - jobHandle = job.ScheduleBatch(count,GltfImport.DefaultBatchCount); -#else - jobHandle = job.Schedule(count, GltfImport.DefaultBatchCount); -#endif + jobHandle = job.ScheduleBatch(count, GltfImportBase.DefaultBatchCount); } } else @@ -204,11 +180,7 @@ int jointsAccessorIndex outputByteStride = outputByteStride, result = output }; -#if UNITY_JOBS - jobHandle = job.ScheduleBatch(count,GltfImport.DefaultBatchCount); -#else - jobHandle = job.Schedule(count, GltfImport.DefaultBatchCount); -#endif + jobHandle = job.ScheduleBatch(count, GltfImportBase.DefaultBatchCount); } else { @@ -219,11 +191,7 @@ int jointsAccessorIndex outputByteStride = outputByteStride, result = output }; -#if UNITY_JOBS - jobHandle = job.ScheduleBatch(count,GltfImport.DefaultBatchCount); -#else - jobHandle = job.Schedule(count, GltfImport.DefaultBatchCount); -#endif + jobHandle = job.ScheduleBatch(count, GltfImportBase.DefaultBatchCount); } } else @@ -236,11 +204,7 @@ int jointsAccessorIndex outputByteStride = outputByteStride, result = output }; -#if UNITY_JOBS - jobHandle = job.ScheduleBatch(count,GltfImport.DefaultBatchCount); -#else - jobHandle = job.Schedule(count, GltfImport.DefaultBatchCount); -#endif + jobHandle = job.ScheduleBatch(count, GltfImportBase.DefaultBatchCount); } } else @@ -256,11 +220,7 @@ int jointsAccessorIndex outputByteStride = outputByteStride, result = output }; -#if UNITY_JOBS - jobHandle = job.ScheduleBatch(count,GltfImport.DefaultBatchCount); -#else - jobHandle = job.Schedule(count, GltfImport.DefaultBatchCount); -#endif + jobHandle = job.ScheduleBatch(count, GltfImportBase.DefaultBatchCount); } else { @@ -271,11 +231,7 @@ int jointsAccessorIndex outputByteStride = outputByteStride, result = output }; -#if UNITY_JOBS - jobHandle = job.ScheduleBatch(count,GltfImport.DefaultBatchCount); -#else - jobHandle = job.Schedule(count, GltfImport.DefaultBatchCount); -#endif + jobHandle = job.ScheduleBatch(count, GltfImportBase.DefaultBatchCount); } } else @@ -310,11 +266,7 @@ int jointsAccessorIndex outputByteStride = outputByteStride, result = output }; -#if UNITY_JOBS - jobHandle = jobTangent.ScheduleBatch(count,GltfImport.DefaultBatchCount); -#else - jobHandle = jobTangent.Schedule(count, GltfImport.DefaultBatchCount); -#endif + jobHandle = jobTangent.ScheduleBatch(count, GltfImportBase.DefaultBatchCount); break; } case GltfComponentType.Short: @@ -327,11 +279,7 @@ int jointsAccessorIndex outputByteStride = outputByteStride, result = output }; -#if UNITY_JOBS - jobHandle = jobTangent.ScheduleBatch(count,GltfImport.DefaultBatchCount); -#else - jobHandle = jobTangent.Schedule(count, GltfImport.DefaultBatchCount); -#endif + jobHandle = jobTangent.ScheduleBatch(count, GltfImportBase.DefaultBatchCount); break; } case GltfComponentType.Byte: @@ -344,11 +292,7 @@ int jointsAccessorIndex outputByteStride = outputByteStride, result = output }; -#if UNITY_JOBS - jobHandle = jobTangent.ScheduleBatch(count,GltfImport.DefaultBatchCount); -#else - jobHandle = jobTangent.Schedule(count, GltfImport.DefaultBatchCount); -#endif + jobHandle = jobTangent.ScheduleBatch(count, GltfImportBase.DefaultBatchCount); break; } default: @@ -387,7 +331,7 @@ int jointsAccessorIndex JobHandle? jobHandle = job.Schedule( sparseCount, - GltfImport.DefaultBatchCount, + GltfImportBase.DefaultBatchCount, dependsOn: dependsOn ?? default(JobHandle) ); Profiler.EndSample(); diff --git a/Runtime/Scripts/VertexBufferTexCoords.cs b/Runtime/Scripts/VertexBufferTexCoords.cs index af7f5748..737ac778 100644 --- a/Runtime/Scripts/VertexBufferTexCoords.cs +++ b/Runtime/Scripts/VertexBufferTexCoords.cs @@ -130,11 +130,7 @@ public override void Dispose() outputByteStride = outputByteStride, result = output }; -#if UNITY_JOBS - jobHandle = jobUv.ScheduleBatch(count,GltfImport.DefaultBatchCount); -#else - jobHandle = jobUv.Schedule(count, GltfImport.DefaultBatchCount); -#endif + jobHandle = jobUv.ScheduleBatch(count, GltfImportBase.DefaultBatchCount); } break; case GltfComponentType.UnsignedByte: @@ -147,7 +143,7 @@ public override void Dispose() outputByteStride = outputByteStride, result = output }; - jobHandle = jobUv.Schedule(count, GltfImport.DefaultBatchCount); + jobHandle = jobUv.Schedule(count, GltfImportBase.DefaultBatchCount); } else { @@ -158,11 +154,7 @@ public override void Dispose() outputByteStride = outputByteStride, result = output }; -#if UNITY_JOBS - jobHandle = jobUv.ScheduleBatch(count,GltfImport.DefaultBatchCount); -#else - jobHandle = jobUv.Schedule(count, GltfImport.DefaultBatchCount); -#endif + jobHandle = jobUv.ScheduleBatch(count, GltfImportBase.DefaultBatchCount); } break; case GltfComponentType.UnsignedShort: @@ -175,7 +167,7 @@ public override void Dispose() outputByteStride = outputByteStride, result = output }; - jobHandle = jobUv.Schedule(count, GltfImport.DefaultBatchCount); + jobHandle = jobUv.Schedule(count, GltfImportBase.DefaultBatchCount); } else { @@ -186,11 +178,7 @@ public override void Dispose() outputByteStride = outputByteStride, result = output }; -#if UNITY_JOBS - jobHandle = jobUv.ScheduleBatch(count,GltfImport.DefaultBatchCount); -#else - jobHandle = jobUv.Schedule(count, GltfImport.DefaultBatchCount); -#endif + jobHandle = jobUv.ScheduleBatch(count, GltfImportBase.DefaultBatchCount); } break; case GltfComponentType.Short: @@ -203,11 +191,7 @@ public override void Dispose() outputByteStride = outputByteStride, result = output }; -#if UNITY_JOBS - jobHandle = job.ScheduleBatch(count,GltfImport.DefaultBatchCount); -#else - jobHandle = job.Schedule(count, GltfImport.DefaultBatchCount); -#endif + jobHandle = job.ScheduleBatch(count, GltfImportBase.DefaultBatchCount); } else { @@ -218,11 +202,7 @@ public override void Dispose() outputByteStride = outputByteStride, result = output }; -#if UNITY_JOBS - jobHandle = job.ScheduleBatch(count,GltfImport.DefaultBatchCount); -#else - jobHandle = job.Schedule(count, GltfImport.DefaultBatchCount); -#endif + jobHandle = job.ScheduleBatch(count, GltfImportBase.DefaultBatchCount); } break; case GltfComponentType.Byte: @@ -235,11 +215,7 @@ public override void Dispose() outputByteStride = outputByteStride, result = output }; -#if UNITY_JOBS - jobHandle = jobInt8.ScheduleBatch(count,GltfImport.DefaultBatchCount); -#else - jobHandle = jobInt8.Schedule(count, GltfImport.DefaultBatchCount); -#endif + jobHandle = jobInt8.ScheduleBatch(count, GltfImportBase.DefaultBatchCount); } else { @@ -250,11 +226,7 @@ public override void Dispose() outputByteStride = outputByteStride, result = output }; -#if UNITY_JOBS - jobHandle = jobInt8.ScheduleBatch(count,GltfImport.DefaultBatchCount); -#else - jobHandle = jobInt8.Schedule(count, GltfImport.DefaultBatchCount); -#endif + jobHandle = jobInt8.ScheduleBatch(count, GltfImportBase.DefaultBatchCount); } break; default: diff --git a/Runtime/Scripts/glTFast.asmdef b/Runtime/Scripts/glTFast.asmdef index 86bc8508..abe37c44 100644 --- a/Runtime/Scripts/glTFast.asmdef +++ b/Runtime/Scripts/glTFast.asmdef @@ -5,7 +5,6 @@ "Unity.Mathematics", "Unity.Burst", "Unity.Collections", - "Unity.Jobs", "Draco", "Ktx", "Unity.Meshopt.Decompress", @@ -80,11 +79,6 @@ "expression": "", "define": "UNITY_WEBREQUEST_TEXTURE" }, - { - "name": "com.unity.jobs", - "expression": "0.2.0", - "define": "UNITY_JOBS" - }, { "name": "com.unity.meshopt.decompress", "expression": "", diff --git a/Tests/Runtime/Scripts/JobTests.cs b/Tests/Runtime/Scripts/JobTests.cs index 0d515aa0..456f6169 100644 --- a/Tests/Runtime/Scripts/JobTests.cs +++ b/Tests/Runtime/Scripts/JobTests.cs @@ -113,11 +113,7 @@ public unsafe void ConvertVector3FloatToFloatInterleavedJob() outputByteStride = 12, result = (float3*)m_Output.GetUnsafePtr() }; -#if UNITY_JOBS job.RunBatch(m_Input.Length); -#else - job.Run(m_Input.Length); -#endif CheckNormalizedResult(); CheckResult(); @@ -146,11 +142,7 @@ public unsafe void ConvertVector3Int16ToFloatInterleavedNormalizedJob() result = (float3*)m_Output.GetUnsafePtr(), outputByteStride = 12 }; -#if UNITY_JOBS job.RunBatch(m_Output.Length); -#else - job.Run(m_Output.Length); -#endif CheckNormalizedResult(Constants.epsilonInt16); } @@ -164,11 +156,7 @@ public unsafe void ConvertVector3Int8ToFloatInterleavedNormalizedJob() result = (float3*)m_Output.GetUnsafePtr(), outputByteStride = 12 }; -#if UNITY_JOBS job.RunBatch(m_Output.Length); -#else - job.Run(m_Output.Length); -#endif CheckNormalizedResult(Constants.epsilonInt8); } @@ -182,11 +170,7 @@ public unsafe void ConvertPositionsUInt16ToFloatInterleavedJob() result = (float3*)m_Output.GetUnsafePtr(), outputByteStride = 12 }; -#if UNITY_JOBS job.RunBatch(m_Output.Length); -#else - job.Run(m_Output.Length); -#endif CheckResult(); } @@ -200,11 +184,7 @@ public unsafe void ConvertPositionsUInt16ToFloatInterleavedNormalizedJob() result = (float3*)m_Output.GetUnsafePtr(), outputByteStride = 12 }; -#if UNITY_JOBS job.RunBatch(m_Output.Length); -#else - job.Run(m_Output.Length); -#endif CheckNormalizedResult(Constants.epsilonUInt16); } @@ -218,11 +198,7 @@ public unsafe void ConvertPositionsInt16ToFloatInterleavedJob() result = (float3*)m_Output.GetUnsafePtr(), outputByteStride = 12 }; -#if UNITY_JOBS job.RunBatch(m_Output.Length); -#else - job.Run(m_Output.Length); -#endif CheckResult(); } @@ -236,11 +212,7 @@ public unsafe void ConvertPositionsInt8ToFloatInterleavedJob() result = (float3*)m_Output.GetUnsafePtr(), outputByteStride = 12 }; -#if UNITY_JOBS job.RunBatch(m_Output.Length); -#else - job.Run(m_Output.Length); -#endif CheckResult(); } @@ -254,11 +226,7 @@ public unsafe void ConvertPositionsUInt8ToFloatInterleavedJob() result = (float3*)m_Output.GetUnsafePtr(), outputByteStride = 12 }; -#if UNITY_JOBS job.RunBatch(m_Output.Length); -#else - job.Run(m_Output.Length); -#endif CheckResult(); } @@ -272,11 +240,7 @@ public unsafe void ConvertPositionsUInt8ToFloatInterleavedNormalizedJob() result = (float3*)m_Output.GetUnsafePtr(), outputByteStride = 12 }; -#if UNITY_JOBS job.RunBatch(m_Output.Length); -#else - job.Run(m_Output.Length); -#endif CheckNormalizedResult(Constants.epsilonUInt8); } @@ -290,11 +254,7 @@ public unsafe void ConvertNormalsInt16ToFloatInterleavedNormalizedJob() result = (float3*)m_Output.GetUnsafePtr(), outputByteStride = 12 }; -#if UNITY_JOBS - job.RunBatch(m_Output.Length); -#else - job.Run(m_Output.Length); -#endif + job.RunBatch(m_Output.Length); CheckNormalizedResult(Constants.epsilonInt16); } @@ -308,11 +268,7 @@ public unsafe void ConvertNormalsInt8ToFloatInterleavedNormalizedJob() result = (float3*)m_Output.GetUnsafePtr(), outputByteStride = 12 }; -#if UNITY_JOBS job.RunBatch(m_Output.Length); -#else - job.Run(m_Output.Length); -#endif CheckNormalizedResult(Constants.epsilonInt8); } } @@ -515,11 +471,7 @@ public unsafe void ConvertUVsUInt8ToFloatInterleavedJob() result = (float2*)m_UVOutput.GetUnsafePtr(), outputByteStride = 8 }; -#if UNITY_JOBS job.RunBatch(m_UVOutput.Length); -#else - job.Run(m_UVOutput.Length); -#endif CheckResult(Constants.epsilonUInt8); } @@ -547,11 +499,7 @@ public unsafe void ConvertUVsUInt16ToFloatInterleavedJob() result = (float2*)m_UVOutput.GetUnsafePtr(), outputByteStride = 8 }; -#if UNITY_JOBS job.RunBatch(m_UVOutput.Length); -#else - job.Run(m_UVOutput.Length); -#endif CheckResult(Constants.epsilonUInt16); } @@ -579,11 +527,7 @@ public unsafe void ConvertUVsInt16ToFloatInterleavedJob() result = (float2*)m_UVOutput.GetUnsafePtr(), outputByteStride = 8 }; -#if UNITY_JOBS job.RunBatch(m_UVOutput.Length); -#else - job.Run(m_UVOutput.Length); -#endif CheckResult(Constants.epsilonInt16); } @@ -597,11 +541,7 @@ public unsafe void ConvertUVsInt16ToFloatInterleavedNormalizedJob() result = (float2*)m_UVOutput.GetUnsafePtr(), outputByteStride = 8 }; -#if UNITY_JOBS job.RunBatch(m_UVOutput.Length); -#else - job.Run(m_UVOutput.Length); -#endif CheckNormalizedResult(Constants.epsilonInt16); } @@ -615,11 +555,7 @@ public unsafe void ConvertUVsInt8ToFloatInterleavedJob() result = (float2*)m_UVOutput.GetUnsafePtr(), outputByteStride = 8 }; -#if UNITY_JOBS job.RunBatch(m_UVOutput.Length); -#else - job.Run(m_UVOutput.Length); -#endif CheckResult(Constants.epsilonInt8); } @@ -633,11 +569,7 @@ public unsafe void ConvertUVsInt8ToFloatInterleavedNormalizedJob() result = (float2*)m_UVOutput.GetUnsafePtr(), outputByteStride = 8 }; -#if UNITY_JOBS job.RunBatch(m_UVOutput.Length); -#else - job.Run(m_UVOutput.Length); -#endif CheckNormalizedResult(Constants.epsilonInt8); } @@ -651,11 +583,7 @@ public unsafe void ConvertUVsFloatToFloatInterleavedJob() result = (float2*)m_UVOutput.GetUnsafePtr(), outputByteStride = 8 }; -#if UNITY_JOBS job.RunBatch(m_UVOutput.Length); -#else - job.Run(m_UVOutput.Length); -#endif CheckResult(); CheckNormalizedResult(); } @@ -832,11 +760,7 @@ public unsafe void ConvertTangentsFloatToFloatInterleavedJob() result = (float4*)m_RotOutput.GetUnsafePtr(), outputByteStride = 16 }; -#if UNITY_JOBS job.RunBatch(m_RotOutput.Length); -#else - job.Run(m_RotOutput.Length); -#endif CheckTangentResult(); } @@ -850,11 +774,7 @@ public unsafe void ConvertBoneWeightsFloatToFloatInterleavedJob() result = (float4*)m_RotOutput.GetUnsafePtr(), outputByteStride = 16 }; -#if UNITY_JOBS job.RunBatch(m_RotOutput.Length); -#else - job.Run(m_RotOutput.Length); -#endif CheckBoneWeightResult(); } @@ -871,11 +791,7 @@ public unsafe void ConvertTangentsInt16ToFloatInterleavedNormalizedJob() result = (float4*)m_RotOutput.GetUnsafePtr(), outputByteStride = 16 }; -#if UNITY_JOBS job.RunBatch(m_RotOutput.Length); -#else - job.Run(m_RotOutput.Length); -#endif CheckNormalizedTangentResult(Constants.epsilonInt16); } @@ -889,11 +805,7 @@ public unsafe void ConvertTangentsInt8ToFloatInterleavedNormalizedJob() result = (float4*)m_RotOutput.GetUnsafePtr(), outputByteStride = 16 }; -#if UNITY_JOBS job.RunBatch(m_RotOutput.Length); -#else - job.Run(m_RotOutput.Length); -#endif CheckNormalizedTangentResult(Constants.epsilonInt8); } } @@ -1006,11 +918,7 @@ public unsafe void ConvertColorsRGBAUInt16ToRGBAFloatJob() inputByteStride = 8, result = (float4*)m_ColorOutput.GetUnsafePtr() }; -#if UNITY_JOBS job.RunBatch(m_ColorOutput.Length); -#else - job.Run(m_ColorOutput.Length); -#endif CheckResultRGBA(Constants.epsilonUInt16); } @@ -1023,11 +931,7 @@ public unsafe void ConvertColorsRGBAFloatToRGBAFloatJob() inputByteStride = 16, result = (float4*)m_ColorOutput.GetUnsafePtr() }; -#if UNITY_JOBS job.RunBatch(m_ColorOutput.Length); -#else - job.Run(m_ColorOutput.Length); -#endif CheckResultRGBA(Constants.epsilonUInt16); } diff --git a/Tests/Runtime/Scripts/glTFast.Tests.asmdef b/Tests/Runtime/Scripts/glTFast.Tests.asmdef index 0b204b66..8f6723b3 100644 --- a/Tests/Runtime/Scripts/glTFast.Tests.asmdef +++ b/Tests/Runtime/Scripts/glTFast.Tests.asmdef @@ -4,6 +4,7 @@ "references": [ "UnityEngine.TestRunner", "Unity.Burst", + "Unity.Collections", "Unity.Mathematics", "Unity.PerformanceTesting", "glTFast", diff --git a/package.json b/package.json index c2b9f678..f06f6be0 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,8 @@ "com.unity.modules.jsonserialize": "1.0.0", "com.unity.modules.unitywebrequest": "1.0.0", "com.unity.mathematics": "1.3.1", - "com.unity.burst": "1.8.4" + "com.unity.burst": "1.8.4", + "com.unity.collections": "1.5.1" }, "type": "library", "unityRelease": "48f1" From dd822dccfd34b36310e9ad44007ca01282f83238 Mon Sep 17 00:00:00 2001 From: Andreas Atteneder Date: Tue, 23 Apr 2024 10:13:01 +0200 Subject: [PATCH 03/18] feat: Job performance tests. (#130) --- Tests/Runtime/Scripts/Performance.meta | 8 + .../Performance/JobPerformanceTests.cs | 1299 +++++++++++++++++ .../Performance/JobPerformanceTests.cs.meta | 11 + .../glTFast.Tests.Performance.asmref | 3 + .../glTFast.Tests.Performance.asmref.meta | 7 + Tests/Runtime/Scripts/glTFast.Tests.asmdef | 5 + 6 files changed, 1333 insertions(+) create mode 100644 Tests/Runtime/Scripts/Performance.meta create mode 100644 Tests/Runtime/Scripts/Performance/JobPerformanceTests.cs create mode 100644 Tests/Runtime/Scripts/Performance/JobPerformanceTests.cs.meta create mode 100644 Tests/Runtime/Scripts/Performance/glTFast.Tests.Performance.asmref create mode 100644 Tests/Runtime/Scripts/Performance/glTFast.Tests.Performance.asmref.meta diff --git a/Tests/Runtime/Scripts/Performance.meta b/Tests/Runtime/Scripts/Performance.meta new file mode 100644 index 00000000..92bc0cc5 --- /dev/null +++ b/Tests/Runtime/Scripts/Performance.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 96766deb3ddad4b8ab045ad6afc69d48 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Runtime/Scripts/Performance/JobPerformanceTests.cs b/Tests/Runtime/Scripts/Performance/JobPerformanceTests.cs new file mode 100644 index 00000000..a106a5a6 --- /dev/null +++ b/Tests/Runtime/Scripts/Performance/JobPerformanceTests.cs @@ -0,0 +1,1299 @@ +// SPDX-FileCopyrightText: 2024 Unity Technologies and the glTFast authors +// SPDX-License-Identifier: Apache-2.0 + +#if UNITY_PERFORMANCE_TESTS + +using System; +using GLTFast.Schema; +using NUnit.Framework; +using Unity.Collections.LowLevel.Unsafe; +using Unity.Collections; +using Unity.Jobs; +using Unity.Mathematics; +using Unity.PerformanceTesting; +using UnityEngine; + +namespace GLTFast.Tests.Performance.Jobs +{ + + static class Constants + { + public const int measureCount = 10; + public const int iterationsPerMeasurement = 5; + } + + [TestFixture] + public class Vector3Jobs + { + + const int k_Length = 10_000_000; + + NativeArray m_Input; + NativeArray m_InputUInt16; + NativeArray m_InputInt16; + NativeArray m_InputUInt8; + NativeArray m_InputInt8; + NativeArray m_Output; + + [OneTimeSetUp] + public void SetUpTest() + { + m_Input = new NativeArray(k_Length, Allocator.Persistent); + m_InputUInt16 = new NativeArray(k_Length * 3, Allocator.Persistent); + m_InputInt16 = new NativeArray(k_Length * 3, Allocator.Persistent); + m_InputUInt8 = new NativeArray(k_Length * 3, Allocator.Persistent); + m_InputInt8 = new NativeArray(k_Length * 3, Allocator.Persistent); + m_Output = new NativeArray(k_Length, Allocator.Persistent); + } + + [OneTimeTearDown] + public void Cleanup() + { + m_Input.Dispose(); + m_InputUInt16.Dispose(); + m_InputInt16.Dispose(); + m_InputUInt8.Dispose(); + m_InputInt8.Dispose(); + m_Output.Dispose(); + } + + [Test, Performance] + public unsafe void ConvertVector3FloatToFloatInterleavedJob() + { + var job = new GLTFast.Jobs.ConvertVector3FloatToFloatInterleavedJob + { + inputByteStride = 12, + input = (byte*)m_Input.GetUnsafeReadOnlyPtr(), + outputByteStride = 12, + result = (float3*)m_Output.GetUnsafePtr() + }; + Measure.Method(() => job.RunBatch(m_Input.Length) + ) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + + [Test, Performance] + public unsafe void ConvertVector3FloatToFloatJob() + { + var job = new GLTFast.Jobs.ConvertVector3FloatToFloatJob + { + input = (float3*)m_Input.GetUnsafeReadOnlyPtr(), + result = (float3*)m_Output.GetUnsafePtr() + }; + Measure.Method(() => job.Run(m_Input.Length)) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + + [Test, Performance] + public unsafe void ConvertVector3Int16ToFloatInterleavedNormalizedJob() + { + var job = new GLTFast.Jobs.ConvertVector3Int16ToFloatInterleavedNormalizedJob + { + input = (byte*)m_InputInt16.GetUnsafeReadOnlyPtr(), + inputByteStride = 6, + result = (float3*)m_Output.GetUnsafePtr(), + outputByteStride = 12 + }; + Measure.Method(() => job.RunBatch(m_Output.Length) + ) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + + [Test, Performance] + public unsafe void ConvertVector3Int8ToFloatInterleavedNormalizedJob() + { + var job = new GLTFast.Jobs.ConvertVector3Int8ToFloatInterleavedNormalizedJob + { + input = (sbyte*)m_InputInt8.GetUnsafeReadOnlyPtr(), + inputByteStride = 3, + result = (float3*)m_Output.GetUnsafePtr(), + outputByteStride = 12 + }; + Measure.Method(() => job.RunBatch(m_Output.Length) + ) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + + [Test, Performance] + public unsafe void ConvertPositionsUInt16ToFloatInterleavedJob() + { + var job = new GLTFast.Jobs.ConvertPositionsUInt16ToFloatInterleavedJob + { + input = (byte*)m_InputUInt16.GetUnsafeReadOnlyPtr(), + inputByteStride = 6, + result = (float3*)m_Output.GetUnsafePtr(), + outputByteStride = 12 + }; + Measure.Method(() => job.RunBatch(m_Output.Length) + ) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + + [Test, Performance] + public unsafe void ConvertPositionsUInt16ToFloatInterleavedNormalizedJob() + { + var job = new GLTFast.Jobs.ConvertPositionsUInt16ToFloatInterleavedNormalizedJob + { + input = (byte*)m_InputUInt16.GetUnsafeReadOnlyPtr(), + inputByteStride = 6, + result = (float3*)m_Output.GetUnsafePtr(), + outputByteStride = 12 + }; + Measure.Method(() => job.RunBatch(m_Output.Length) + ) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + + [Test, Performance] + public unsafe void ConvertPositionsInt16ToFloatInterleavedJob() + { + var job = new GLTFast.Jobs.ConvertPositionsInt16ToFloatInterleavedJob + { + input = (byte*)m_InputInt16.GetUnsafeReadOnlyPtr(), + inputByteStride = 6, + result = (float3*)m_Output.GetUnsafePtr(), + outputByteStride = 12 + }; + Measure.Method(() => job.RunBatch(m_Output.Length) + ) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + + [Test, Performance] + public unsafe void ConvertPositionsInt8ToFloatInterleavedJob() + { + var job = new GLTFast.Jobs.ConvertPositionsInt8ToFloatInterleavedJob + { + input = (sbyte*)m_InputInt8.GetUnsafeReadOnlyPtr(), + inputByteStride = 3, + result = (float3*)m_Output.GetUnsafePtr(), + outputByteStride = 12 + }; + Measure.Method(() => job.RunBatch(m_Output.Length) + ) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + + [Test, Performance] + public unsafe void ConvertPositionsUInt8ToFloatInterleavedJob() + { + var job = new GLTFast.Jobs.ConvertPositionsUInt8ToFloatInterleavedJob + { + input = (byte*)m_InputUInt8.GetUnsafeReadOnlyPtr(), + inputByteStride = 3, + result = (float3*)m_Output.GetUnsafePtr(), + outputByteStride = 12 + }; + Measure.Method(() => job.RunBatch(m_Output.Length) + ) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + + [Test, Performance] + public unsafe void ConvertPositionsUInt8ToFloatInterleavedNormalizedJob() + { + var job = new GLTFast.Jobs.ConvertPositionsUInt8ToFloatInterleavedNormalizedJob + { + input = (byte*)m_InputUInt8.GetUnsafeReadOnlyPtr(), + inputByteStride = 3, + result = (float3*)m_Output.GetUnsafePtr(), + outputByteStride = 12 + }; + Measure.Method(() => job.RunBatch(m_Output.Length) + ) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + + [Test, Performance] + public unsafe void ConvertNormalsInt16ToFloatInterleavedNormalizedJob() + { + var job = new GLTFast.Jobs.ConvertNormalsInt16ToFloatInterleavedNormalizedJob + { + input = (byte*)m_InputInt16.GetUnsafeReadOnlyPtr(), + inputByteStride = 6, + result = (float3*)m_Output.GetUnsafePtr(), + outputByteStride = 12 + }; + Measure.Method(() => job.RunBatch(m_Output.Length) + ) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + + [Test, Performance] + public unsafe void ConvertNormalsInt8ToFloatInterleavedNormalizedJob() + { + var job = new GLTFast.Jobs.ConvertNormalsInt8ToFloatInterleavedNormalizedJob + { + input = (sbyte*)m_InputInt8.GetUnsafeReadOnlyPtr(), + inputByteStride = 3, + result = (float3*)m_Output.GetUnsafePtr(), + outputByteStride = 12 + }; + Measure.Method(() => job.RunBatch(m_Output.Length) + ) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + } + + [TestFixture] + public class PositionSparseJobs + { + + const int k_Length = 100_000; + + NativeArray m_Indices; + NativeArray m_Input; + NativeArray m_Output; + + [OneTimeSetUp] + public void SetUpTest() + { + m_Indices = new NativeArray(k_Length, Allocator.Persistent); + m_Input = new NativeArray(k_Length, Allocator.Persistent); + m_Output = new NativeArray(k_Length * 2, Allocator.Persistent); + + for (int i = 0; i < k_Length; i++) + { + m_Indices[i] = i * 2; + m_Input[i] = new float3(i, k_Length - 1, 42); + } + } + + [OneTimeTearDown] + public void Cleanup() + { + m_Input.Dispose(); + m_Output.Dispose(); + m_Indices.Dispose(); + } + + [Test, Performance] + public unsafe void ConvertPositionsSparseJob() + { + const GltfComponentType indexType = GltfComponentType.UnsignedInt; + const GltfComponentType valueType = GltfComponentType.Float; + const bool normalized = false; + + var job = new GLTFast.Jobs.ConvertVector3SparseJob + { + indexBuffer = m_Indices.GetUnsafeReadOnlyPtr(), + indexConverter = GLTFast.Jobs.CachedFunction.GetIndexConverter(indexType), + inputByteStride = 3 * AccessorBase.GetComponentTypeSize(valueType), + input = m_Input.GetUnsafeReadOnlyPtr(), + valueConverter = GLTFast.Jobs.CachedFunction.GetPositionConverter(valueType, normalized), + outputByteStride = 12, + result = (float3*)m_Output.GetUnsafePtr(), + }; + Measure.Method(() => job.Run(m_Indices.Length)) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + } + + [TestFixture] + public class UVJobs + { + const int k_UVLength = 10_000_000; + + NativeArray m_UVInput; + NativeArray m_InputUInt16; + NativeArray m_InputInt16; + NativeArray m_InputUInt8; + NativeArray m_InputInt8; + NativeArray m_UVOutput; + + [OneTimeSetUp] + public void SetUpTest() + { + m_UVInput = new NativeArray(k_UVLength, Allocator.Persistent); + m_InputUInt16 = new NativeArray(k_UVLength * 2, Allocator.Persistent); + m_InputInt16 = new NativeArray(k_UVLength * 2, Allocator.Persistent); + m_InputUInt8 = new NativeArray(k_UVLength * 2, Allocator.Persistent); + m_InputInt8 = new NativeArray(k_UVLength * 2, Allocator.Persistent); + m_UVOutput = new NativeArray(k_UVLength, Allocator.Persistent); + } + + [OneTimeTearDown] + public void Cleanup() + { + m_UVInput.Dispose(); + m_InputUInt16.Dispose(); + m_InputInt16.Dispose(); + m_InputUInt8.Dispose(); + m_InputInt8.Dispose(); + m_UVOutput.Dispose(); + } + + // [Test, Performance] + // public unsafe void ConvertUVsUInt8ToFloatJob() { + // Measure.Method(() => { + // var job = new GLTFast.Jobs.ConvertUVsUInt8ToFloatJob { + // input = (byte*)m_UVInput.GetUnsafeReadOnlyPtr(), + // result = (Vector2*)m_UVOutput.GetUnsafePtr() + // }; + // job.Run(m_UVOutput.Length); + // }) + // .WarmupCount(1) + // .MeasurementCount(Constants.measureCount) + // .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + // .Run(); + // } + // + // [Test, Performance] + // public unsafe void ConvertUVsUInt8ToFloatNormalizedJob() { + // Measure.Method(() => { + // var job = new GLTFast.Jobs.ConvertUVsUInt8ToFloatNormalizedJob { + // input = (byte*)m_UVInput.GetUnsafeReadOnlyPtr(), + // result = (Vector2*)m_UVOutput.GetUnsafePtr() + // }; + // job.Run(m_UVOutput.Length); + // }) + // .WarmupCount(1) + // .MeasurementCount(Constants.measureCount) + // .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + // .Run(); + // } + // + // [Test, Performance] + // public unsafe void ConvertUVsUInt16ToFloatNormalizedJob() { + // Measure.Method(() => { + // var job = new GLTFast.Jobs.ConvertUVsUInt16ToFloatNormalizedJob { + // input = (ushort*)m_UVInput.GetUnsafeReadOnlyPtr(), + // result = (Vector2*)m_UVOutput.GetUnsafePtr() + // }; + // job.Run(m_UVOutput.Length); + // }) + // .WarmupCount(1) + // .MeasurementCount(Constants.measureCount) + // .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + // .Run(); + // } + // + // [Test, Performance] + // public unsafe void ConvertUVsUInt16ToFloatJob() { + // Measure.Method(() => { + // var job = new GLTFast.Jobs.ConvertUVsUInt16ToFloatJob { + // input = (ushort*)m_UVInput.GetUnsafeReadOnlyPtr(), + // result = (Vector2*)m_UVOutput.GetUnsafePtr() + // }; + // job.Run(m_UVOutput.Length); + // }) + // .WarmupCount(1) + // .MeasurementCount(Constants.measureCount) + // .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + // .Run(); + // } + // + // [Test, Performance] + // public unsafe void ConvertUVsFloatToFloatJob() { + // Measure.Method(() => { + // var job = new GLTFast.Jobs.ConvertUVsFloatToFloatJob { + // input = (float*)m_UVInput.GetUnsafeReadOnlyPtr(), + // result = (Vector2*)m_UVOutput.GetUnsafePtr() + // }; + // job.Run(m_UVOutput.Length); + // }) + // .WarmupCount(1) + // .MeasurementCount(Constants.measureCount) + // .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + // .Run(); + // } + + [Test, Performance] + public unsafe void ConvertUVsUInt8ToFloatInterleavedJob() + { + var job = new GLTFast.Jobs.ConvertUVsUInt8ToFloatInterleavedJob + { + input = (byte*)m_InputUInt8.GetUnsafeReadOnlyPtr(), + inputByteStride = 2, + result = (float2*)m_UVOutput.GetUnsafePtr(), + outputByteStride = 8 + }; + Measure.Method(() => job.RunBatch(m_UVOutput.Length)) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + + [Test, Performance] + public unsafe void ConvertUVsUInt8ToFloatInterleavedNormalizedJob() + { + var job = new GLTFast.Jobs.ConvertUVsUInt8ToFloatInterleavedNormalizedJob + { + input = (byte*)m_InputUInt8.GetUnsafeReadOnlyPtr(), + inputByteStride = 2, + result = (float2*)m_UVOutput.GetUnsafePtr(), + outputByteStride = 8 + }; + Measure.Method(() => job.Run(m_UVOutput.Length)) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + + [Test, Performance] + public unsafe void ConvertUVsUInt16ToFloatInterleavedJob() + { + var job = new GLTFast.Jobs.ConvertUVsUInt16ToFloatInterleavedJob + { + input = (byte*)m_InputUInt16.GetUnsafeReadOnlyPtr(), + inputByteStride = 4, + result = (float2*)m_UVOutput.GetUnsafePtr(), + outputByteStride = 8 + }; + Measure.Method(() => job.RunBatch(m_UVOutput.Length)) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + + [Test, Performance] + public unsafe void ConvertUVsUInt16ToFloatInterleavedNormalizedJob() + { + var job = new GLTFast.Jobs.ConvertUVsUInt16ToFloatInterleavedNormalizedJob + { + input = (byte*)m_InputUInt16.GetUnsafeReadOnlyPtr(), + inputByteStride = 4, + result = (float2*)m_UVOutput.GetUnsafePtr(), + outputByteStride = 8 + }; + Measure.Method(() => job.Run(m_UVOutput.Length)) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + + [Test, Performance] + public unsafe void ConvertUVsInt16ToFloatInterleavedJob() + { + var job = new GLTFast.Jobs.ConvertUVsInt16ToFloatInterleavedJob + { + input = (short*)m_InputInt16.GetUnsafeReadOnlyPtr(), + inputByteStride = 4, + result = (float2*)m_UVOutput.GetUnsafePtr(), + outputByteStride = 8 + }; + Measure.Method(() => job.RunBatch(m_UVOutput.Length)) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + + [Test, Performance] + public unsafe void ConvertUVsInt16ToFloatInterleavedNormalizedJob() + { + var job = new GLTFast.Jobs.ConvertUVsInt16ToFloatInterleavedNormalizedJob + { + input = (short*)m_InputInt16.GetUnsafeReadOnlyPtr(), + inputByteStride = 4, + result = (float2*)m_UVOutput.GetUnsafePtr(), + outputByteStride = 8 + }; + Measure.Method(() => job.RunBatch(m_UVOutput.Length)) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + + [Test, Performance] + public unsafe void ConvertUVsInt8ToFloatInterleavedJob() + { + var job = new GLTFast.Jobs.ConvertUVsInt8ToFloatInterleavedJob + { + input = (sbyte*)m_InputInt8.GetUnsafeReadOnlyPtr(), + inputByteStride = 2, + result = (float2*)m_UVOutput.GetUnsafePtr(), + outputByteStride = 8 + }; + Measure.Method(() => job.RunBatch(m_UVOutput.Length)) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + + [Test, Performance] + public unsafe void ConvertUVsInt8ToFloatInterleavedNormalizedJob() + { + var job = new GLTFast.Jobs.ConvertUVsInt8ToFloatInterleavedNormalizedJob + { + input = (sbyte*)m_InputInt8.GetUnsafeReadOnlyPtr(), + inputByteStride = 2, + result = (float2*)m_UVOutput.GetUnsafePtr(), + outputByteStride = 8 + }; + Measure.Method(() => job.RunBatch(m_UVOutput.Length)) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + + [Test, Performance] + public unsafe void ConvertUVsFloatToFloatInterleavedJob() + { + var job = new GLTFast.Jobs.ConvertUVsFloatToFloatInterleavedJob + { + input = (byte*)m_UVInput.GetUnsafeReadOnlyPtr(), + inputByteStride = 8, + result = (float2*)m_UVOutput.GetUnsafePtr(), + outputByteStride = 8 + }; + Measure.Method(() => job.RunBatch(m_UVOutput.Length)) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + } + + [TestFixture] + public class Vector4Jobs + { + const int k_RotationLength = 5_000_000; + + NativeArray m_RotInput; + NativeArray m_InputUInt16; + NativeArray m_InputInt16; + NativeArray m_InputUInt8; + NativeArray m_InputInt8; + NativeArray m_RotOutput; + + [OneTimeSetUp] + public void SetUpTest() + { + m_RotInput = new NativeArray(k_RotationLength, Allocator.Persistent); + m_InputUInt16 = new NativeArray(k_RotationLength * 4, Allocator.Persistent); + m_InputInt16 = new NativeArray(k_RotationLength * 4, Allocator.Persistent); + m_InputUInt8 = new NativeArray(k_RotationLength * 4, Allocator.Persistent); + m_InputInt8 = new NativeArray(k_RotationLength * 4, Allocator.Persistent); + m_RotOutput = new NativeArray(k_RotationLength, Allocator.Persistent); + } + + [OneTimeTearDown] + public void Cleanup() + { + m_RotInput.Dispose(); + m_InputUInt16.Dispose(); + m_InputInt16.Dispose(); + m_InputUInt8.Dispose(); + m_InputInt8.Dispose(); + m_RotOutput.Dispose(); + } + + [Test, Performance] + public unsafe void ConvertRotationsFloatToFloatJob() + { + var job = new GLTFast.Jobs.ConvertRotationsFloatToFloatJob + { + input = (float4*)m_RotInput.GetUnsafeReadOnlyPtr(), + result = (float4*)m_RotOutput.GetUnsafePtr() + }; + Measure.Method(() => job.Run(m_RotOutput.Length)) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + + [Test, Performance] + public unsafe void ConvertRotationsInt16ToFloatJob() + { + var job = new GLTFast.Jobs.ConvertRotationsInt16ToFloatJob + { + input = (short*)m_InputInt16.GetUnsafeReadOnlyPtr(), + result = (float*)m_RotOutput.GetUnsafePtr() + }; + Measure.Method(() => job.Run(m_RotOutput.Length)) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + + [Test, Performance] + public unsafe void ConvertRotationsInt8ToFloatJob() + { + m_InputInt8[0] = sbyte.MinValue; + m_InputInt8[1] = -64; + m_InputInt8[2] = 64; + m_InputInt8[3] = sbyte.MaxValue; + + var job = new GLTFast.Jobs.ConvertRotationsInt8ToFloatJob + { + input = (sbyte*)m_InputInt8.GetUnsafeReadOnlyPtr(), + result = (float*)m_RotOutput.GetUnsafePtr() + }; + Measure.Method(() => job.Run(m_RotOutput.Length)) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + + [Test, Performance] + public unsafe void ConvertTangentsFloatToFloatInterleavedJob() + { + var job = new GLTFast.Jobs.ConvertTangentsFloatToFloatInterleavedJob + { + input = (byte*)m_RotInput.GetUnsafeReadOnlyPtr(), + inputByteStride = 16, + result = (float4*)m_RotOutput.GetUnsafePtr(), + outputByteStride = 16 + }; + Measure.Method(() => job.RunBatch(m_RotOutput.Length)) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + + [Test, Performance] + public unsafe void ConvertBoneWeightsFloatToFloatInterleavedJob() + { + var job = new GLTFast.Jobs.ConvertBoneWeightsFloatToFloatInterleavedJob + { + input = (byte*)m_RotInput.GetUnsafeReadOnlyPtr(), + inputByteStride = 16, + result = (float4*)m_RotOutput.GetUnsafePtr(), + outputByteStride = 16 + }; + Measure.Method(() => job.RunBatch(m_RotOutput.Length)) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + + // TODO: Test ConvertBoneWeightsUInt8ToFloatInterleavedJob + // TODO: Test ConvertBoneWeightsUInt16ToFloatInterleavedJob + + [Test, Performance] + public unsafe void ConvertTangentsInt16ToFloatInterleavedNormalizedJob() + { + var job = new GLTFast.Jobs.ConvertTangentsInt16ToFloatInterleavedNormalizedJob + { + input = (short*)m_InputInt16.GetUnsafeReadOnlyPtr(), + inputByteStride = 8, + result = (float4*)m_RotOutput.GetUnsafePtr(), + outputByteStride = 16 + }; + Measure.Method(() => job.RunBatch(m_RotOutput.Length)) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + + [Test, Performance] + public unsafe void ConvertTangentsInt8ToFloatInterleavedNormalizedJob() + { + var job = new GLTFast.Jobs.ConvertTangentsInt8ToFloatInterleavedNormalizedJob + { + input = (sbyte*)m_InputInt8.GetUnsafeReadOnlyPtr(), + inputByteStride = 4, + result = (float4*)m_RotOutput.GetUnsafePtr(), + outputByteStride = 16 + }; + Measure.Method(() => job.RunBatch(m_RotOutput.Length)) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + } + + [TestFixture] + public class ColorJobs + { + const int k_ColorLength = 3_000_000; + Color m_ReferenceRGB = new Color(.13f, .42f, .95f, 1f); + Color m_ReferenceRGBA = new Color(.42f, .95f, .5f, .24f); + + NativeArray m_ColorInput; + NativeArray m_InputUInt16; + NativeArray m_InputUInt8; + NativeArray m_ColorOutput; + + [OneTimeSetUp] + public void SetUpTest() + { + m_ColorInput = new NativeArray(k_ColorLength * 4, Allocator.Persistent); + m_InputUInt16 = new NativeArray(k_ColorLength * 4, Allocator.Persistent); + m_InputUInt8 = new NativeArray(k_ColorLength * 4, Allocator.Persistent); + m_ColorOutput = new NativeArray(k_ColorLength, Allocator.Persistent); + + m_ColorInput[3] = m_ReferenceRGB.r; + m_ColorInput[4] = m_ReferenceRGB.g; + m_ColorInput[5] = m_ReferenceRGB.b; + m_ColorInput[6] = m_ReferenceRGBA.b; + m_ColorInput[7] = m_ReferenceRGBA.a; + + m_InputUInt8[3] = (byte)(byte.MaxValue * m_ReferenceRGB.r); + m_InputUInt8[4] = (byte)(byte.MaxValue * m_ReferenceRGB.g); + m_InputUInt8[5] = (byte)(byte.MaxValue * m_ReferenceRGB.b); + m_InputUInt8[6] = (byte)(byte.MaxValue * m_ReferenceRGBA.b); + m_InputUInt8[7] = (byte)(byte.MaxValue * m_ReferenceRGBA.a); + + m_InputUInt16[3] = (ushort)(ushort.MaxValue * m_ReferenceRGB.r); + m_InputUInt16[4] = (ushort)(ushort.MaxValue * m_ReferenceRGB.g); + m_InputUInt16[5] = (ushort)(ushort.MaxValue * m_ReferenceRGB.b); + m_InputUInt16[6] = (ushort)(ushort.MaxValue * m_ReferenceRGBA.b); + m_InputUInt16[7] = (ushort)(ushort.MaxValue * m_ReferenceRGBA.a); + } + + [OneTimeTearDown] + public void Cleanup() + { + m_ColorInput.Dispose(); + m_InputUInt8.Dispose(); + m_InputUInt16.Dispose(); + m_ColorOutput.Dispose(); + } + + [Test, Performance] + public unsafe void ConvertColorsRGBFloatToRGBAFloatJob() + { + var job = new GLTFast.Jobs.ConvertColorsRGBFloatToRGBAFloatJob + { + input = (byte*)m_ColorInput.GetUnsafeReadOnlyPtr(), + inputByteStride = 12, + result = (float4*)m_ColorOutput.GetUnsafePtr() + }; + Measure.Method(() => job.Run(m_ColorOutput.Length)) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + + [Test, Performance] + public unsafe void ConvertColorsRGBUInt8ToRGBAFloatJob() + { + var job = new GLTFast.Jobs.ConvertColorsRgbUInt8ToRGBAFloatJob + { + input = (byte*)m_InputUInt8.GetUnsafeReadOnlyPtr(), + inputByteStride = 3, + result = m_ColorOutput + }; + Measure.Method(() => job.Run(m_ColorOutput.Length)) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + + [Test, Performance] + public unsafe void ConvertColorsRGBUInt16ToRGBAFloatJob() + { + var job = new GLTFast.Jobs.ConvertColorsRgbUInt16ToRGBAFloatJob + { + input = (ushort*)m_InputUInt16.GetUnsafeReadOnlyPtr(), + inputByteStride = 6, + result = m_ColorOutput + }; + Measure.Method(() => job.Run(m_ColorOutput.Length)) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + + [Test, Performance] + public unsafe void ConvertColorsRGBAUInt16ToRGBAFloatJob() + { + var job = new GLTFast.Jobs.ConvertColorsRgbaUInt16ToRGBAFloatJob + { + input = (ushort*)m_InputUInt16.GetUnsafeReadOnlyPtr(), + inputByteStride = 8, + result = (float4*)m_ColorOutput.GetUnsafePtr() + }; + Measure.Method(() => job.RunBatch(m_ColorOutput.Length)) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + + [Test, Performance] + public unsafe void ConvertColorsRGBAFloatToRGBAFloatJob() + { + var job = new GLTFast.Jobs.ConvertColorsRGBAFloatToRGBAFloatJob + { + input = (byte*)m_ColorInput.GetUnsafeReadOnlyPtr(), + inputByteStride = 16, + result = (float4*)m_ColorOutput.GetUnsafePtr() + }; + Measure.Method(() => job.RunBatch(m_ColorOutput.Length)) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + + [Test, Performance] + public unsafe void ConvertColorsRGBAUInt8ToRGBAFloatJob() + { + var job = new GLTFast.Jobs.ConvertColorsRgbaUInt8ToRGBAFloatJob + { + input = (byte*)m_InputUInt8.GetUnsafeReadOnlyPtr(), + inputByteStride = 4, + result = m_ColorOutput + }; + Measure.Method(() => job.Run(m_ColorOutput.Length)) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + } + + [TestFixture] + public class BoneIndexJobs + { + const int k_BoneIndexLength = 2_000_000; + uint4 m_Reference = new uint4(2, 3, 4, 5); + NativeArray m_InputUInt8; + NativeArray m_InputUInt16; + NativeArray m_BoneIndexOutput; + + [OneTimeSetUp] + public void SetUpTest() + { + m_InputUInt8 = new NativeArray(k_BoneIndexLength * 4, Allocator.Persistent); + m_InputUInt16 = new NativeArray(k_BoneIndexLength * 4, Allocator.Persistent); + m_BoneIndexOutput = new NativeArray(k_BoneIndexLength, Allocator.Persistent); + + m_InputUInt8[4] = (byte)m_Reference.x; + m_InputUInt8[5] = (byte)m_Reference.y; + m_InputUInt8[6] = (byte)m_Reference.z; + m_InputUInt8[7] = (byte)m_Reference.w; + + m_InputUInt16[4] = (ushort)m_Reference.x; + m_InputUInt16[5] = (ushort)m_Reference.y; + m_InputUInt16[6] = (ushort)m_Reference.z; + m_InputUInt16[7] = (ushort)m_Reference.w; + } + + [OneTimeTearDown] + public void Cleanup() + { + m_InputUInt16.Dispose(); + m_InputUInt8.Dispose(); + m_BoneIndexOutput.Dispose(); + } + + [Test, Performance] + public unsafe void ConvertBoneJointsUInt8ToUInt32Job() + { + var job = new GLTFast.Jobs.ConvertBoneJointsUInt8ToUInt32Job + { + input = (byte*)m_InputUInt8.GetUnsafeReadOnlyPtr(), + inputByteStride = 4, + result = (uint4*)m_BoneIndexOutput.GetUnsafePtr(), + outputByteStride = 16 + }; + Measure.Method(() => job.Run(m_BoneIndexOutput.Length)) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + + [Test, Performance] + public unsafe void ConvertBoneJointsUInt16ToUInt32Job() + { + var job = new GLTFast.Jobs.ConvertBoneJointsUInt16ToUInt32Job + { + input = (byte*)m_InputUInt16.GetUnsafeReadOnlyPtr(), + inputByteStride = 8, + result = (uint4*)m_BoneIndexOutput.GetUnsafePtr(), + outputByteStride = 16 + }; + Measure.Method(() => + { + job.Run(m_BoneIndexOutput.Length); + }) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + } + + [TestFixture] + public class MatrixJobs + { + const int k_MatrixLength = 800_000; + static readonly Matrix4x4 k_Reference = new Matrix4x4( + new Vector4(1, -5, -9, 13), + new Vector4(-2, 6, 10, 14), + new Vector4(-3, 7, 11, 15), + new Vector4(-4, 8, 12, 16) + ); + NativeArray m_MatrixInput; + NativeArray m_MatrixOutput; + + [OneTimeSetUp] + public void SetUpTest() + { + m_MatrixInput = new NativeArray(k_MatrixLength, Allocator.Persistent); + m_MatrixOutput = new NativeArray(k_MatrixLength, Allocator.Persistent); + + m_MatrixInput[1] = new float4x4( + 1, 2, 3, 4, + 5, 6, 7, 8, + 9, 10, 11, 12, + 13, 14, 15, 16 + ); + } + + [OneTimeTearDown] + public void Cleanup() + { + m_MatrixInput.Dispose(); + m_MatrixOutput.Dispose(); + } + + [Test, Performance] + public unsafe void ConvertMatricesJob() + { + var job = new GLTFast.Jobs.ConvertMatricesJob + { + input = (float4x4*)m_MatrixInput.GetUnsafeReadOnlyPtr(), + result = (float4x4*)m_MatrixOutput.GetUnsafePtr(), + }; + Measure.Method(() => job.Run(m_MatrixOutput.Length)) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + + Assert.AreEqual(k_Reference, m_MatrixOutput[1]); + } + } + + [TestFixture] + public class IndexJobs + { + const int k_IndexLength = 24_000_000; // multiple of 3! + NativeArray m_InputUInt8; + NativeArray m_InputUInt16; + NativeArray m_InputUInt32; + NativeArray m_IndexOutput; + + [OneTimeSetUp] + public void SetUpTest() + { + m_InputUInt8 = new NativeArray(k_IndexLength, Allocator.Persistent); + m_InputUInt16 = new NativeArray(k_IndexLength, Allocator.Persistent); + m_InputUInt32 = new NativeArray(k_IndexLength, Allocator.Persistent); + m_IndexOutput = new NativeArray(k_IndexLength, Allocator.Persistent); + + for (int i = 0; i < 6; i++) + { + m_InputUInt8[i] = (byte)i; + m_InputUInt16[i] = (ushort)i; + m_InputUInt32[i] = (uint)i; + } + } + + [OneTimeTearDown] + public void Cleanup() + { + m_InputUInt8.Dispose(); + m_InputUInt16.Dispose(); + m_InputUInt32.Dispose(); + m_IndexOutput.Dispose(); + } + + [Test, Performance] + public unsafe void CreateIndicesInt32Job() + { + Assert.IsTrue(m_IndexOutput.Length % 3 == 0); + var job = new GLTFast.Jobs.CreateIndicesInt32Job + { + result = (int*)m_IndexOutput.GetUnsafePtr() + }; + Measure.Method(() => job.Run(m_IndexOutput.Length)) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + + [Test, Performance] + public unsafe void CreateIndicesInt32FlippedJob() + { + Assert.IsTrue(m_IndexOutput.Length % 3 == 0); + var job = new GLTFast.Jobs.CreateIndicesInt32FlippedJob + { + result = (int*)m_IndexOutput.GetUnsafePtr() + }; + Measure.Method(() => job.Run(m_IndexOutput.Length)) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + + Assert.AreEqual(2, m_IndexOutput[0]); + Assert.AreEqual(1, m_IndexOutput[1]); + Assert.AreEqual(0, m_IndexOutput[2]); + Assert.AreEqual(5, m_IndexOutput[3]); + Assert.AreEqual(4, m_IndexOutput[4]); + Assert.AreEqual(3, m_IndexOutput[5]); + } + + [Test, Performance] + public unsafe void ConvertIndicesUInt8ToInt32Job() + { + Assert.IsTrue(m_IndexOutput.Length % 3 == 0); + var job = new GLTFast.Jobs.ConvertIndicesUInt8ToInt32Job + { + input = (byte*)m_InputUInt8.GetUnsafeReadOnlyPtr(), + result = (int*)m_IndexOutput.GetUnsafePtr() + }; + Measure.Method(() => job.Run(m_IndexOutput.Length)) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + + [Test, Performance] + public unsafe void ConvertIndicesUInt8ToInt32FlippedJob() + { + Assert.IsTrue(m_IndexOutput.Length % 3 == 0); + var job = new GLTFast.Jobs.ConvertIndicesUInt8ToInt32FlippedJob + { + input = (byte*)m_InputUInt8.GetUnsafeReadOnlyPtr(), + result = (int3*)m_IndexOutput.GetUnsafePtr() + }; + Measure.Method(() => job.Run(m_IndexOutput.Length / 3)) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + + [Test, Performance] + public unsafe void ConvertIndicesUInt16ToInt32FlippedJob() + { + Assert.IsTrue(m_IndexOutput.Length % 3 == 0); + var job = new GLTFast.Jobs.ConvertIndicesUInt16ToInt32FlippedJob + { + input = (ushort*)m_InputUInt16.GetUnsafeReadOnlyPtr(), + result = (int3*)m_IndexOutput.GetUnsafePtr() + }; + Measure.Method(() => job.Run(m_IndexOutput.Length / 3)) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + + [Test, Performance] + public unsafe void ConvertIndicesUInt16ToInt32Job() + { + Assert.IsTrue(m_IndexOutput.Length % 3 == 0); + var job = new GLTFast.Jobs.ConvertIndicesUInt16ToInt32Job + { + input = (ushort*)m_InputUInt16.GetUnsafeReadOnlyPtr(), + result = (int*)m_IndexOutput.GetUnsafePtr() + }; + Measure.Method(() => job.Run(m_IndexOutput.Length)) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + + [Test, Performance] + public unsafe void ConvertIndicesUInt32ToInt32Job() + { + Assert.IsTrue(m_IndexOutput.Length % 3 == 0); + var job = new GLTFast.Jobs.ConvertIndicesUInt32ToInt32Job + { + input = (uint*)m_InputUInt32.GetUnsafeReadOnlyPtr(), + result = (int*)m_IndexOutput.GetUnsafePtr() + }; + Measure.Method(() => job.Run(m_IndexOutput.Length)) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + + [Test, Performance] + public unsafe void ConvertIndicesUInt32ToInt32FlippedJob() + { + Assert.IsTrue(m_IndexOutput.Length % 3 == 0); + var job = new GLTFast.Jobs.ConvertIndicesUInt32ToInt32FlippedJob + { + input = (uint*)m_InputUInt32.GetUnsafeReadOnlyPtr(), + result = (int3*)m_IndexOutput.GetUnsafePtr() + }; + Measure.Method(() => job.Run(m_IndexOutput.Length / 3)) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + } + + [TestFixture] + public class ScalarJobs + { + const int k_ScalarLength = 5_000_000; + NativeArray m_InputInt8; + NativeArray m_InputUInt8; + NativeArray m_InputInt16; + NativeArray m_InputUInt16; + NativeArray m_ScalarOutput; + + [OneTimeSetUp] + public void SetUpTest() + { + m_InputInt8 = new NativeArray(k_ScalarLength, Allocator.Persistent); + m_InputUInt8 = new NativeArray(k_ScalarLength, Allocator.Persistent); + m_InputInt16 = new NativeArray(k_ScalarLength, Allocator.Persistent); + m_InputUInt16 = new NativeArray(k_ScalarLength, Allocator.Persistent); + m_ScalarOutput = new NativeArray(k_ScalarLength, Allocator.Persistent); + + m_InputInt8[0] = sbyte.MaxValue; + m_InputUInt8[0] = byte.MaxValue; + m_InputInt16[0] = short.MaxValue; + m_InputUInt16[0] = ushort.MaxValue; + + m_InputInt8[1] = 0; + m_InputUInt8[1] = 0; + m_InputInt16[1] = 0; + m_InputUInt16[1] = 0; + + m_InputInt8[2] = sbyte.MinValue; + m_InputUInt8[2] = byte.MinValue; + m_InputInt16[2] = short.MinValue; + m_InputUInt16[2] = ushort.MinValue; + + m_InputInt8[3] = sbyte.MaxValue / 2; + m_InputUInt8[3] = byte.MaxValue / 2; + m_InputInt16[3] = short.MaxValue / 2; + m_InputUInt16[3] = ushort.MaxValue / 2; + } + + [OneTimeTearDown] + public void Cleanup() + { + m_InputInt8.Dispose(); + m_InputUInt8.Dispose(); + m_InputInt16.Dispose(); + m_InputUInt16.Dispose(); + m_ScalarOutput.Dispose(); + } + + [Test, Performance] + public unsafe void ConvertScalarInt8ToFloatNormalizedJob() + { + var job = new GLTFast.Jobs.ConvertScalarInt8ToFloatNormalizedJob + { + input = (sbyte*)m_InputInt8.GetUnsafeReadOnlyPtr(), + result = m_ScalarOutput, + }; + Measure.Method(() => job.Run(m_ScalarOutput.Length)) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + + [Test, Performance] + public unsafe void ConvertScalarUInt8ToFloatNormalizedJob() + { + var job = new GLTFast.Jobs.ConvertScalarUInt8ToFloatNormalizedJob + { + input = (byte*)m_InputUInt8.GetUnsafeReadOnlyPtr(), + result = m_ScalarOutput, + }; + Measure.Method(() => job.Run(m_ScalarOutput.Length)) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + + [Test, Performance] + public unsafe void ConvertScalarInt16ToFloatNormalizedJob() + { + var job = new GLTFast.Jobs.ConvertScalarInt16ToFloatNormalizedJob + { + input = (short*)m_InputInt16.GetUnsafeReadOnlyPtr(), + result = m_ScalarOutput, + }; + Measure.Method(() => job.Run(m_ScalarOutput.Length)) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + + [Test, Performance] + public unsafe void ConvertScalarUInt16ToFloatNormalizedJob() + { + var job = new GLTFast.Jobs.ConvertScalarUInt16ToFloatNormalizedJob + { + input = (ushort*)m_InputUInt16.GetUnsafeReadOnlyPtr(), + result = m_ScalarOutput, + }; + Measure.Method(() => job.Run(m_ScalarOutput.Length)) + .WarmupCount(1) + .MeasurementCount(Constants.measureCount) + .IterationsPerMeasurement(Constants.iterationsPerMeasurement) + .Run(); + } + } +} +#endif // UNITY_PERFORMANCE_TESTS diff --git a/Tests/Runtime/Scripts/Performance/JobPerformanceTests.cs.meta b/Tests/Runtime/Scripts/Performance/JobPerformanceTests.cs.meta new file mode 100644 index 00000000..2df54e9f --- /dev/null +++ b/Tests/Runtime/Scripts/Performance/JobPerformanceTests.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0dfc6de11365943e09dba3b4f9e16e11 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Runtime/Scripts/Performance/glTFast.Tests.Performance.asmref b/Tests/Runtime/Scripts/Performance/glTFast.Tests.Performance.asmref new file mode 100644 index 00000000..acd72199 --- /dev/null +++ b/Tests/Runtime/Scripts/Performance/glTFast.Tests.Performance.asmref @@ -0,0 +1,3 @@ +{ + "reference": "GUID:7897e000c47a54a4c8a8a7345af3c565" +} \ No newline at end of file diff --git a/Tests/Runtime/Scripts/Performance/glTFast.Tests.Performance.asmref.meta b/Tests/Runtime/Scripts/Performance/glTFast.Tests.Performance.asmref.meta new file mode 100644 index 00000000..24127433 --- /dev/null +++ b/Tests/Runtime/Scripts/Performance/glTFast.Tests.Performance.asmref.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 88b101cca8e39421db96e0adb67e6ee1 +AssemblyDefinitionReferenceImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Runtime/Scripts/glTFast.Tests.asmdef b/Tests/Runtime/Scripts/glTFast.Tests.asmdef index 8f6723b3..6589af2b 100644 --- a/Tests/Runtime/Scripts/glTFast.Tests.asmdef +++ b/Tests/Runtime/Scripts/glTFast.Tests.asmdef @@ -55,6 +55,11 @@ "name": "com.unity.cloud.ktx", "expression": "3", "define": "KTX_UNITY" + }, + { + "name": "com.unity.test-framework.performance", + "expression": "3", + "define": "UNITY_PERFORMANCE_TESTS" } ], "noEngineReferences": false From bbf5f2d2514586030f3dd563687b1edee22a098d Mon Sep 17 00:00:00 2001 From: Alex Huot Date: Wed, 1 May 2024 10:49:55 -0400 Subject: [PATCH 04/18] Adding apple manifest doc (#132) * Adding apple manifest doc * fix: Removed some unwanted white-space via auto-format. * Update Documentation~/apple-privacy-manifest.md Co-authored-by: Stuart Thomson --------- Co-authored-by: Andreas Atteneder Co-authored-by: Stuart Thomson --- CHANGELOG.md | 1 + Documentation~/TableOfContents.md | 1 + Documentation~/apple-privacy-manifest.md | 21 +++++++++++++++++++++ 3 files changed, 23 insertions(+) create mode 100644 Documentation~/apple-privacy-manifest.md diff --git a/CHANGELOG.md b/CHANGELOG.md index e6ed090a..b870e5ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Dependency on [Unity Collections package][Collections]. +- Added Apple Privacy Manifest documentation. ### Changed - Faster buffer conversion jobs due to batching via [`IJobParallelForBatch`](https://docs.unity3d.com/Packages/com.unity.collections@2.4/api/Unity.Jobs.IJobParallelForBatch.html). diff --git a/Documentation~/TableOfContents.md b/Documentation~/TableOfContents.md index 945ac149..18adbd92 100644 --- a/Documentation~/TableOfContents.md +++ b/Documentation~/TableOfContents.md @@ -15,3 +15,4 @@ * [Known Issues](KnownIssues.md) * [Physical Light Units in glTF](LightUnits.md) * [Implementation Details](ImplementationDetails.md) + * [Apple Privacy Manifest](apple-privacy-manifest.md) diff --git a/Documentation~/apple-privacy-manifest.md b/Documentation~/apple-privacy-manifest.md new file mode 100644 index 00000000..33c86cf2 --- /dev/null +++ b/Documentation~/apple-privacy-manifest.md @@ -0,0 +1,21 @@ +# Apple privacy manifest +To publish applications for iOS, iPadOS, tvOS, and visionOS platforms on the App Store, you must include a [privacy manifest file](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files) in your application as per [Apple’s privacy policy](https://www.apple.com/legal/privacy/en-ww/). + +> [!NOTE] +> **Note**: +For information on creating a privacy manifest file to include in your application, refer to [Apple’s privacy manifest policy requirements](https://docs.unity3d.com/Manual/apple-privacy-manifest-policy.html). + +The PrivacyInfo.xcprivacy manifest file outlines the required information, ensuring transparency in accordance with user privacy practices. This file lists the [types of data](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_data_use_in_privacy_manifests) that your Unity applications, third-party SDKs, packages, and plug-ins collect, and the reasons for using certain [required reason API](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api) (Apple documentation) categories. Apple also requires that certain domains be declared as [tracking](https://developer.apple.com/app-store/user-privacy-and-data-use/) (Apple documentation); these domains might be blocked unless a user provides consent. +> [!WARNING] +> **Important**: If your privacy manifest doesn’t declare the use of the required reason API by you or third-party SDKs, the App Store might reject your application. Read more about the [required reason API](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api) in Apple’s documentation. + +The Unity Cloud gltFast package does not collect data or engage in any data practices requiring disclosure in a privacy manifest file. + +> [!NOTE] +> Note: The Unity Cloud gltFast package is dependent on the following services. Refer to their manifest files for applicable data practices. +> +> * `com.unity.burst` +> * `com.unity.mathematics` +> * `com.unity.collections` +> * `com.unity.modules.unitywebrequest` +> * `com.unity.modules.jsonserialize` From 042cd852e1954a36f079be55f67b0e27a78a6172 Mon Sep 17 00:00:00 2001 From: Andreas Atteneder Date: Fri, 3 May 2024 09:28:16 +0200 Subject: [PATCH 05/18] chore: Removed legacy code for Unity versions older than the minimum required 2020 LTS. (#133) * Auto-formatted code. --- CHANGELOG.md | 1 + Editor/Scripts/GltfImporter.cs | 4 - Editor/Scripts/GltfImporterEditor.cs | 4 - Runtime/Scripts/Export/ExportJobs.cs | 39 +- Runtime/Scripts/Export/GltfWriter.cs | 594 ++++-------------- .../Loading/DefaultDownloadProvider.cs | 6 +- 6 files changed, 126 insertions(+), 522 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b870e5ee..fdaa0cb7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - Soft dependency on deprecated [Unity Jobs package][JobsPkg]. +- Legacy code for Unity versions older than the minimum required 2020 LTS. ## [6.4.0] - 2024-04-17 diff --git a/Editor/Scripts/GltfImporter.cs b/Editor/Scripts/GltfImporter.cs index 093bf6c4..2c6248a7 100644 --- a/Editor/Scripts/GltfImporter.cs +++ b/Editor/Scripts/GltfImporter.cs @@ -25,11 +25,7 @@ using GLTFast.Logging; using GLTFast.Utils; using UnityEditor; -#if UNITY_2020_2_OR_NEWER using UnityEditor.AssetImporters; -#else -using UnityEditor.Experimental.AssetImporters; -#endif using UnityEngine; using UnityEngine.Rendering; using Object = UnityEngine.Object; diff --git a/Editor/Scripts/GltfImporterEditor.cs b/Editor/Scripts/GltfImporterEditor.cs index 6038718e..a8fcc047 100644 --- a/Editor/Scripts/GltfImporterEditor.cs +++ b/Editor/Scripts/GltfImporterEditor.cs @@ -9,11 +9,7 @@ using GLTFast.Editor; using UnityEditor; -#if UNITY_2020_2_OR_NEWER using UnityEditor.AssetImporters; -#else -using UnityEditor.Experimental.AssetImporters; -#endif using UnityEditor.UIElements; using UnityEngine; using UnityEngine.UIElements; diff --git a/Runtime/Scripts/Export/ExportJobs.cs b/Runtime/Scripts/Export/ExportJobs.cs index def5cbcb..861f3ffb 100644 --- a/Runtime/Scripts/Export/ExportJobs.cs +++ b/Runtime/Scripts/Export/ExportJobs.cs @@ -1,11 +1,6 @@ // SPDX-FileCopyrightText: 2023 Unity Technologies and the glTFast authors // SPDX-License-Identifier: Apache-2.0 -#if UNITY_2020_2_OR_NEWER -#define GLTFAST_MESH_DATA -#endif - - using Unity.Burst; using Unity.Collections; using Unity.Collections.LowLevel.Unsafe; @@ -20,10 +15,9 @@ namespace GLTFast.Export static class ExportJobs { -#if GLTFAST_MESH_DATA - [BurstCompile] - public struct ConvertIndicesFlippedJob : IJobParallelFor where T : struct { + public struct ConvertIndicesFlippedJob : IJobParallelFor where T : struct + { [ReadOnly] public NativeArray input; @@ -32,15 +26,17 @@ public struct ConvertIndicesFlippedJob : IJobParallelFor where T : struct { [NativeDisableParallelForRestriction] public NativeArray result; - public void Execute(int i) { - result[i*3+0] = input[i*3+0]; - result[i*3+1] = input[i*3+2]; - result[i*3+2] = input[i*3+1]; + public void Execute(int i) + { + result[i * 3 + 0] = input[i * 3 + 0]; + result[i * 3 + 1] = input[i * 3 + 2]; + result[i * 3 + 2] = input[i * 3 + 1]; } } [BurstCompile] - public struct ConvertIndicesQuadFlippedJob : IJobParallelFor where T : struct { + public struct ConvertIndicesQuadFlippedJob : IJobParallelFor where T : struct + { [ReadOnly] public NativeArray input; @@ -49,18 +45,17 @@ public struct ConvertIndicesQuadFlippedJob : IJobParallelFor where T : struct [NativeDisableParallelForRestriction] public NativeArray result; - public void Execute(int i) { - result[i*6+0] = input[i*4+0]; - result[i*6+1] = input[i*4+2]; - result[i*6+2] = input[i*4+1]; - result[i*6+3] = input[i*4+2]; - result[i*6+4] = input[i*4+0]; - result[i*6+5] = input[i*4+3]; + public void Execute(int i) + { + result[i * 6 + 0] = input[i * 4 + 0]; + result[i * 6 + 1] = input[i * 4 + 2]; + result[i * 6 + 2] = input[i * 4 + 1]; + result[i * 6 + 3] = input[i * 4 + 2]; + result[i * 6 + 4] = input[i * 4 + 0]; + result[i * 6 + 5] = input[i * 4 + 3]; } } -#endif // GLTFAST_MESH_DATA - [BurstCompile] public unsafe struct ConvertPositionFloatJob : IJobParallelFor { diff --git a/Runtime/Scripts/Export/GltfWriter.cs b/Runtime/Scripts/Export/GltfWriter.cs index aafcfde3..15cdee6d 100755 --- a/Runtime/Scripts/Export/GltfWriter.cs +++ b/Runtime/Scripts/Export/GltfWriter.cs @@ -1,15 +1,10 @@ // SPDX-FileCopyrightText: 2023 Unity Technologies and the glTFast authors // SPDX-License-Identifier: Apache-2.0 -#if UNITY_2020_2_OR_NEWER -#define GLTFAST_MESH_DATA -#endif - using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Threading.Tasks; @@ -19,9 +14,7 @@ using GLTFast.Schema; using Unity.Collections; using Unity.Collections.LowLevel.Unsafe; -#if GLTFAST_MESH_DATA using Unity.Jobs; -#endif using Unity.Mathematics; using UnityEngine; using UnityEngine.Assertions; @@ -63,17 +56,13 @@ enum State struct AttributeData { -#if GLTFAST_MESH_DATA public int stream; -#endif public int offset; public int accessorId; } -#if GLTFAST_MESH_DATA const int k_MAXStreamCount = 4; const int k_DefaultInnerLoopBatchCount = 512; -#endif State m_State; @@ -634,12 +623,8 @@ async Task Bake(string bufferPath, string directory) if (m_Meshes != null && m_Meshes.Count > 0) { -#if GLTFAST_MESH_DATA success = await BakeMeshes(); if (!success) return false; -#else - await BakeMeshesLegacy(); -#endif } AssignMaterialsToMeshes(); @@ -786,9 +771,8 @@ int DuplicateMesh(int meshId) return m_Meshes.Count - 1; } -#if GLTFAST_MESH_DATA - - async Task BakeMeshes() { + async Task BakeMeshes() + { Profiler.BeginSample("AcquireReadOnlyMeshData"); if ((m_Settings.Compression & Compression.Draco) != 0) @@ -846,7 +830,8 @@ async Task BakeMeshes() { return true; } - async Task BakeMesh(int meshId, UnityEngine.Mesh.MeshData meshData) { + async Task BakeMesh(int meshId, UnityEngine.Mesh.MeshData meshData) + { Profiler.BeginSample("BakeMesh 1"); @@ -861,7 +846,8 @@ async Task BakeMesh(int meshId, UnityEngine.Mesh.MeshData meshData) { var vertexCount = uMesh.vertexCount; var attrDataDict = new Dictionary(); - foreach (var attribute in vertexAttributes) { + foreach (var attribute in vertexAttributes) + { if (attribute.attribute == VertexAttribute.BlendWeight || attribute.attribute == VertexAttribute.BlendIndices) { @@ -869,7 +855,8 @@ async Task BakeMesh(int meshId, UnityEngine.Mesh.MeshData meshData) { continue; } - var attrData = new AttributeData { + var attrData = new AttributeData + { offset = strides[attribute.stream], stream = attribute.stream }; @@ -882,7 +869,8 @@ async Task BakeMesh(int meshId, UnityEngine.Mesh.MeshData meshData) { // Adhere data alignment rules Assert.IsTrue(attrData.offset % 4 == 0); - var accessor = new Accessor { + var accessor = new Accessor + { byteOffset = attrData.offset, componentType = Accessor.GetComponentType(attribute.format), count = vertexCount, @@ -894,10 +882,11 @@ async Task BakeMesh(int meshId, UnityEngine.Mesh.MeshData meshData) { attrData.accessorId = accessorId; attrDataDict[attribute.attribute] = attrData; - switch (attribute.attribute) { + switch (attribute.attribute) + { case VertexAttribute.Position: - Assert.AreEqual(VertexAttributeFormat.Float32,attribute.format); - Assert.AreEqual(3,attribute.dimension); + Assert.AreEqual(VertexAttributeFormat.Float32, attribute.format); + Assert.AreEqual(3, attribute.dimension); var bounds = uMesh.bounds; var max = bounds.max; var min = bounds.min; @@ -906,13 +895,13 @@ async Task BakeMesh(int meshId, UnityEngine.Mesh.MeshData meshData) { attributes.POSITION = accessorId; break; case VertexAttribute.Normal: - Assert.AreEqual(VertexAttributeFormat.Float32,attribute.format); - Assert.AreEqual(3,attribute.dimension); + Assert.AreEqual(VertexAttributeFormat.Float32, attribute.format); + Assert.AreEqual(3, attribute.dimension); attributes.NORMAL = accessorId; break; case VertexAttribute.Tangent: - Assert.AreEqual(VertexAttributeFormat.Float32,attribute.format); - Assert.AreEqual(4,attribute.dimension); + Assert.AreEqual(VertexAttributeFormat.Float32, attribute.format); + Assert.AreEqual(4, attribute.dimension); attributes.TANGENT = accessorId; break; case VertexAttribute.Color: @@ -954,7 +943,8 @@ async Task BakeMesh(int meshId, UnityEngine.Mesh.MeshData meshData) { } var streamCount = 1; - for (var stream = 0; stream < strides.Length; stream++) { + for (var stream = 0; stream < strides.Length; stream++) + { var stride = strides[stream]; if (stride <= 0) continue; streamCount = stream + 1; @@ -965,20 +955,26 @@ async Task BakeMesh(int meshId, UnityEngine.Mesh.MeshData meshData) { var indexAccessors = new Accessor[meshData.subMeshCount]; var indexOffset = 0; MeshTopology? topology = null; - for (var subMeshIndex = 0; subMeshIndex < meshData.subMeshCount; subMeshIndex++) { + for (var subMeshIndex = 0; subMeshIndex < meshData.subMeshCount; subMeshIndex++) + { var subMesh = meshData.GetSubMesh(subMeshIndex); - if (!topology.HasValue) { + if (!topology.HasValue) + { topology = subMesh.topology; - } else { + } + else + { Assert.AreEqual(topology.Value, subMesh.topology, "Mixed topologies are not supported!"); } var mode = GetDrawMode(subMesh.topology); - if (!mode.HasValue) { + if (!mode.HasValue) + { m_Logger?.Error(LogCode.TopologyUnsupported, subMesh.topology.ToString()); mode = DrawMode.Points; } - var indexAccessor = new Accessor { + var indexAccessor = new Accessor + { byteOffset = indexOffset, componentType = indexComponentType, count = subMesh.indexCount, @@ -988,7 +984,8 @@ async Task BakeMesh(int meshId, UnityEngine.Mesh.MeshData meshData) { }; indexAccessor.SetAttributeType(GltfAccessorAttributeType.SCALAR); - if (subMesh.topology == MeshTopology.Quads) { + if (subMesh.topology == MeshTopology.Quads) + { indexAccessor.count = indexAccessor.count / 2 * 3; } @@ -997,7 +994,8 @@ async Task BakeMesh(int meshId, UnityEngine.Mesh.MeshData meshData) { indexOffset += indexAccessor.count * Accessor.GetComponentTypeSize(indexComponentType); - mesh.primitives[subMeshIndex] = new MeshPrimitive { + mesh.primitives[subMeshIndex] = new MeshPrimitive + { mode = mode.Value, attributes = attributes, indices = indexAccessorId, @@ -1007,110 +1005,131 @@ async Task BakeMesh(int meshId, UnityEngine.Mesh.MeshData meshData) { Profiler.EndSample(); // "BakeMesh 1" int indexBufferViewId; - if (uMesh.indexFormat == IndexFormat.UInt16) { + if (uMesh.indexFormat == IndexFormat.UInt16) + { var indexData16 = meshData.GetIndexData(); - if (topology.Value == MeshTopology.Quads) { + if (topology.Value == MeshTopology.Quads) + { Profiler.BeginSample("IndexJobUInt16QuadsSchedule"); var quadCount = indexData16.Length / 4; - var destIndices = new NativeArray(quadCount*6,Allocator.TempJob); - var job = new ExportJobs.ConvertIndicesQuadFlippedJob { + var destIndices = new NativeArray(quadCount * 6, Allocator.TempJob); + var job = new ExportJobs.ConvertIndicesQuadFlippedJob + { input = indexData16, result = destIndices }.Schedule(quadCount, k_DefaultInnerLoopBatchCount); Profiler.EndSample(); - while (!job.IsCompleted) { + while (!job.IsCompleted) + { await Task.Yield(); } Profiler.BeginSample("IndexJobUInt16QuadsPostWork"); job.Complete(); indexBufferViewId = WriteBufferViewToBuffer( destIndices.Reinterpret(sizeof(ushort)), - byteAlignment:sizeof(ushort) + byteAlignment: sizeof(ushort) ); destIndices.Dispose(); Profiler.EndSample(); - } else { + } + else + { Profiler.BeginSample("IndexJobUInt16TrisSchedule"); var triangleCount = indexData16.Length / 3; - var destIndices = new NativeArray(indexData16.Length,Allocator.TempJob); - var job = new ExportJobs.ConvertIndicesFlippedJob { + var destIndices = new NativeArray(indexData16.Length, Allocator.TempJob); + var job = new ExportJobs.ConvertIndicesFlippedJob + { input = indexData16, result = destIndices }.Schedule(triangleCount, k_DefaultInnerLoopBatchCount); Profiler.EndSample(); - while (!job.IsCompleted) { + while (!job.IsCompleted) + { await Task.Yield(); } Profiler.BeginSample("IndexJobUInt16TrisPostWork"); job.Complete(); indexBufferViewId = WriteBufferViewToBuffer( destIndices.Reinterpret(sizeof(ushort)), - byteAlignment:sizeof(ushort) + byteAlignment: sizeof(ushort) ); destIndices.Dispose(); Profiler.EndSample(); } - } else { + } + else + { var indexData32 = meshData.GetIndexData(); - if (topology.Value == MeshTopology.Quads) { + if (topology.Value == MeshTopology.Quads) + { Profiler.BeginSample("IndexJobUInt32QuadsSchedule"); var quadCount = indexData32.Length / 4; - var destIndices = new NativeArray(quadCount*6,Allocator.TempJob); - var job = new ExportJobs.ConvertIndicesQuadFlippedJob { + var destIndices = new NativeArray(quadCount * 6, Allocator.TempJob); + var job = new ExportJobs.ConvertIndicesQuadFlippedJob + { input = indexData32, result = destIndices }.Schedule(quadCount, k_DefaultInnerLoopBatchCount); Profiler.EndSample(); - while (!job.IsCompleted) { + while (!job.IsCompleted) + { await Task.Yield(); } Profiler.BeginSample("IndexJobUInt32QuadsPostWork"); job.Complete(); indexBufferViewId = WriteBufferViewToBuffer( destIndices.Reinterpret(sizeof(uint)), - byteAlignment:sizeof(uint) + byteAlignment: sizeof(uint) ); destIndices.Dispose(); Profiler.EndSample(); - } else { + } + else + { Profiler.BeginSample("IndexJobUInt32TrisSchedule"); var triangleCount = indexData32.Length / 3; var destIndices = new NativeArray(indexData32.Length, Allocator.TempJob); - var job = new ExportJobs.ConvertIndicesFlippedJob { + var job = new ExportJobs.ConvertIndicesFlippedJob + { input = indexData32, result = destIndices }.Schedule(triangleCount, k_DefaultInnerLoopBatchCount); Profiler.EndSample(); - while (!job.IsCompleted) { + while (!job.IsCompleted) + { await Task.Yield(); } Profiler.BeginSample("IndexJobUInt32TrisPostWork"); job.Complete(); indexBufferViewId = WriteBufferViewToBuffer( destIndices.Reinterpret(sizeof(uint)), - byteAlignment:sizeof(uint) + byteAlignment: sizeof(uint) ); destIndices.Dispose(); Profiler.EndSample(); } } - foreach (var accessor in indexAccessors) { + foreach (var accessor in indexAccessors) + { accessor.bufferView = indexBufferViewId; } var inputStreams = new NativeArray[streamCount]; var outputStreams = new NativeArray[streamCount]; - for (var stream = 0; stream < streamCount; stream++) { + for (var stream = 0; stream < streamCount; stream++) + { inputStreams[stream] = meshData.GetVertexData(stream); outputStreams[stream] = new NativeArray(inputStreams[stream], Allocator.TempJob); } - foreach (var pair in attrDataDict) { + foreach (var pair in attrDataDict) + { var vertexAttribute = pair.Key; var attrData = pair.Value; - switch (vertexAttribute) { + switch (vertexAttribute) + { case VertexAttribute.Position: case VertexAttribute.Normal: await ConvertPositionAttribute( @@ -1150,7 +1169,8 @@ await ConvertTexCoordAttribute( } var bufferViewIds = new int[streamCount]; - for (var stream = 0; stream < streamCount; stream++) { + for (var stream = 0; stream < streamCount; stream++) + { bufferViewIds[stream] = WriteBufferViewToBuffer( outputStreams[stream], strides[stream], @@ -1160,7 +1180,8 @@ await ConvertTexCoordAttribute( outputStreams[stream].Dispose(); } - foreach (var pair in attrDataDict) { + foreach (var pair in attrDataDict) + { var attrData = pair.Value; m_Accessors[attrData.accessorId].bufferView = bufferViewIds[attrData.stream]; } @@ -1314,410 +1335,6 @@ int dracoId } #endif // DRACO_UNITY - int AddAccessor(Accessor accessor) { - m_Accessors = m_Accessors ?? new List(); - var accessorId = m_Accessors.Count; - m_Accessors.Add(accessor); - return accessorId; - } -#else - - async Task BakeMeshesLegacy() - { - for (var meshId = 0; meshId < m_Meshes.Count; meshId++) - { - BakeMeshLegacy(meshId); - await m_DeferAgent.BreakPoint(); - } - } - - void BakeMeshLegacy(int meshId) - { - - Profiler.BeginSample("BakeMeshLegacy"); - - var mesh = m_Meshes[meshId]; - var uMesh = m_UnityMeshes[meshId]; - - var attributes = new Attributes(); - var vertexAttributes = uMesh.GetVertexAttributes(); - var attrDataDict = new Dictionary(); - - for (var streamId = 0; streamId < vertexAttributes.Length; streamId++) - { - - var attribute = vertexAttributes[streamId]; - - switch (attribute.attribute) - { - case VertexAttribute.BlendWeight: - case VertexAttribute.BlendIndices: - Debug.LogWarning($"Vertex attribute {attribute.attribute} is not supported yet"); - continue; - } - - var attrData = new AttributeData - { - offset = 0, -#if GLTFAST_MESH_DATA - stream = streamId -#endif - }; - - var accessor = new Accessor - { - byteOffset = attrData.offset, - componentType = Accessor.GetComponentType(attribute.format), - count = uMesh.vertexCount, - }; - accessor.SetAttributeType(Accessor.GetAccessorAttributeType(attribute.dimension)); - - var accessorId = AddAccessor(accessor); - - attrData.accessorId = accessorId; - attrDataDict[attribute.attribute] = attrData; - - switch (attribute.attribute) - { - case VertexAttribute.Position: - Assert.AreEqual(VertexAttributeFormat.Float32, attribute.format); - Assert.AreEqual(3, attribute.dimension); - var bounds = uMesh.bounds; - var max = bounds.max; - var min = bounds.min; - accessor.min = new[] { -max.x, min.y, min.z }; - accessor.max = new[] { -min.x, max.y, max.z }; - attributes.POSITION = accessorId; - break; - case VertexAttribute.Normal: - Assert.AreEqual(VertexAttributeFormat.Float32, attribute.format); - Assert.AreEqual(3, attribute.dimension); - attributes.NORMAL = accessorId; - break; - case VertexAttribute.Tangent: - Assert.AreEqual(VertexAttributeFormat.Float32, attribute.format); - Assert.AreEqual(4, attribute.dimension); - attributes.TANGENT = accessorId; - break; - case VertexAttribute.Color: - accessor.componentType = GltfComponentType.UnsignedByte; - accessor.normalized = true; - attributes.COLOR_0 = accessorId; - break; - case VertexAttribute.TexCoord0: - attributes.TEXCOORD_0 = accessorId; - break; - case VertexAttribute.TexCoord1: - attributes.TEXCOORD_1 = accessorId; - break; - case VertexAttribute.TexCoord2: - attributes.TEXCOORD_2 = accessorId; - break; - case VertexAttribute.TexCoord3: - attributes.TEXCOORD_3 = accessorId; - break; - case VertexAttribute.TexCoord4: - attributes.TEXCOORD_4 = accessorId; - break; - case VertexAttribute.TexCoord5: - attributes.TEXCOORD_5 = accessorId; - break; - case VertexAttribute.TexCoord6: - attributes.TEXCOORD_6 = accessorId; - break; - case VertexAttribute.TexCoord7: - attributes.TEXCOORD_7 = accessorId; - break; - case VertexAttribute.BlendWeight: - attributes.WEIGHTS_0 = accessorId; - break; - case VertexAttribute.BlendIndices: - attributes.JOINTS_0 = accessorId; - break; - default: - throw new ArgumentOutOfRangeException(); - } - } - - var indexComponentType = uMesh.indexFormat == IndexFormat.UInt16 ? GltfComponentType.UnsignedShort : GltfComponentType.UnsignedInt; - mesh.primitives = new MeshPrimitive[uMesh.subMeshCount]; - var indexAccessors = new Accessor[uMesh.subMeshCount]; - var indexOffset = 0; - MeshTopology? topology = null; - var totalIndexCount = 0u; - for (var subMeshIndex = 0; subMeshIndex < uMesh.subMeshCount; subMeshIndex++) - { - var subMesh = uMesh.GetSubMesh(subMeshIndex); - if (!topology.HasValue) - { - topology = subMesh.topology; - } - else - { - Assert.AreEqual(topology.Value, subMesh.topology, "Mixed topologies are not supported!"); - } - var mode = GetDrawMode(subMesh.topology); - if (!mode.HasValue) - { - m_Logger?.Error(LogCode.TopologyUnsupported, subMesh.topology.ToString()); - mode = DrawMode.Points; - } - - var indexAccessor = new Accessor - { - byteOffset = indexOffset, - componentType = indexComponentType, - count = subMesh.indexCount, - - // min = new []{}, // TODO - // max = new []{}, // TODO - }; - indexAccessor.SetAttributeType(GltfAccessorAttributeType.SCALAR); - - if (subMesh.topology == MeshTopology.Quads) - { - indexAccessor.count = indexAccessor.count / 2 * 3; - } - - var indexAccessorId = AddAccessor(indexAccessor); - indexAccessors[subMeshIndex] = indexAccessor; - - indexOffset += indexAccessor.count * Accessor.GetComponentTypeSize(indexComponentType); - - mesh.primitives[subMeshIndex] = new MeshPrimitive - { - mode = mode.Value, - attributes = attributes, - indices = indexAccessorId, - }; - - totalIndexCount += uMesh.GetIndexCount(subMeshIndex); - } - Assert.IsTrue(topology.HasValue); - - Profiler.BeginSample("ExportIndices"); - int indexBufferViewId; - var totalFaceCount = topology == MeshTopology.Quads ? (uint)(totalIndexCount * 1.5) : totalIndexCount; - if (uMesh.indexFormat == IndexFormat.UInt16) - { - var destIndices = new NativeArray((int)totalFaceCount, Allocator.TempJob); - var offset = 0; - for (var subMeshIndex = 0; subMeshIndex < uMesh.subMeshCount; subMeshIndex++) - { - var indexData16 = uMesh.GetIndices(subMeshIndex); - switch (topology) - { - case MeshTopology.Triangles: - { - var triCount = indexData16.Length / 3; - for (var i = 0; i < triCount; i++) - { - destIndices[offset + i * 3] = (ushort)indexData16[i * 3]; - destIndices[offset + i * 3 + 1] = (ushort)indexData16[i * 3 + 2]; - destIndices[offset + i * 3 + 2] = (ushort)indexData16[i * 3 + 1]; - } - offset += indexData16.Length; - break; - } - case MeshTopology.Quads: - { - var quadCount = indexData16.Length / 4; - for (var i = 0; i < quadCount; i++) - { - destIndices[offset + i * 6 + 0] = (ushort)indexData16[i * 4 + 0]; - destIndices[offset + i * 6 + 1] = (ushort)indexData16[i * 4 + 2]; - destIndices[offset + i * 6 + 2] = (ushort)indexData16[i * 4 + 1]; - destIndices[offset + i * 6 + 3] = (ushort)indexData16[i * 4 + 2]; - destIndices[offset + i * 6 + 4] = (ushort)indexData16[i * 4 + 0]; - destIndices[offset + i * 6 + 5] = (ushort)indexData16[i * 4 + 3]; - } - offset += quadCount * 6; - break; - } - default: - { - for (var i = 0; i < indexData16.Length; i++) - { - destIndices[offset + i] = (ushort)indexData16[i]; - } - offset += indexData16.Length; - break; - } - } - } - indexBufferViewId = WriteBufferViewToBuffer( - destIndices.Reinterpret(sizeof(ushort)), - byteAlignment: sizeof(ushort) - ); - destIndices.Dispose(); - } - else - { - var destIndices = new NativeArray((int)totalFaceCount, Allocator.TempJob); - var offset = 0; - for (var subMeshIndex = 0; subMeshIndex < uMesh.subMeshCount; subMeshIndex++) - { - var indexData16 = uMesh.GetIndices(subMeshIndex); - switch (topology) - { - case MeshTopology.Triangles: - { - var triCount = indexData16.Length / 3; - for (var i = 0; i < triCount; i++) - { - destIndices[offset + i * 3] = (uint)indexData16[i * 3]; - destIndices[offset + i * 3 + 1] = (uint)indexData16[i * 3 + 2]; - destIndices[offset + i * 3 + 2] = (uint)indexData16[i * 3 + 1]; - } - offset += indexData16.Length; - break; - } - case MeshTopology.Quads: - { - var quadCount = indexData16.Length / 4; - for (var i = 0; i < quadCount; i++) - { - destIndices[offset + i * 6 + 0] = (uint)indexData16[i * 4 + 0]; - destIndices[offset + i * 6 + 1] = (uint)indexData16[i * 4 + 2]; - destIndices[offset + i * 6 + 2] = (uint)indexData16[i * 4 + 1]; - destIndices[offset + i * 6 + 3] = (uint)indexData16[i * 4 + 2]; - destIndices[offset + i * 6 + 4] = (uint)indexData16[i * 4 + 0]; - destIndices[offset + i * 6 + 5] = (uint)indexData16[i * 4 + 3]; - } - offset += quadCount * 6; - break; - } - default: - { - for (var i = 0; i < indexData16.Length; i++) - { - destIndices[offset + i] = (uint)indexData16[i]; - } - offset += indexData16.Length; - break; - } - } - } - indexBufferViewId = WriteBufferViewToBuffer( - destIndices.Reinterpret(sizeof(uint)), - byteAlignment: sizeof(uint) - ); - destIndices.Dispose(); - } - Profiler.EndSample(); - - foreach (var accessor in indexAccessors) - { - accessor.bufferView = indexBufferViewId; - } - - Profiler.BeginSample("ExportVertexAttributes"); - foreach (var pair in attrDataDict) - { - var vertexAttribute = pair.Key; - var attrData = pair.Value; - var bufferViewId = -1; - switch (vertexAttribute) - { - case VertexAttribute.Position: - { - var vertices = new List(); - uMesh.GetVertices(vertices); - var outStream = new NativeArray(vertices.Count, Allocator.TempJob); - for (var i = 0; i < vertices.Count; i++) - { - outStream[i] = new Vector3(-vertices[i].x, vertices[i].y, vertices[i].z); - } - bufferViewId = WriteBufferViewToBuffer( - outStream.Reinterpret(12), - 12 - ); - outStream.Dispose(); - break; - } - case VertexAttribute.Normal: - { - var normals = new List(); - uMesh.GetNormals(normals); - var outStream = new NativeArray(normals.Count, Allocator.TempJob); - for (var i = 0; i < normals.Count; i++) - { - outStream[i] = new Vector3(-normals[i].x, normals[i].y, normals[i].z); - } - bufferViewId = WriteBufferViewToBuffer( - outStream.Reinterpret(12), - 12 - ); - outStream.Dispose(); - break; - } - case VertexAttribute.Tangent: - { - var tangents = new List(); - uMesh.GetTangents(tangents); - var outStream = new NativeArray(tangents.Count, Allocator.TempJob); - for (var i = 0; i < tangents.Count; i++) - { - outStream[i] = new Vector4(tangents[i].x, tangents[i].y, -tangents[i].z, tangents[i].w); - } - bufferViewId = WriteBufferViewToBuffer( - outStream.Reinterpret(16), - 16 - ); - outStream.Dispose(); - break; - } - case VertexAttribute.Color: - { - var colors = new List(); - uMesh.GetColors(colors); - var outStream = new NativeArray(colors.Count, Allocator.TempJob); - for (var i = 0; i < colors.Count; i++) - { - outStream[i] = colors[i]; - } - bufferViewId = WriteBufferViewToBuffer( - outStream.Reinterpret(4), - 4 - ); - outStream.Dispose(); - break; - } - case VertexAttribute.TexCoord0: - case VertexAttribute.TexCoord1: - case VertexAttribute.TexCoord2: - case VertexAttribute.TexCoord3: - case VertexAttribute.TexCoord4: - case VertexAttribute.TexCoord5: - case VertexAttribute.TexCoord6: - case VertexAttribute.TexCoord7: - { - var uvs = new List(); - var channel = (int)vertexAttribute - (int)VertexAttribute.TexCoord0; - uMesh.GetUVs(channel, uvs); - var outStream = new NativeArray(uvs.Count, Allocator.TempJob); - for (var i = 0; i < uvs.Count; i++) - { - outStream[i] = new Vector2(uvs[i].x, 1 - uvs[i].y); - } - bufferViewId = WriteBufferViewToBuffer( - outStream.Reinterpret(8), - 8 - ); - outStream.Dispose(); - break; - } - case VertexAttribute.BlendWeight: - break; - case VertexAttribute.BlendIndices: - break; - } - m_Accessors[attrData.accessorId].bufferView = bufferViewId; - } - Profiler.EndSample(); - Profiler.EndSample(); - } - int AddAccessor(Accessor accessor) { m_Accessors = m_Accessors ?? new List(); @@ -1725,7 +1342,6 @@ int AddAccessor(Accessor accessor) m_Accessors.Add(accessor); return accessorId; } -#endif // #if GLTFAST_MESH_DATA async Task BakeImages(string directory) { @@ -1833,8 +1449,6 @@ bool GetUniqueFileName(ref string filename) return true; } -#if GLTFAST_MESH_DATA - static async Task ConvertPositionAttribute( AttributeData attrData, uint byteStride, @@ -1844,7 +1458,8 @@ NativeArray outputStream ) { var job = CreateConvertPositionAttributeJob(attrData, byteStride, vertexCount, inputStream, outputStream); - while (!job.IsCompleted) { + while (!job.IsCompleted) + { await Task.Yield(); } job.Complete(); @@ -1858,7 +1473,8 @@ static unsafe JobHandle CreateConvertPositionAttributeJob( NativeArray outputStream ) { - var job = new ExportJobs.ConvertPositionFloatJob { + var job = new ExportJobs.ConvertPositionFloatJob + { input = (byte*)inputStream.GetUnsafeReadOnlyPtr() + attrData.offset, byteStride = byteStride, output = (byte*)outputStream.GetUnsafePtr() + attrData.offset @@ -1875,7 +1491,8 @@ NativeArray outputStream ) { var job = CreateConvertTangentAttributeJob(attrData, byteStride, vertexCount, inputStream, outputStream); - while (!job.IsCompleted) { + while (!job.IsCompleted) + { await Task.Yield(); } job.Complete(); @@ -1887,8 +1504,10 @@ static unsafe JobHandle CreateConvertTangentAttributeJob( int vertexCount, NativeArray inputStream, NativeArray outputStream - ) { - var job = new ExportJobs.ConvertTangentFloatJob { + ) + { + var job = new ExportJobs.ConvertTangentFloatJob + { input = (byte*)inputStream.GetUnsafeReadOnlyPtr() + attrData.offset, byteStride = byteStride, output = (byte*)outputStream.GetUnsafePtr() + attrData.offset @@ -1902,9 +1521,11 @@ static async Task ConvertTexCoordAttribute( int vertexCount, NativeArray inputStream, NativeArray outputStream - ) { + ) + { var job = CreateConvertTexCoordAttributeJob(attrData, byteStride, vertexCount, inputStream, outputStream); - while (!job.IsCompleted) { + while (!job.IsCompleted) + { await Task.Yield(); } job.Complete(); @@ -1916,8 +1537,10 @@ static unsafe JobHandle CreateConvertTexCoordAttributeJob( int vertexCount, NativeArray inputStream, NativeArray outputStream - ) { - var job = new ExportJobs.ConvertTexCoordFloatJob { + ) + { + var job = new ExportJobs.ConvertTexCoordFloatJob + { input = (byte*)inputStream.GetUnsafeReadOnlyPtr() + attrData.offset, byteStride = byteStride, output = (byte*)outputStream.GetUnsafePtr() + attrData.offset @@ -1925,9 +1548,6 @@ NativeArray outputStream return job; } - -#endif // GLTFAST_MESH_DATA - static DrawMode? GetDrawMode(MeshTopology topology) { switch (topology) @@ -2150,9 +1770,10 @@ void Dispose() m_State = State.Disposed; } -#if GLTFAST_MESH_DATA - static unsafe int GetAttributeSize(VertexAttributeFormat format) { - switch (format) { + static unsafe int GetAttributeSize(VertexAttributeFormat format) + { + switch (format) + { case VertexAttributeFormat.Float32: return sizeof(float); case VertexAttributeFormat.Float16: @@ -2181,6 +1802,5 @@ static unsafe int GetAttributeSize(VertexAttributeFormat format) { throw new ArgumentOutOfRangeException(nameof(format), format, null); } } -#endif } } diff --git a/Runtime/Scripts/Loading/DefaultDownloadProvider.cs b/Runtime/Scripts/Loading/DefaultDownloadProvider.cs index d021ac13..28cf928f 100644 --- a/Runtime/Scripts/Loading/DefaultDownloadProvider.cs +++ b/Runtime/Scripts/Loading/DefaultDownloadProvider.cs @@ -101,11 +101,7 @@ public async Task WaitAsync() /// /// True if the download finished and was successful /// -#if UNITY_2020_1_OR_NEWER - public bool Success => m_Request!=null && m_Request.isDone && m_Request.result == UnityWebRequest.Result.Success; -#else - public bool Success => m_Request != null && m_Request.isDone && !m_Request.isNetworkError && !m_Request.isHttpError; -#endif + public bool Success => m_Request != null && m_Request.isDone && m_Request.result == UnityWebRequest.Result.Success; /// /// If the download failed, error description From bcaabda2a6a79f2a5349236d437a23a10826694c Mon Sep 17 00:00:00 2001 From: Andreas Atteneder Date: Mon, 6 May 2024 12:13:28 +0200 Subject: [PATCH 06/18] feat: glTFast shader based material export (#131) * feat: Support for exporting glTF shader based materials. * feat(test): AssertLogger that does not have expected log items/codes. * feat(test): Tests for GltfMaterialExporter. * refactor: Moved `UvTransform` into main assembly, due to it's generic usefulness. * feat: Material exporter is chosen based on used shader by default. * refactor: Removed redundant shader property identifiers. * refactor: Dedicated test files per render pipeline, since there are subtle differences. * doc: Added docs for glTF material export. fix: Replaced HTML tag superscript with Unicode chars. fix: Markdown removed table trailing pipes. * fix: StandardShaderMode is available, regardless of scripting defines/render pipeline usage. It's in its dedicated file now as well. * chore: Tracking *.jpg files with GIT LFS and converted existing textures. --- .gitattributes | 1 + CHANGELOG.md | 4 + Documentation~/KnownIssues.md | 10 +- Documentation~/features.md | 135 +++-- Documentation~/index.md | 4 +- Editor/Scripts/BuiltInShaderGUI.cs | 8 +- Editor/Scripts/ShaderGUIBase.cs | 28 +- Editor/Scripts/ShaderGraphGUI.cs | 5 +- .../GltfBuiltInShaderMaterialExporter.cs | 52 ++ .../GltfBuiltInShaderMaterialExporter.cs.meta | 3 + .../Export/GltfHdrpMaterialExporter.cs | 47 ++ .../Export/GltfHdrpMaterialExporter.cs.meta | 3 + .../Scripts/Export/GltfMaterialExporter.cs | 388 +++++++++++++++ .../Export/GltfMaterialExporter.cs.meta | 3 + .../Export/GltfShaderGraphMaterialExporter.cs | 72 +++ .../GltfShaderGraphMaterialExporter.cs.meta | 3 + .../Export/GltfUnlitMaterialExporter.cs | 96 ++++ .../Export/GltfUnlitMaterialExporter.cs.meta | 3 + Runtime/Scripts/Export/GltfWriter.cs | 1 - .../Export/HighDefinitionMaterialExport.cs | 6 +- Runtime/Scripts/Export/MaterialExport.cs | 36 +- Runtime/Scripts/Export/MaterialExportBase.cs | 25 +- Runtime/Scripts/Export/MetaMaterialExport.cs | 71 +++ .../Scripts/Export/MetaMaterialExport.cs.meta | 11 + .../Scripts/Export/StandardMaterialExport.cs | 9 +- Runtime/Scripts/Export/glTFast.Export.asmdef | 10 + .../Material/BuiltInMaterialGenerator.cs | 145 +++--- .../HighDefinitionRPMaterialGenerator.cs | 25 +- Runtime/Scripts/Material/MaterialGenerator.cs | 215 ++++---- Runtime/Scripts/Material/MaterialProperty.cs | 119 +++++ .../Scripts/Material/MaterialProperty.cs.meta | 11 + .../Material/ShaderGraphMaterialGenerator.cs | 72 +-- .../Scripts/Material/StandardShaderMode.cs | 30 ++ .../Material/StandardShaderMode.cs.meta | 3 + .../Material/UniveralRPMaterialGenerator.cs | 15 +- Runtime/Scripts/Schema/Skin.cs | 17 +- Runtime/Scripts/UvTransform.cs | 40 ++ Runtime/Scripts/UvTransform.cs.meta | 11 + Runtime/Scripts/glTFast.asmdef | 5 + Tests/Resources/Export.meta | 8 + Tests/Resources/Export/Materials.meta | 8 + .../Resources/Export/Materials/Built-In.meta | 8 + .../Export/Materials/Built-In/BaseColor.mat | 67 +++ .../Materials/Built-In/BaseColor.mat.meta | 8 + .../Materials/Built-In/BaseColorTexture.mat | 67 +++ .../Built-In/BaseColorTexture.mat.meta | 8 + .../Built-In/BaseColorTextureCutout.mat | 67 +++ .../Built-In/BaseColorTextureCutout.mat.meta | 8 + .../Built-In/BaseColorTextureRotated.mat | 67 +++ .../Built-In/BaseColorTextureRotated.mat.meta | 8 + .../Built-In/BaseColorTextureScaled.mat | 67 +++ .../Built-In/BaseColorTextureScaled.mat.meta | 8 + .../Built-In/BaseColorTextureTranslated.mat | 67 +++ .../BaseColorTextureTranslated.mat.meta | 8 + .../Built-In/BaseColorTextureTransparent.mat | 67 +++ .../BaseColorTextureTransparent.mat.meta | 8 + .../Export/Materials/Built-In/DoubleSided.mat | 67 +++ .../Materials/Built-In/DoubleSided.mat.meta | 8 + .../Materials/Built-In/EmissiveFactor.mat | 67 +++ .../Built-In/EmissiveFactor.mat.meta | 8 + .../Materials/Built-In/EmissiveTexture.mat | 67 +++ .../Built-In/EmissiveTexture.mat.meta | 8 + .../Built-In/EmissiveTextureFactor.mat | 67 +++ .../Built-In/EmissiveTextureFactor.mat.meta | 8 + .../Export/Materials/Built-In/Metallic.mat | 67 +++ .../Materials/Built-In/Metallic.mat.meta | 8 + .../MetallicRoughnessOcclusionTexture.mat | 67 +++ ...MetallicRoughnessOcclusionTexture.mat.meta | 8 + .../Built-In/MetallicRoughnessTexture.mat | 67 +++ .../MetallicRoughnessTexture.mat.meta | 8 + .../Materials/Built-In/MetallicTexture.mat | 67 +++ .../Built-In/MetallicTexture.mat.meta | 8 + .../Materials/Built-In/NormalTexture.mat | 67 +++ .../Materials/Built-In/NormalTexture.mat.meta | 8 + .../Export/Materials/Built-In/NotGltf.mat | 78 +++ .../Materials/Built-In/NotGltf.mat.meta | 8 + .../Materials/Built-In/OcclusionTexture.mat | 67 +++ .../Built-In/OcclusionTexture.mat.meta | 8 + .../Export/Materials/Built-In/Omni.mat | 67 +++ .../Export/Materials/Built-In/Omni.mat.meta | 8 + .../Materials/Built-In/RoughnessTexture.mat | 67 +++ .../Built-In/RoughnessTexture.mat.meta | 8 + Tests/Resources/Export/Materials/HDRP.meta | 8 + .../Export/Materials/HDRP/BaseColor.mat | 197 ++++++++ .../Export/Materials/HDRP/BaseColor.mat.meta | 8 + .../Materials/HDRP/BaseColorTexture.mat | 197 ++++++++ .../Materials/HDRP/BaseColorTexture.mat.meta | 8 + .../Materials/HDRP/BaseColorTextureCutout.mat | 196 ++++++++ .../HDRP/BaseColorTextureCutout.mat.meta | 8 + .../HDRP/BaseColorTextureRotated.mat | 198 ++++++++ .../HDRP/BaseColorTextureRotated.mat.meta | 8 + .../Materials/HDRP/BaseColorTextureScaled.mat | 198 ++++++++ .../HDRP/BaseColorTextureScaled.mat.meta | 8 + .../HDRP/BaseColorTextureTranslated.mat | 198 ++++++++ .../HDRP/BaseColorTextureTranslated.mat.meta | 8 + .../HDRP/BaseColorTextureTransparent.mat | 149 ++++++ .../HDRP/BaseColorTextureTransparent.mat.meta | 8 + .../Export/Materials/HDRP/DoubleSided.mat | 148 ++++++ .../Materials/HDRP/DoubleSided.mat.meta | 8 + .../Export/Materials/HDRP/EmissiveFactor.mat | 198 ++++++++ .../Materials/HDRP/EmissiveFactor.mat.meta | 8 + .../Export/Materials/HDRP/EmissiveTexture.mat | 198 ++++++++ .../Materials/HDRP/EmissiveTexture.mat.meta | 8 + .../Materials/HDRP/EmissiveTextureFactor.mat | 198 ++++++++ .../HDRP/EmissiveTextureFactor.mat.meta | 8 + .../Export/Materials/HDRP/Metallic.mat | 197 ++++++++ .../Export/Materials/HDRP/Metallic.mat.meta | 8 + .../MetallicRoughnessOcclusionTexture.mat | 197 ++++++++ ...MetallicRoughnessOcclusionTexture.mat.meta | 8 + .../HDRP/MetallicRoughnessTexture.mat | 197 ++++++++ .../HDRP/MetallicRoughnessTexture.mat.meta | 8 + .../Export/Materials/HDRP/MetallicTexture.mat | 197 ++++++++ .../Materials/HDRP/MetallicTexture.mat.meta | 8 + .../Export/Materials/HDRP/NormalTexture.mat | 198 ++++++++ .../Materials/HDRP/NormalTexture.mat.meta | 8 + .../Export/Materials/HDRP/NotGltf.mat | 209 ++++++++ .../Export/Materials/HDRP/NotGltf.mat.meta | 8 + .../Materials/HDRP/OcclusionTexture.mat | 197 ++++++++ .../Materials/HDRP/OcclusionTexture.mat.meta | 8 + .../Resources/Export/Materials/HDRP/Omni.mat | 199 ++++++++ .../Export/Materials/HDRP/Omni.mat.meta | 8 + .../Materials/HDRP/RoughnessTexture.mat | 197 ++++++++ .../Materials/HDRP/RoughnessTexture.mat.meta | 8 + .../Resources/Export/Materials/Textures.meta | 8 + .../Export/Materials/Textures/emissive.jpg | 3 + .../Materials/Textures/emissive.jpg.meta | 157 ++++++ .../Export/Materials/Textures/metallic.jpg | 3 + .../Materials/Textures/metallic.jpg.meta | 157 ++++++ .../Export/Materials/Textures/normal.png | 3 + .../Export/Materials/Textures/normal.png.meta | 157 ++++++ .../occlusion-roughness-metallness.jpg | 3 + .../occlusion-roughness-metallness.jpg.meta | 157 ++++++ .../Export/Materials/Textures/occlusion.jpg | 3 + .../Materials/Textures/occlusion.jpg.meta | 157 ++++++ .../Export/Materials/Textures/roughness.jpg | 3 + .../Materials/Textures/roughness.jpg.meta | 157 ++++++ Tests/Resources/Export/Materials/URP.meta | 8 + .../Export/Materials/URP/BaseColor.mat | 197 ++++++++ .../Export/Materials/URP/BaseColor.mat.meta | 8 + .../Export/Materials/URP/BaseColorTexture.mat | 197 ++++++++ .../Materials/URP/BaseColorTexture.mat.meta | 8 + .../Materials/URP/BaseColorTextureCutout.mat | 135 +++++ .../URP/BaseColorTextureCutout.mat.meta | 8 + .../Materials/URP/BaseColorTextureRotated.mat | 198 ++++++++ .../URP/BaseColorTextureRotated.mat.meta | 8 + .../Materials/URP/BaseColorTextureScaled.mat | 198 ++++++++ .../URP/BaseColorTextureScaled.mat.meta | 8 + .../URP/BaseColorTextureTranslated.mat | 198 ++++++++ .../URP/BaseColorTextureTranslated.mat.meta | 8 + .../URP/BaseColorTextureTransparent.mat | 144 ++++++ .../URP/BaseColorTextureTransparent.mat.meta | 8 + .../Export/Materials/URP/DoubleSided.mat | 136 +++++ .../Export/Materials/URP/DoubleSided.mat.meta | 8 + .../Export/Materials/URP/EmissiveFactor.mat | 198 ++++++++ .../Materials/URP/EmissiveFactor.mat.meta | 8 + .../Export/Materials/URP/EmissiveTexture.mat | 198 ++++++++ .../Materials/URP/EmissiveTexture.mat.meta | 8 + .../Materials/URP/EmissiveTextureFactor.mat | 198 ++++++++ .../URP/EmissiveTextureFactor.mat.meta | 8 + .../Export/Materials/URP/Metallic.mat | 197 ++++++++ .../Export/Materials/URP/Metallic.mat.meta | 8 + .../URP/MetallicRoughnessOcclusionTexture.mat | 197 ++++++++ ...MetallicRoughnessOcclusionTexture.mat.meta | 8 + .../URP/MetallicRoughnessTexture.mat | 197 ++++++++ .../URP/MetallicRoughnessTexture.mat.meta | 8 + .../Export/Materials/URP/MetallicTexture.mat | 197 ++++++++ .../Materials/URP/MetallicTexture.mat.meta | 8 + .../Export/Materials/URP/NormalTexture.mat | 198 ++++++++ .../Materials/URP/NormalTexture.mat.meta | 8 + .../Export/Materials/URP/NotGltf.mat | 209 ++++++++ .../Export/Materials/URP/NotGltf.mat.meta | 8 + .../Export/Materials/URP/OcclusionTexture.mat | 197 ++++++++ .../Materials/URP/OcclusionTexture.mat.meta | 8 + Tests/Resources/Export/Materials/URP/Omni.mat | 199 ++++++++ .../Export/Materials/URP/Omni.mat.meta | 8 + .../Export/Materials/URP/RoughnessTexture.mat | 197 ++++++++ .../Materials/URP/RoughnessTexture.mat.meta | 8 + .../GltfBuiltInShaderMaterialExporterTests.cs | 145 ++++++ ...BuiltInShaderMaterialExporterTests.cs.meta | 11 + .../Export/GltfHdrpMaterialExporterTests.cs | 191 +++++++ .../GltfHdrpMaterialExporterTests.cs.meta | 11 + .../GltfShaderGraphMaterialExporterTests.cs | 191 +++++++ ...tfShaderGraphMaterialExporterTests.cs.meta | 11 + .../Scripts/Export/GltfWritableMock.cs | 154 ++++++ .../Scripts/Export/GltfWritableMock.cs.meta | 3 + .../Scripts/Export/MaterialExportTests.cs | 470 ++++++++++++++++++ .../Export/MaterialExportTests.cs.meta | 11 + Tests/Runtime/Scripts/LoggerTest.cs | 67 ++- Tests/Runtime/Scripts/glTFast.Tests.asmdef | 22 +- 189 files changed, 13142 insertions(+), 374 deletions(-) create mode 100644 Runtime/Scripts/Export/GltfBuiltInShaderMaterialExporter.cs create mode 100644 Runtime/Scripts/Export/GltfBuiltInShaderMaterialExporter.cs.meta create mode 100644 Runtime/Scripts/Export/GltfHdrpMaterialExporter.cs create mode 100644 Runtime/Scripts/Export/GltfHdrpMaterialExporter.cs.meta create mode 100644 Runtime/Scripts/Export/GltfMaterialExporter.cs create mode 100644 Runtime/Scripts/Export/GltfMaterialExporter.cs.meta create mode 100644 Runtime/Scripts/Export/GltfShaderGraphMaterialExporter.cs create mode 100644 Runtime/Scripts/Export/GltfShaderGraphMaterialExporter.cs.meta create mode 100644 Runtime/Scripts/Export/GltfUnlitMaterialExporter.cs create mode 100644 Runtime/Scripts/Export/GltfUnlitMaterialExporter.cs.meta create mode 100644 Runtime/Scripts/Export/MetaMaterialExport.cs create mode 100644 Runtime/Scripts/Export/MetaMaterialExport.cs.meta create mode 100644 Runtime/Scripts/Material/MaterialProperty.cs create mode 100644 Runtime/Scripts/Material/MaterialProperty.cs.meta create mode 100644 Runtime/Scripts/Material/StandardShaderMode.cs create mode 100644 Runtime/Scripts/Material/StandardShaderMode.cs.meta create mode 100644 Runtime/Scripts/UvTransform.cs create mode 100644 Runtime/Scripts/UvTransform.cs.meta create mode 100644 Tests/Resources/Export.meta create mode 100644 Tests/Resources/Export/Materials.meta create mode 100644 Tests/Resources/Export/Materials/Built-In.meta create mode 100644 Tests/Resources/Export/Materials/Built-In/BaseColor.mat create mode 100644 Tests/Resources/Export/Materials/Built-In/BaseColor.mat.meta create mode 100644 Tests/Resources/Export/Materials/Built-In/BaseColorTexture.mat create mode 100644 Tests/Resources/Export/Materials/Built-In/BaseColorTexture.mat.meta create mode 100644 Tests/Resources/Export/Materials/Built-In/BaseColorTextureCutout.mat create mode 100644 Tests/Resources/Export/Materials/Built-In/BaseColorTextureCutout.mat.meta create mode 100644 Tests/Resources/Export/Materials/Built-In/BaseColorTextureRotated.mat create mode 100644 Tests/Resources/Export/Materials/Built-In/BaseColorTextureRotated.mat.meta create mode 100644 Tests/Resources/Export/Materials/Built-In/BaseColorTextureScaled.mat create mode 100644 Tests/Resources/Export/Materials/Built-In/BaseColorTextureScaled.mat.meta create mode 100644 Tests/Resources/Export/Materials/Built-In/BaseColorTextureTranslated.mat create mode 100644 Tests/Resources/Export/Materials/Built-In/BaseColorTextureTranslated.mat.meta create mode 100644 Tests/Resources/Export/Materials/Built-In/BaseColorTextureTransparent.mat create mode 100644 Tests/Resources/Export/Materials/Built-In/BaseColorTextureTransparent.mat.meta create mode 100644 Tests/Resources/Export/Materials/Built-In/DoubleSided.mat create mode 100644 Tests/Resources/Export/Materials/Built-In/DoubleSided.mat.meta create mode 100644 Tests/Resources/Export/Materials/Built-In/EmissiveFactor.mat create mode 100644 Tests/Resources/Export/Materials/Built-In/EmissiveFactor.mat.meta create mode 100644 Tests/Resources/Export/Materials/Built-In/EmissiveTexture.mat create mode 100644 Tests/Resources/Export/Materials/Built-In/EmissiveTexture.mat.meta create mode 100644 Tests/Resources/Export/Materials/Built-In/EmissiveTextureFactor.mat create mode 100644 Tests/Resources/Export/Materials/Built-In/EmissiveTextureFactor.mat.meta create mode 100644 Tests/Resources/Export/Materials/Built-In/Metallic.mat create mode 100644 Tests/Resources/Export/Materials/Built-In/Metallic.mat.meta create mode 100644 Tests/Resources/Export/Materials/Built-In/MetallicRoughnessOcclusionTexture.mat create mode 100644 Tests/Resources/Export/Materials/Built-In/MetallicRoughnessOcclusionTexture.mat.meta create mode 100644 Tests/Resources/Export/Materials/Built-In/MetallicRoughnessTexture.mat create mode 100644 Tests/Resources/Export/Materials/Built-In/MetallicRoughnessTexture.mat.meta create mode 100644 Tests/Resources/Export/Materials/Built-In/MetallicTexture.mat create mode 100644 Tests/Resources/Export/Materials/Built-In/MetallicTexture.mat.meta create mode 100644 Tests/Resources/Export/Materials/Built-In/NormalTexture.mat create mode 100644 Tests/Resources/Export/Materials/Built-In/NormalTexture.mat.meta create mode 100644 Tests/Resources/Export/Materials/Built-In/NotGltf.mat create mode 100644 Tests/Resources/Export/Materials/Built-In/NotGltf.mat.meta create mode 100644 Tests/Resources/Export/Materials/Built-In/OcclusionTexture.mat create mode 100644 Tests/Resources/Export/Materials/Built-In/OcclusionTexture.mat.meta create mode 100644 Tests/Resources/Export/Materials/Built-In/Omni.mat create mode 100644 Tests/Resources/Export/Materials/Built-In/Omni.mat.meta create mode 100644 Tests/Resources/Export/Materials/Built-In/RoughnessTexture.mat create mode 100644 Tests/Resources/Export/Materials/Built-In/RoughnessTexture.mat.meta create mode 100644 Tests/Resources/Export/Materials/HDRP.meta create mode 100644 Tests/Resources/Export/Materials/HDRP/BaseColor.mat create mode 100644 Tests/Resources/Export/Materials/HDRP/BaseColor.mat.meta create mode 100644 Tests/Resources/Export/Materials/HDRP/BaseColorTexture.mat create mode 100644 Tests/Resources/Export/Materials/HDRP/BaseColorTexture.mat.meta create mode 100644 Tests/Resources/Export/Materials/HDRP/BaseColorTextureCutout.mat create mode 100644 Tests/Resources/Export/Materials/HDRP/BaseColorTextureCutout.mat.meta create mode 100644 Tests/Resources/Export/Materials/HDRP/BaseColorTextureRotated.mat create mode 100644 Tests/Resources/Export/Materials/HDRP/BaseColorTextureRotated.mat.meta create mode 100644 Tests/Resources/Export/Materials/HDRP/BaseColorTextureScaled.mat create mode 100644 Tests/Resources/Export/Materials/HDRP/BaseColorTextureScaled.mat.meta create mode 100644 Tests/Resources/Export/Materials/HDRP/BaseColorTextureTranslated.mat create mode 100644 Tests/Resources/Export/Materials/HDRP/BaseColorTextureTranslated.mat.meta create mode 100644 Tests/Resources/Export/Materials/HDRP/BaseColorTextureTransparent.mat create mode 100644 Tests/Resources/Export/Materials/HDRP/BaseColorTextureTransparent.mat.meta create mode 100644 Tests/Resources/Export/Materials/HDRP/DoubleSided.mat create mode 100644 Tests/Resources/Export/Materials/HDRP/DoubleSided.mat.meta create mode 100644 Tests/Resources/Export/Materials/HDRP/EmissiveFactor.mat create mode 100644 Tests/Resources/Export/Materials/HDRP/EmissiveFactor.mat.meta create mode 100644 Tests/Resources/Export/Materials/HDRP/EmissiveTexture.mat create mode 100644 Tests/Resources/Export/Materials/HDRP/EmissiveTexture.mat.meta create mode 100644 Tests/Resources/Export/Materials/HDRP/EmissiveTextureFactor.mat create mode 100644 Tests/Resources/Export/Materials/HDRP/EmissiveTextureFactor.mat.meta create mode 100644 Tests/Resources/Export/Materials/HDRP/Metallic.mat create mode 100644 Tests/Resources/Export/Materials/HDRP/Metallic.mat.meta create mode 100644 Tests/Resources/Export/Materials/HDRP/MetallicRoughnessOcclusionTexture.mat create mode 100644 Tests/Resources/Export/Materials/HDRP/MetallicRoughnessOcclusionTexture.mat.meta create mode 100644 Tests/Resources/Export/Materials/HDRP/MetallicRoughnessTexture.mat create mode 100644 Tests/Resources/Export/Materials/HDRP/MetallicRoughnessTexture.mat.meta create mode 100644 Tests/Resources/Export/Materials/HDRP/MetallicTexture.mat create mode 100644 Tests/Resources/Export/Materials/HDRP/MetallicTexture.mat.meta create mode 100644 Tests/Resources/Export/Materials/HDRP/NormalTexture.mat create mode 100644 Tests/Resources/Export/Materials/HDRP/NormalTexture.mat.meta create mode 100644 Tests/Resources/Export/Materials/HDRP/NotGltf.mat create mode 100644 Tests/Resources/Export/Materials/HDRP/NotGltf.mat.meta create mode 100644 Tests/Resources/Export/Materials/HDRP/OcclusionTexture.mat create mode 100644 Tests/Resources/Export/Materials/HDRP/OcclusionTexture.mat.meta create mode 100644 Tests/Resources/Export/Materials/HDRP/Omni.mat create mode 100644 Tests/Resources/Export/Materials/HDRP/Omni.mat.meta create mode 100644 Tests/Resources/Export/Materials/HDRP/RoughnessTexture.mat create mode 100644 Tests/Resources/Export/Materials/HDRP/RoughnessTexture.mat.meta create mode 100644 Tests/Resources/Export/Materials/Textures.meta create mode 100644 Tests/Resources/Export/Materials/Textures/emissive.jpg create mode 100644 Tests/Resources/Export/Materials/Textures/emissive.jpg.meta create mode 100644 Tests/Resources/Export/Materials/Textures/metallic.jpg create mode 100644 Tests/Resources/Export/Materials/Textures/metallic.jpg.meta create mode 100644 Tests/Resources/Export/Materials/Textures/normal.png create mode 100644 Tests/Resources/Export/Materials/Textures/normal.png.meta create mode 100644 Tests/Resources/Export/Materials/Textures/occlusion-roughness-metallness.jpg create mode 100644 Tests/Resources/Export/Materials/Textures/occlusion-roughness-metallness.jpg.meta create mode 100644 Tests/Resources/Export/Materials/Textures/occlusion.jpg create mode 100644 Tests/Resources/Export/Materials/Textures/occlusion.jpg.meta create mode 100644 Tests/Resources/Export/Materials/Textures/roughness.jpg create mode 100644 Tests/Resources/Export/Materials/Textures/roughness.jpg.meta create mode 100644 Tests/Resources/Export/Materials/URP.meta create mode 100644 Tests/Resources/Export/Materials/URP/BaseColor.mat create mode 100644 Tests/Resources/Export/Materials/URP/BaseColor.mat.meta create mode 100644 Tests/Resources/Export/Materials/URP/BaseColorTexture.mat create mode 100644 Tests/Resources/Export/Materials/URP/BaseColorTexture.mat.meta create mode 100644 Tests/Resources/Export/Materials/URP/BaseColorTextureCutout.mat create mode 100644 Tests/Resources/Export/Materials/URP/BaseColorTextureCutout.mat.meta create mode 100644 Tests/Resources/Export/Materials/URP/BaseColorTextureRotated.mat create mode 100644 Tests/Resources/Export/Materials/URP/BaseColorTextureRotated.mat.meta create mode 100644 Tests/Resources/Export/Materials/URP/BaseColorTextureScaled.mat create mode 100644 Tests/Resources/Export/Materials/URP/BaseColorTextureScaled.mat.meta create mode 100644 Tests/Resources/Export/Materials/URP/BaseColorTextureTranslated.mat create mode 100644 Tests/Resources/Export/Materials/URP/BaseColorTextureTranslated.mat.meta create mode 100644 Tests/Resources/Export/Materials/URP/BaseColorTextureTransparent.mat create mode 100644 Tests/Resources/Export/Materials/URP/BaseColorTextureTransparent.mat.meta create mode 100644 Tests/Resources/Export/Materials/URP/DoubleSided.mat create mode 100644 Tests/Resources/Export/Materials/URP/DoubleSided.mat.meta create mode 100644 Tests/Resources/Export/Materials/URP/EmissiveFactor.mat create mode 100644 Tests/Resources/Export/Materials/URP/EmissiveFactor.mat.meta create mode 100644 Tests/Resources/Export/Materials/URP/EmissiveTexture.mat create mode 100644 Tests/Resources/Export/Materials/URP/EmissiveTexture.mat.meta create mode 100644 Tests/Resources/Export/Materials/URP/EmissiveTextureFactor.mat create mode 100644 Tests/Resources/Export/Materials/URP/EmissiveTextureFactor.mat.meta create mode 100644 Tests/Resources/Export/Materials/URP/Metallic.mat create mode 100644 Tests/Resources/Export/Materials/URP/Metallic.mat.meta create mode 100644 Tests/Resources/Export/Materials/URP/MetallicRoughnessOcclusionTexture.mat create mode 100644 Tests/Resources/Export/Materials/URP/MetallicRoughnessOcclusionTexture.mat.meta create mode 100644 Tests/Resources/Export/Materials/URP/MetallicRoughnessTexture.mat create mode 100644 Tests/Resources/Export/Materials/URP/MetallicRoughnessTexture.mat.meta create mode 100644 Tests/Resources/Export/Materials/URP/MetallicTexture.mat create mode 100644 Tests/Resources/Export/Materials/URP/MetallicTexture.mat.meta create mode 100644 Tests/Resources/Export/Materials/URP/NormalTexture.mat create mode 100644 Tests/Resources/Export/Materials/URP/NormalTexture.mat.meta create mode 100644 Tests/Resources/Export/Materials/URP/NotGltf.mat create mode 100644 Tests/Resources/Export/Materials/URP/NotGltf.mat.meta create mode 100644 Tests/Resources/Export/Materials/URP/OcclusionTexture.mat create mode 100644 Tests/Resources/Export/Materials/URP/OcclusionTexture.mat.meta create mode 100644 Tests/Resources/Export/Materials/URP/Omni.mat create mode 100644 Tests/Resources/Export/Materials/URP/Omni.mat.meta create mode 100644 Tests/Resources/Export/Materials/URP/RoughnessTexture.mat create mode 100644 Tests/Resources/Export/Materials/URP/RoughnessTexture.mat.meta create mode 100644 Tests/Runtime/Scripts/Export/GltfBuiltInShaderMaterialExporterTests.cs create mode 100644 Tests/Runtime/Scripts/Export/GltfBuiltInShaderMaterialExporterTests.cs.meta create mode 100644 Tests/Runtime/Scripts/Export/GltfHdrpMaterialExporterTests.cs create mode 100644 Tests/Runtime/Scripts/Export/GltfHdrpMaterialExporterTests.cs.meta create mode 100644 Tests/Runtime/Scripts/Export/GltfShaderGraphMaterialExporterTests.cs create mode 100644 Tests/Runtime/Scripts/Export/GltfShaderGraphMaterialExporterTests.cs.meta create mode 100644 Tests/Runtime/Scripts/Export/GltfWritableMock.cs create mode 100644 Tests/Runtime/Scripts/Export/GltfWritableMock.cs.meta create mode 100644 Tests/Runtime/Scripts/Export/MaterialExportTests.cs create mode 100644 Tests/Runtime/Scripts/Export/MaterialExportTests.cs.meta diff --git a/.gitattributes b/.gitattributes index 63a8bc19..db32d91e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,3 +3,4 @@ *.glb filter=lfs diff=lfs merge=lfs -text *.bin filter=lfs diff=lfs merge=lfs -text *.gif filter=lfs diff=lfs merge=lfs -text +*.jpg filter=lfs diff=lfs merge=lfs -text diff --git a/CHANGELOG.md b/CHANGELOG.md index fdaa0cb7..4f044bc8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] - ### Added +- (Export) Support for exporting glTFast shader based materials. This reduces data loss on import-export round trips considerably. - Dependency on [Unity Collections package][Collections]. - Added Apple Privacy Manifest documentation. @@ -17,6 +18,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Soft dependency on deprecated [Unity Jobs package][JobsPkg]. - Legacy code for Unity versions older than the minimum required 2020 LTS. +### Changed +- Material exporter implementation is chosen based on used shader by default. + ## [6.4.0] - 2024-04-17 ### Added diff --git a/Documentation~/KnownIssues.md b/Documentation~/KnownIssues.md index ad7f5c9f..d81e7471 100644 --- a/Documentation~/KnownIssues.md +++ b/Documentation~/KnownIssues.md @@ -1,12 +1,12 @@ # Known Issues -- 1Vertex accessors (positions, normals, etc.) that are used across meshes are duplicated and result in higher memory usage and slower loading (see [this comment](https://github.com/atteneder/glTFast/issues/52#issuecomment-583837852)) -- 1When using more than one sampler on one image, that image is duplicated and results in higher memory usage +- ¹Vertex accessors (positions, normals, etc.) that are used across meshes are duplicated and result in higher memory usage and slower loading (see [this comment](https://github.com/atteneder/glTFast/issues/52#issuecomment-583837852)) +- ¹When using more than one sampler on one image, that image is duplicated and results in higher memory usage - Texture sampler minification/magnification filter limitations (see [issue][SamplerFilter]): - - 1There's no differentiation between `minFilter` and `magFilter`. `minFilter` settings are prioritized. - - 1`minFilter` mode `NEAREST_MIPMAP_LINEAR` is not supported and will result in `NEAREST`. + - ¹There's no differentiation between `minFilter` and `magFilter`. `minFilter` settings are prioritized. + - ¹`minFilter` mode `NEAREST_MIPMAP_LINEAR` is not supported and will result in `NEAREST`. -1: A Unity API limitation. +¹: A Unity API limitation. ## Trademarks diff --git a/Documentation~/features.md b/Documentation~/features.md index 250d2e07..9ad98473 100644 --- a/Documentation~/features.md +++ b/Documentation~/features.md @@ -7,13 +7,13 @@ | | | | **GameObject** | Import | ✅️ | ✅ -| Export | 1☑️ | 1 ☑️ +| Export | ¹☑️ | ¹ ☑️ | | | | **Entities (see [DOTS](#data-oriented-technology-stack))** | Import | [☑️](#data-oriented-technology-stack) | `n/a` | Export | | `n/a` -1: Experimental. Core features missing +¹: Experimental. Core features missing ## Core glTF™ features @@ -55,7 +55,7 @@ The glTF 2.0 specification is fully supported, with only a few minor remarks. | POINTS | ✅ | ✅ | LINES | ✅ | ✅ | LINE_STRIP | ✅ | ✅ -| 1LINE_LOOP | ✅ | ✅ +| ¹LINE_LOOP | ✅ | ✅ | TRIANGLE_STRIP | | | TRIANGLE_FAN | | | Quads | `n/a` | ✅ via triangulation @@ -65,7 +65,7 @@ The glTF 2.0 specification is fully supported, with only a few minor remarks. | Normals | ✅ | ✅ | Tangents | ✅ | ✅ | Texture coordinates / UV sets | ✅ | `?` -| Three or more texture coordinates / UV sets | 2☑️ | `?` +| Three or more texture coordinates / UV sets | ²☑️ | `?` | Vertex colors | ✅ | `?` | Draco™ mesh compression (via [DracoForUnity]) | ✅ | ✅ | Implicit (no) indices | ✅ | @@ -74,7 +74,7 @@ The glTF 2.0 specification is fully supported, with only a few minor remarks. | Weights (up to 4 per vertex) | ✅ | | | | | **Morph Targets / Blend Shapes** -| Sparse accessors | 3 ✅ | +| Sparse accessors | ³ ✅ | | [Skins][Skins] | ✅ | | | | | **Animation** @@ -82,11 +82,11 @@ The glTF 2.0 specification is fully supported, with only a few minor remarks. | via Playable API ([issue][AnimationPlayables]) | | | via Mecanim ([issue][AnimationMecanim]) | | -1: Untested due to lack of demo files. +¹: Untested due to lack of demo files. -2: Up to eight UV sets can imported, but *Unity glTFast* shaders only support two (see [issue][UVsets]). +²: Up to eight UV sets can imported, but *Unity glTFast* shaders only support two (see [issue][UVsets]). -3: Not on all accessor types; morph targets and vertex positions only +³: Not on all accessor types; morph targets and vertex positions only ## Extensions @@ -113,11 +113,11 @@ The glTF 2.0 specification is fully supported, with only a few minor remarks. | KHR_xmp_json_ld |️ | | | | | **Vendor** -| 1EXT_mesh_gpu_instancing | ✅ | +| ¹EXT_mesh_gpu_instancing | ✅ | | EXT_meshopt_compression | ✅ | | EXT_lights_image_based | [ℹ️][IBL] | -1: Without support for custom vertex attributes (e.g. `_ID`) +¹: Without support for custom vertex attributes (e.g. `_ID`) Not investigated yet: @@ -150,8 +150,8 @@ See [glTFast Add-on API](UseCaseCustomExtras.md) for an example to import the `e | Material Feature | URP | HDRP | Built-In | |-------------------------------|-----|------|----------| -| PBR1 Metallic-Roughness | ✅ | ✅ | ✅ | -| PBR1 Specular-Glossiness | ✅ | ✅ | ✅ | +| PBR¹ Metallic-Roughness | ✅ | ✅ | ✅ | +| PBR¹ Specular-Glossiness | ✅ | ✅ | ✅ | | Unlit | ✅ | ✅ | ✅ | | Normal texture | ✅ | ✅ | ✅ | | Occlusion texture | ✅ | ✅ | ✅ | @@ -159,30 +159,36 @@ See [glTFast Add-on API](UseCaseCustomExtras.md) for an example to import the `e | Alpha modes OPAQUE/MASK/BLEND | ✅ | ✅ | ✅ | | Double sided / Two sided | ✅ | ✅ | ✅ | | Vertex colors | ✅ | ✅ | ✅ | -| Multiple UV sets | ✅2 | ✅2 | ✅2 | +| Multiple UV sets | ✅² | ✅² | ✅² | | Texture Transform | ✅ | ✅ | ✅ | -| Clear coat | ☑️3 | ✅ | [⛔️][ClearCoat] | +| Clear coat | ☑️³ | ✅ | [⛔️][ClearCoat] | | Sheen | [ℹ️][Sheen] | [ℹ️][Sheen] | [⛔️][Sheen] | -| Transmission | [☑️][Transmission]4 | [☑️][Transmission]5 | [☑️][Transmission]5 | +| Transmission | [☑️][Transmission]⁴ | [☑️][Transmission]⁵ | [☑️][Transmission]⁵ | | Variants | [ℹ️][Variants] | [ℹ️][Variants] | [ℹ️][Variants] | | IOR | [ℹ️][IOR] | [ℹ️][IOR] | [⛔️][IOR] | | Specular | [ℹ️][Specular] | [ℹ️][Specular] | [⛔️][Specular] | | Volume | [ℹ️][Volume] | [ℹ️][Volume] | [⛔️][Volume] | | Point clouds | | | Unlit only | -1: Physically-Based Rendering (PBR) material model +¹: Physically-Based Rendering (PBR) material model -2: Two sets of texture coordinates (as required by the glTF 2.0 specification) are supported, but not three or more ([issue][UVSets]) +²: Two sets of texture coordinates (as required by the glTF 2.0 specification) are supported, but not three or more ([issue][UVSets]) -3: Only supports Universal Render Pipeline versions >= 12.0; Only coat mask and smoothness are supported, other coat related properties, such as coat normal, are not supported +³: Only supports Universal Render Pipeline versions >= 12.0; Only coat mask and smoothness are supported, other coat related properties, such as coat normal, are not supported -4: There are two approximation implementations for transmission in Universal render pipeline. If the Opaque Texture is enabled (in the Universal RP Asset settings), it is sampled to provide proper transmissive filtering. The downside of this approach is transparent objects are not rendered on top of each other. If the opaque texture is not available, the common approximation (see 4 below) is used. +⁴: There are two approximation implementations for transmission in Universal render pipeline. If the Opaque Texture is enabled (in the Universal RP Asset settings), it is sampled to provide proper transmissive filtering. The downside of this approach is transparent objects are not rendered on top of each other. If the opaque texture is not available, the common approximation (see ⁴ below) is used. -5: Transmission in Built-In and HD render pipeline does not support transmission textures and is only 100% correct in certain cases like clear glass (100% transmission, white base color). Otherwise it's an approximation. +⁵: Transmission in Built-In and HD render pipeline does not support transmission textures and is only 100% correct in certain cases like clear glass (100% transmission, white base color). Otherwise it's an approximation. ### Material Export -Material export is currently only tested on the following shaders: +Material export support depends largely on the shaders used. We differentiate between Unity shaders (default shaders of Unity render pipelines) and glTFast's own shaders. + +#### Unity Shaders + +Unity shaders are typically used on pre-existing assets. + +Supported Unity shaders: - Universal and High Definition render pipeline - `Lit` @@ -193,32 +199,67 @@ Material export is currently only tested on the following shaders: Other shaders might (partially) work if they have similar properties (with identical names). -| Material Feature | URP1 | HDRP2 | Built-In3 | -|-------------------------------|-----|------|----------| -| PBR Metallic-Roughness | ✅ | ✅ | ✅ | -| PBR Specular-Glossiness | | | | -| Unlit | ✅ | ✅ | ✅ | -| Normal texture | ✅ | ✅ | ✅ | -| Occlusion texture | ✅ | ✅ | ✅ | -| Emission texture | ✅ | ✅ | ✅ | -| Alpha modes OPAQUE/MASK/BLEND | ✅ | ✅ | ✅ | -| Double sided / Two sided | ✅ | ✅ | ✅ | -| Vertex colors | `?` | `?` | `?` | -| Multiple UV sets | `?` | `?` | `?` | -| Texture Transform | ✅ | ✅ | ✅ | -| Clear coat | `n/a` | ✅ | `n/a` | -| Sheen | `?` | `?` | `n/a` | -| Transmission | | | `n/a` | -| Variants | | | | -| IOR | | | `n/a` | -| Specular | | | | -| Volume | | | `n/a` | - -1: Universal Render Pipeline Lit Shader - -2: High Definition Render Pipeline Lit Shader - -3: Built-In Render Pipeline Standard and Unlit Shader +| Material Feature | URP¹ | HDRP² | Built-In³ +|-------------------------------|-----|------|---------- +| PBR Metallic-Roughness | ✅ | ✅ | ✅ +| PBR Specular-Glossiness | | |  +| Unlit | ✅ | ✅ | ✅ +| Normal texture | ✅ | ✅ | ✅ +| Occlusion texture | ✅ | ✅ | ✅ +| Emission texture | ✅ | ✅ | ✅ +| Alpha modes OPAQUE/MASK/BLEND | ✅ | ✅ | ✅ +| Double sided / Two sided | ✅ | ✅ | ✅ +| Vertex colors | ✅⁴ | ✅⁴ | ✅⁴ +| Texture Transform | ✅ | ✅ | ✅ +| Clear coat | `n/a` | ✅ | `n/a` +| Sheen | `?` | `?` | `n/a` +| Transmission | | | `n/a` +| IOR | | | `n/a` +| Specular | | |  +| Volume | | | `n/a` + +¹: Universal Render Pipeline Lit Shader + +²: High Definition Render Pipeline Lit Shader + +³: Built-In Render Pipeline Standard and Unlit Shader + +⁴: Vertex colors are always exported, regardless whether the shader makes use of them. + +#### glTFast Shaders + +glTFast's own shaders are typically used when the assets were imported with glTFast. This enables round-trip import-export workflows. They are also the preferred way to author assets for glTF export specifically. + +Supported glTFast shaders/shader graphs: + +- Shader Graphs + - [x] `Shader Graphs/glTF-pbrMetallicRoughness` + - [x] `Shader Graphs/glTF-unlit` + - [ ] `Shader Graphs/glTF-pbrSpecularGlossiness` + - [ ] Legacy shader graphs (in folder `Runtime/Shader/Legacy`; used for Universal Render Pipeline 10.x and older) +- Shaders + - [x] `glTF/PbrMetallicRoughness` + - [x] `glTF/Unlit` + - [ ] `glTF/PbrSpecularGlossiness` + +| Material Feature | URP | HDRP | Built-In +|-------------------------------|-----|------|---------- +| Normal texture | ✅ | ✅ | ✅ +| Occlusion texture | ✅ | ✅ | ✅ +| Emission texture | ✅ | ✅ | ✅ +| Alpha modes OPAQUE/MASK/BLEND | ✅ | ✅ | ✅ +| Double sided / Two sided | ✅ | ✅ | ✅ +| Vertex colors | ✅ | ✅ | ✅ +| Multiple UV sets | ✅¹ | ✅¹ | ✅¹ +| Texture Transform | ✅ | ✅ | ✅ +| Clear coat | `n/a` | | `n/a` +| Sheen | `?` | `?` | `n/a` +| Transmission | | | `n/a` +| IOR | | | `n/a` +| Specular | | |  +| Volume | | | `n/a` + +¹: Only two UV sets are supported by the shaders. ## Data-Oriented Technology Stack diff --git a/Documentation~/index.md b/Documentation~/index.md index 8f86036d..83087221 100644 --- a/Documentation~/index.md +++ b/Documentation~/index.md @@ -52,9 +52,9 @@ Read about [usage](ImportEditor.md) below. - Example: artists don't need to know or follow Unity shader specific conventions and thus developers don't need to instruct them - Enables adding rich interaction and behavior to assets (e.g. custom scripts or animation controllers) - In conjunction with [Editor Export](ExportEditor.md), Unity becomes a complete tool for re-mixing 3D content -- 1Use default Lit (URP/HDRP) or Standard (Built-in render pipeline) materials +- ¹Use default Lit (URP/HDRP) or Standard (Built-in render pipeline) materials -1: Not yet supported (see [issue](https://github.com/atteneder/glTFast/issues/258)) +¹: Not yet supported (see [issue](https://github.com/atteneder/glTFast/issues/258)) #### Editor Export diff --git a/Editor/Scripts/BuiltInShaderGUI.cs b/Editor/Scripts/BuiltInShaderGUI.cs index 707b3009..a10cbecb 100644 --- a/Editor/Scripts/BuiltInShaderGUI.cs +++ b/Editor/Scripts/BuiltInShaderGUI.cs @@ -26,7 +26,7 @@ enum BlendModeOption UvTransform? m_UVTransform; - public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties) + public override void OnGUI(MaterialEditor materialEditor, UnityEditor.MaterialProperty[] properties) { if (materialEditor.target is Material material) { @@ -64,8 +64,8 @@ public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] pro m_UVTransform = TextureRotationSlider( material, m_UVTransform, - BaseColorTextureScaleTransformProperty, - BaseColorTextureRotationProperty, + MaterialProperty.BaseColorTextureScaleTransform, + MaterialProperty.BaseColorTextureRotation, true, "Base Color Tex Rotation"); if (m_UVTransform.HasValue) @@ -112,7 +112,7 @@ static void ConfigureBlendMode(Material material, BlendModeOption mode) SetOpaqueMode(material); break; case BlendModeOption.Cutout: - SetAlphaModeMask(material, material.GetFloat(AlphaCutoffProperty)); + SetAlphaModeMask(material, material.GetFloat(MaterialProperty.AlphaCutoff)); break; case BlendModeOption.Fade: SetAlphaModeBlend(material); diff --git a/Editor/Scripts/ShaderGUIBase.cs b/Editor/Scripts/ShaderGUIBase.cs index 11603fd7..3c2b1ae8 100644 --- a/Editor/Scripts/ShaderGUIBase.cs +++ b/Editor/Scripts/ShaderGUIBase.cs @@ -13,12 +13,6 @@ class ShaderGUIBase : ShaderGUI { const float k_Tolerance = 0.001f; - protected struct UvTransform - { - public float rotation; - public float2 scale; - } - protected UvTransform? TextureRotationSlider( Material material, UvTransform? uvTransform, @@ -38,7 +32,7 @@ protected struct UvTransform } else { - GetUvTransform(material, scaleTransformPropertyId, rotationPropertyId, out oldUvTransform); + oldUvTransform = UvTransform.FromMaterial(material, scaleTransformPropertyId, rotationPropertyId); newUvTransform = new UvTransform(); } @@ -96,25 +90,5 @@ protected struct UvTransform return uvTransform; } - - /// - /// Extracts a material's texture rotation (degrees) from the 2 by 2 matrix - /// - /// - /// ID of the scale-transform (_ST) property - /// ID of the rotation property - /// Resulting UV transform - static void GetUvTransform(Material material, int scaleTransformPropertyId, int rotationPropertyId, out UvTransform uvTransform) - { - float4 st = material.GetVector(scaleTransformPropertyId); - float2 r = (Vector2)material.GetVector(rotationPropertyId); - - uvTransform.scale.x = Mathematics.Normalize(new float2(st.x, r.y), out var r1); - uvTransform.scale.y = Mathematics.Normalize(new float2(st.y, r.x), out var r2); - - var acos = Mathf.Acos(r1.x); - if (r2.x < 0) acos = Mathf.PI * 2 - acos; - uvTransform.rotation = acos * Mathf.Rad2Deg; - } } } diff --git a/Editor/Scripts/ShaderGraphGUI.cs b/Editor/Scripts/ShaderGraphGUI.cs index 89664428..6dea276e 100644 --- a/Editor/Scripts/ShaderGraphGUI.cs +++ b/Editor/Scripts/ShaderGraphGUI.cs @@ -8,7 +8,6 @@ #if GLTFAST_SHADER_GRAPH || UNITY_EDITOR using UnityEditor; using UnityEngine; -using static GLTFast.Materials.MaterialGenerator; namespace GLTFast.Editor { @@ -23,8 +22,8 @@ public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] pro m_UVTransform = TextureRotationSlider( material, m_UVTransform, - BaseColorTextureScaleTransformProperty, - BaseColorTextureRotationProperty, + Materials.MaterialProperty.BaseColorTextureScaleTransform, + Materials.MaterialProperty.BaseColorTextureRotation, label:"Base Color Tex Rotation" ); diff --git a/Runtime/Scripts/Export/GltfBuiltInShaderMaterialExporter.cs b/Runtime/Scripts/Export/GltfBuiltInShaderMaterialExporter.cs new file mode 100644 index 00000000..252c76ea --- /dev/null +++ b/Runtime/Scripts/Export/GltfBuiltInShaderMaterialExporter.cs @@ -0,0 +1,52 @@ +// SPDX-FileCopyrightText: 2024 Unity Technologies and the glTFast authors +// SPDX-License-Identifier: Apache-2.0 + +using System; +using GLTFast.Materials; +using GLTFast.Schema; +using UnityEngine; +using UnityEngine.Rendering; +using Material = UnityEngine.Material; + +namespace GLTFast.Export +{ + /// + /// Converts Unity Materials that use a glTFast Built-In shader to glTF materials + /// + public class GltfBuiltInShaderMaterialExporter : GltfMaterialExporter + { + /// + protected override MaterialBase.AlphaMode GetAlphaMode(Material material) + { + if (TryGetValue(material, MaterialProperty.Mode, out int modeInt)) + { + var mode = (StandardShaderMode)modeInt; + switch (mode) + { + case StandardShaderMode.Cutout: + return MaterialBase.AlphaMode.Mask; + case StandardShaderMode.Fade: + case StandardShaderMode.Transparent: + return MaterialBase.AlphaMode.Blend; + } + } + return MaterialBase.AlphaMode.Opaque; + } + + /// + protected override float GetAlphaCutoff(Material material) + { + return material.GetFloat(MaterialProperty.AlphaCutoff); + } + + /// + protected override bool IsDoubleSided(Material material) + { + if (TryGetValue(material, MaterialProperty.CullMode, out int cull)) + { + return cull == (int)CullMode.Off; + } + return false; + } + } +} diff --git a/Runtime/Scripts/Export/GltfBuiltInShaderMaterialExporter.cs.meta b/Runtime/Scripts/Export/GltfBuiltInShaderMaterialExporter.cs.meta new file mode 100644 index 00000000..bb215074 --- /dev/null +++ b/Runtime/Scripts/Export/GltfBuiltInShaderMaterialExporter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 30e694814871f44c2b0ae4330e438a97 +timeCreated: 1699375361 \ No newline at end of file diff --git a/Runtime/Scripts/Export/GltfHdrpMaterialExporter.cs b/Runtime/Scripts/Export/GltfHdrpMaterialExporter.cs new file mode 100644 index 00000000..939ee84b --- /dev/null +++ b/Runtime/Scripts/Export/GltfHdrpMaterialExporter.cs @@ -0,0 +1,47 @@ +// SPDX-FileCopyrightText: 2024 Unity Technologies and the glTFast authors +// SPDX-License-Identifier: Apache-2.0 + +#if USING_HDRP + +using System; +using GLTFast.Materials; +using GLTFast.Schema; +using UnityEngine; +using Material = UnityEngine.Material; + +namespace GLTFast.Export +{ + /// + /// Converts Unity Materials that use a glTFast Built-In shader to glTF materials + /// + public class GltfHdrpMaterialExporter : GltfShaderGraphMaterialExporter + { + protected override bool IsDoubleSided(Material material) + { + if (TryGetValue(material, MaterialProperty.DoubleSidedEnable, out int doubleSided)) + { + return doubleSided != 0; + } + return false; + } + + protected override MaterialBase.AlphaMode GetAlphaMode(Material material) + { + if (TryGetValue(material, MaterialProperty.AlphaCutoffEnable, out int alphaClip) + && alphaClip == 1) + { + return MaterialBase.AlphaMode.Mask; + } + + if (TryGetValue(material, MaterialProperty.SurfaceType, out int surface)) + { + return surface == 0 + ? MaterialBase.AlphaMode.Opaque + : MaterialBase.AlphaMode.Blend; + } + + return MaterialBase.AlphaMode.Opaque; + } + } +} +#endif // USING_HDRP diff --git a/Runtime/Scripts/Export/GltfHdrpMaterialExporter.cs.meta b/Runtime/Scripts/Export/GltfHdrpMaterialExporter.cs.meta new file mode 100644 index 00000000..5c97a66d --- /dev/null +++ b/Runtime/Scripts/Export/GltfHdrpMaterialExporter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e1c6d62fefdee4eb2a65d361a2516ee0 +timeCreated: 1699375361 \ No newline at end of file diff --git a/Runtime/Scripts/Export/GltfMaterialExporter.cs b/Runtime/Scripts/Export/GltfMaterialExporter.cs new file mode 100644 index 00000000..f67ee2e4 --- /dev/null +++ b/Runtime/Scripts/Export/GltfMaterialExporter.cs @@ -0,0 +1,388 @@ +// SPDX-FileCopyrightText: 2024 Unity Technologies and the glTFast authors +// SPDX-License-Identifier: Apache-2.0 + +using System; +using GLTFast.Logging; +using GLTFast.Materials; +using GLTFast.Schema; +using Unity.Mathematics; +using UnityEngine; +using UnityEngine.Rendering; +using Material = UnityEngine.Material; + +namespace GLTFast.Export +{ + /// + /// Converts Unity Materials that use a glTFast shader to glTF materials + /// + public abstract class GltfMaterialExporter : MaterialExportBase + { + /// + public override bool ConvertMaterial( + Material unityMaterial, + out GLTFast.Schema.Material material, + IGltfWritable gltf, + ICodeLogger logger) + { + material = new GLTFast.Schema.Material + { + name = unityMaterial.name, + pbrMetallicRoughness = new PbrMetallicRoughness(), + doubleSided = IsDoubleSided(unityMaterial) + }; + + var alphaMode = GetAlphaMode(unityMaterial); + material.SetAlphaMode(alphaMode); + if (alphaMode == MaterialBase.AlphaMode.Mask) + { + material.alphaCutoff = GetAlphaCutoff(unityMaterial); + } + + material = HandlePbrMetallicRoughness(gltf, material, unityMaterial); + material = HandleNormal(gltf, material, unityMaterial); + material = HandleOcclusion(gltf, material, unityMaterial); + material = HandleEmission(gltf, material, unityMaterial); + + return true; + } + + /// + /// Extracts the glTF alpha mode from a Unity material. + /// + /// + /// Unity material. + /// glTF alpha mode. + protected abstract MaterialBase.AlphaMode GetAlphaMode(Material material); + + /// + /// Returns that material's alpha cutoff threshold. + /// + /// Unity material. + /// + /// Alpha cutoff threshold value. + protected abstract float GetAlphaCutoff(Material material); + + /// + /// Indicates whether (back-face) culling should be disabled. + /// + /// + /// Unity material. + /// True if material does not do back-face culling. False otherwise. + protected abstract bool IsDoubleSided(Material material); + + static GLTFast.Schema.Material HandlePbrMetallicRoughness( + IGltfWritable gltf, + GLTFast.Schema.Material material, + Material unityMaterial) + { + if (TryGetValue(unityMaterial, MaterialProperty.BaseColorTexture, out Texture2D texture2D)) + { + if (MaterialExport.AddImageExport(gltf, new ImageExport(texture2D), out var textureId)) + { + var textureInfo = new TextureInfo + { + index = textureId, + texCoord = GetValue(unityMaterial, MaterialProperty.BaseColorTextureTexCoord) + }; + + material.pbrMetallicRoughness.baseColorTexture = textureInfo; + + if (TryCreateTextureTransform( + gltf, + unityMaterial, + MaterialProperty.BaseColorTextureScaleTransform, + MaterialProperty.BaseColorTextureRotation, + out var textureTransform + )) + { + material.pbrMetallicRoughness.baseColorTexture.extensions = new TextureInfoExtensions + { + KHR_texture_transform = textureTransform + }; + } + } + } + + if (TryGetValue(unityMaterial, MaterialProperty.BaseColor, out Color baseColor)) + { + material.pbrMetallicRoughness.baseColorFactor = new[] + { + baseColor.r, + baseColor.g, + baseColor.b, + baseColor.a + }; + } + + material = HandleMetallicRoughness(gltf, material, unityMaterial); + + return material; + } + + static GLTFast.Schema.Material HandleMetallicRoughness( + IGltfWritable gltf, + GLTFast.Schema.Material material, + Material unityMaterial) + { + if (TryGetValue(unityMaterial, MaterialProperty.MetallicRoughnessMap, out Texture2D texture2D) + && MaterialExport.AddImageExport(gltf, new ImageExport(texture2D), out var textureId)) + { + var textureInfo = new TextureInfo + { + index = textureId, + texCoord = GetValue(unityMaterial, MaterialProperty.MetallicRoughnessMapTexCoord) + }; + + if (TryCreateTextureTransform( + gltf, + unityMaterial, + MaterialProperty.MetallicRoughnessMapScaleTransform, + MaterialProperty.MetallicRoughnessMapRotation, + out var textureTransform) + ) + { + textureInfo.extensions = new TextureInfoExtensions + { + KHR_texture_transform = textureTransform + }; + } + + material.pbrMetallicRoughness.metallicRoughnessTexture = textureInfo; + } + + if (TryGetValue(unityMaterial, MaterialProperty.Metallic, out float metallicFactor)) + { + material.pbrMetallicRoughness.metallicFactor = metallicFactor; + } + + if (TryGetValue(unityMaterial, MaterialProperty.RoughnessFactor, out float roughnessFactor)) + { + material.pbrMetallicRoughness.roughnessFactor = roughnessFactor; + } + + return material; + } + + static GLTFast.Schema.Material HandleNormal( + IGltfWritable gltf, + GLTFast.Schema.Material material, + Material unityMaterial) + { + if (!TryGetValue(unityMaterial, MaterialProperty.NormalTexture, out Texture2D texture2D)) + { + return material; + } + + if (!MaterialExport.AddImageExport(gltf, new NormalImageExport(texture2D), out var textureId)) + { + return material; + } + + TryGetValue(unityMaterial, MaterialProperty.NormalTextureScale, out float normalScale); + var textureInfo = new NormalTextureInfo + { + index = textureId, + texCoord = GetValue(unityMaterial, MaterialProperty.NormalTextureTexCoord), + scale = normalScale + }; + + material.normalTexture = textureInfo; + + if (TryCreateTextureTransform( + gltf, + unityMaterial, + MaterialProperty.NormalTextureScaleTransform, + MaterialProperty.NormalTextureRotation, + out var textureTransform + )) + { + material.normalTexture.extensions = new TextureInfoExtensions + { + KHR_texture_transform = textureTransform + }; + } + + return material; + } + + static GLTFast.Schema.Material HandleOcclusion( + IGltfWritable gltf, + GLTFast.Schema.Material material, + Material unityMaterial) + { + if (!TryGetValue(unityMaterial, MaterialProperty.OcclusionTexture, out Texture2D texture2D)) + { + return material; + } + + if (!MaterialExport.AddImageExport(gltf, new ImageExport(texture2D), out var textureId)) + { + return material; + } + + TryGetValue(unityMaterial, MaterialProperty.OcclusionTextureStrength, out float occlusionStrength); + var info = new OcclusionTextureInfo + { + index = textureId, + texCoord = GetValue(unityMaterial, MaterialProperty.OcclusionTextureTexCoord), + strength = occlusionStrength + }; + + material.occlusionTexture = info; + + if (TryCreateTextureTransform( + gltf, + unityMaterial, + MaterialProperty.OcclusionTextureScaleTransform, + MaterialProperty.OcclusionTextureRotation, + out var textureTransform + )) + { + material.occlusionTexture.extensions = new TextureInfoExtensions + { + KHR_texture_transform = textureTransform + }; + } + + return material; + } + + static GLTFast.Schema.Material HandleEmission( + IGltfWritable gltf, + GLTFast.Schema.Material material, + Material unityMaterial) + { + if (TryGetValue(unityMaterial, MaterialProperty.EmissiveTexture, out Texture2D texture2D)) + { + if (MaterialExport.AddImageExport(gltf, new ImageExport(texture2D), out var textureId)) + { + var info = new TextureInfo + { + index = textureId, + texCoord = GetValue(unityMaterial, MaterialProperty.EmissiveTextureTexCoord) + }; + + material.emissiveTexture = info; + + if (TryCreateTextureTransform( + gltf, + unityMaterial, + MaterialProperty.EmissiveTextureScaleTransform, + MaterialProperty.EmissiveTextureRotation, + out var textureTransform + )) + { + material.emissiveTexture.extensions = new TextureInfoExtensions + { + KHR_texture_transform = textureTransform + }; + } + } + } + + if (TryGetValue(unityMaterial, MaterialProperty.EmissiveFactor, out Color emissiveFactor)) + { + material.Emissive = emissiveFactor; + } + + return material; + } + + internal static bool TryCreateTextureTransform( + IGltfWritable gltf, + Material uMaterial, + int scaleTransformPropertyId, + int rotationPropertyId, + out TextureTransform result + ) + { + result = null; + if (!uMaterial.IsKeywordEnabled("_TEXTURE_TRANSFORM")) + { + return false; + } + + var st = uMaterial.GetVector(scaleTransformPropertyId); + var r = uMaterial.GetVector(rotationPropertyId); + + if (st.z != 0 || st.w != 0) + { + result ??= new TextureTransform(); + result.offset = new[] { st.z, st.w }; + } + + var uvTransform = UvTransform.FromMatrix(new float2x2(st.x, st.y, r.x, r.y)); + + if (uvTransform.rotation != 0) + { + result ??= new TextureTransform(); + result.rotation = uvTransform.rotation; + } + + if (math.abs(uvTransform.scale.x - 1) > math.EPSILON + || math.abs(uvTransform.scale.x - 1) > math.EPSILON) + { + result ??= new TextureTransform(); + result.scale = new[] { uvTransform.scale[0], uvTransform.scale[1] }; + } + + if (result != null) + { + gltf.RegisterExtensionUsage(Extension.TextureTransform); + return true; + } + + return false; + } + + internal static bool TryGetValue(Material material, int propertyId, out float value) + { + if (!material.HasProperty(propertyId)) + { + value = default; + return false; + } + value = material.GetFloat(propertyId); + return true; + } + + internal static bool TryGetValue(Material material, int propertyId, out int value) + { + if (TryGetValue(material, propertyId, out float floatValue)) + { + value = (int)floatValue; + return true; + } + + value = default; + return false; + } + + internal static int GetValue(Material material, int propertyId) + { + return !TryGetValue(material, propertyId, out int value) ? default : value; + } + + internal static bool TryGetValue(Material material, int propertyId, out Color value) + { + if (!material.HasProperty(propertyId)) + { + value = default; + return false; + } + value = material.GetColor(propertyId); + return true; + } + + internal static bool TryGetValue(Material material, int propertyId, out Texture2D value) + { + if (!material.HasProperty(propertyId)) + { + value = default; + return false; + } + value = (Texture2D)material.GetTexture(propertyId); + return !(value is null); + } + } +} diff --git a/Runtime/Scripts/Export/GltfMaterialExporter.cs.meta b/Runtime/Scripts/Export/GltfMaterialExporter.cs.meta new file mode 100644 index 00000000..cdb782f2 --- /dev/null +++ b/Runtime/Scripts/Export/GltfMaterialExporter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 41cd6c28a0b7473a8c4a8705f5c792f4 +timeCreated: 1699375361 \ No newline at end of file diff --git a/Runtime/Scripts/Export/GltfShaderGraphMaterialExporter.cs b/Runtime/Scripts/Export/GltfShaderGraphMaterialExporter.cs new file mode 100644 index 00000000..c14700c9 --- /dev/null +++ b/Runtime/Scripts/Export/GltfShaderGraphMaterialExporter.cs @@ -0,0 +1,72 @@ +// SPDX-FileCopyrightText: 2024 Unity Technologies and the glTFast authors +// SPDX-License-Identifier: Apache-2.0 + +#if UNITY_SHADER_GRAPH + +using System; +using GLTFast.Materials; +using GLTFast.Schema; +using Unity.Mathematics; +using UnityEngine; +using UnityEngine.Rendering; +using Material = UnityEngine.Material; + +namespace GLTFast.Export +{ + /// + /// Converts Unity Materials that use a glTFast Built-In shader to glTF materials + /// + public class GltfShaderGraphMaterialExporter : GltfMaterialExporter + { + protected override bool IsDoubleSided(Material material) + { +#if !USING_URP || USING_URP_12_OR_NEWER + if (TryGetValue(material, MaterialProperty.Cull, out int cull)) + { + return cull == (int)CullMode.Off; + } + return false; +#else + // Legacy URP shader graphs have postfix "-double" in their name if they are double-sided. + var shaderName = material.shader.name; + + return shaderName.EndsWith("-double", StringComparison.InvariantCulture); +#endif + } + + protected override MaterialBase.AlphaMode GetAlphaMode(Material material) + { +#if !USING_URP || USING_URP_12_OR_NEWER + if (TryGetValue(material, MaterialProperty.AlphaClip, out int alphaClip) + && alphaClip == 1) + { + return MaterialBase.AlphaMode.Mask; + } + if (TryGetValue(material, MaterialProperty.Surface, out int surface)) + { + return surface == 0 + ? MaterialBase.AlphaMode.Opaque + : MaterialBase.AlphaMode.Blend; + } +#else + // Legacy URP shader graphs have postfix "-Blend" or "-Blend-double" in their name if they are blended. + var shaderName = material.shader.name; + + var startIndex = math.max(0, shaderName.Length - 14); + if (shaderName.LastIndexOf("-Blend", startIndex, StringComparison.InvariantCulture) >= 0 + || shaderName.LastIndexOf("-Premultiply", startIndex, StringComparison.InvariantCulture) >= 0) + { + return MaterialBase.AlphaMode.Blend; + } +#endif + + return MaterialBase.AlphaMode.Opaque; + } + + protected override float GetAlphaCutoff(Material material) + { + return material.GetFloat(MaterialProperty.AlphaCutoff); + } + } +} +#endif // UNITY_SHADER_GRAPH diff --git a/Runtime/Scripts/Export/GltfShaderGraphMaterialExporter.cs.meta b/Runtime/Scripts/Export/GltfShaderGraphMaterialExporter.cs.meta new file mode 100644 index 00000000..e0152416 --- /dev/null +++ b/Runtime/Scripts/Export/GltfShaderGraphMaterialExporter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 2b6097c25c31a447186160b41fedd5df +timeCreated: 1699375361 \ No newline at end of file diff --git a/Runtime/Scripts/Export/GltfUnlitMaterialExporter.cs b/Runtime/Scripts/Export/GltfUnlitMaterialExporter.cs new file mode 100644 index 00000000..3b3f818e --- /dev/null +++ b/Runtime/Scripts/Export/GltfUnlitMaterialExporter.cs @@ -0,0 +1,96 @@ +// SPDX-FileCopyrightText: 2024 Unity Technologies and the glTFast authors +// SPDX-License-Identifier: Apache-2.0 + +using System; +using GLTFast.Logging; +using GLTFast.Materials; +using GLTFast.Schema; +using Unity.Mathematics; +using UnityEngine; +using UnityEngine.Rendering; +using Material = UnityEngine.Material; + +namespace GLTFast.Export +{ + /// + /// Converts Unity Materials that use a glTFast shader to glTF materials + /// + public class GltfUnlitMaterialExporter : IMaterialExport + { + /// + public bool ConvertMaterial( + Material unityMaterial, + out GLTFast.Schema.Material material, + IGltfWritable gltf, + ICodeLogger logger) + { + gltf.RegisterExtensionUsage(Extension.MaterialsUnlit); + + material = new GLTFast.Schema.Material + { + name = unityMaterial.name, + pbrMetallicRoughness = new PbrMetallicRoughness(), + extensions = new MaterialExtensions + { + KHR_materials_unlit = new MaterialUnlit() + } + }; + + if (GltfMaterialExporter.TryGetValue(unityMaterial, MaterialProperty.Cull, out int cull)) + { + material.doubleSided = cull.Equals((int)CullMode.Off); + } + + material = HandlePbrMetallicRoughness(gltf, material, unityMaterial); + + return true; + } + + static GLTFast.Schema.Material HandlePbrMetallicRoughness( + IGltfWritable gltf, + GLTFast.Schema.Material material, + Material unityMaterial) + { + if (GltfMaterialExporter.TryGetValue(unityMaterial, MaterialProperty.BaseColorTexture, out Texture2D texture2D)) + { + if (MaterialExport.AddImageExport(gltf, new ImageExport(texture2D), out var textureId)) + { + var textureInfo = new TextureInfo + { + index = textureId, + texCoord = GltfMaterialExporter.GetValue(unityMaterial, MaterialProperty.BaseColorTextureTexCoord) + }; + + material.pbrMetallicRoughness.baseColorTexture = textureInfo; + + if (GltfMaterialExporter.TryCreateTextureTransform( + gltf, + unityMaterial, + MaterialProperty.BaseColorTextureScaleTransform, + MaterialProperty.BaseColorTextureRotation, + out var textureTransform + )) + { + material.pbrMetallicRoughness.baseColorTexture.extensions = new TextureInfoExtensions + { + KHR_texture_transform = textureTransform + }; + } + } + } + + if (GltfMaterialExporter.TryGetValue(unityMaterial, MaterialProperty.BaseColor, out Color baseColor)) + { + material.pbrMetallicRoughness.baseColorFactor = new[] + { + baseColor.r, + baseColor.g, + baseColor.b, + baseColor.a + }; + } + + return material; + } + } +} diff --git a/Runtime/Scripts/Export/GltfUnlitMaterialExporter.cs.meta b/Runtime/Scripts/Export/GltfUnlitMaterialExporter.cs.meta new file mode 100644 index 00000000..2eb52530 --- /dev/null +++ b/Runtime/Scripts/Export/GltfUnlitMaterialExporter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: d5a294b5b6f244ad2ac0b57a0bdedc25 +timeCreated: 1699375361 \ No newline at end of file diff --git a/Runtime/Scripts/Export/GltfWriter.cs b/Runtime/Scripts/Export/GltfWriter.cs index 15cdee6d..b6a1d2e6 100755 --- a/Runtime/Scripts/Export/GltfWriter.cs +++ b/Runtime/Scripts/Export/GltfWriter.cs @@ -46,7 +46,6 @@ namespace GLTFast.Export /// public class GltfWriter : IGltfWritable { - enum State { Initialized, diff --git a/Runtime/Scripts/Export/HighDefinitionMaterialExport.cs b/Runtime/Scripts/Export/HighDefinitionMaterialExport.cs index 715357ef..bc992266 100644 --- a/Runtime/Scripts/Export/HighDefinitionMaterialExport.cs +++ b/Runtime/Scripts/Export/HighDefinitionMaterialExport.cs @@ -51,7 +51,7 @@ public override bool ConvertMaterial(UnityEngine.Material uMaterial, out Materia }; SetAlphaModeAndCutoff(uMaterial, material); - material.doubleSided = IsDoubleSided(uMaterial, MaterialGenerator.CullModeProperty); + material.doubleSided = IsDoubleSided(uMaterial, MaterialProperty.CullMode); // // Emission @@ -176,7 +176,7 @@ ICodeLogger logger if (mainTex) { if(mainTex is Texture2D) { pbr.baseColorTexture = ExportTextureInfo(mainTex, gltf, - material.GetAlphaMode() == Material.AlphaMode.Opaque + material.GetAlphaMode() == MaterialBase.AlphaMode.Opaque ? ImageFormat.Jpg : ImageFormat.Unknown ); @@ -226,7 +226,7 @@ ICodeLogger logger if ( metallicUsed || occUsed || smoothnessUsed ) { ormImageExport = new MaskMapImageExport(maskMap); - if (AddImageExport(gltf, ormImageExport, out var ormTextureId)) { + if (MaterialExport.AddImageExport(gltf, ormImageExport, out var ormTextureId)) { if (metallicUsed || smoothnessUsed) { pbr.metallicRoughnessTexture = new TextureInfo { diff --git a/Runtime/Scripts/Export/MaterialExport.cs b/Runtime/Scripts/Export/MaterialExport.cs index b2ba6352..c3cba947 100644 --- a/Runtime/Scripts/Export/MaterialExport.cs +++ b/Runtime/Scripts/Export/MaterialExport.cs @@ -24,25 +24,57 @@ public static IMaterialExport GetDefaultMaterialExport() { if (s_MaterialExport == null) { - var renderPipeline = RenderPipelineUtils.RenderPipeline; switch (renderPipeline) { case RenderPipeline.BuiltIn: case RenderPipeline.Universal: +#if UNITY_SHADER_GRAPH + s_MaterialExport = new MetaMaterialExport< + StandardMaterialExport, + GltfShaderGraphMaterialExporter + >(); +#else s_MaterialExport = new StandardMaterialExport(); +#endif break; #if USING_HDRP case RenderPipeline.HighDefinition: - s_MaterialExport = new HighDefinitionMaterialExport(); + s_MaterialExport = new MetaMaterialExport< + HighDefinitionMaterialExport, + GltfHdrpMaterialExporter + >(); break; #endif default: throw new InvalidOperationException($"Could not determine default MaterialExport (render pipeline {renderPipeline})"); } + } return s_MaterialExport; } + + /// + /// Adds an ImageExport to the glTF. + /// No conversions or channel swizzling + /// + /// glTF to add the image to. + /// Texture generator to be added + /// Resulting texture index. + /// True if the texture was added, false otherwise. + internal static bool AddImageExport(IGltfWritable gltf, ImageExportBase imageExport, out int textureId) + { + var imageId = gltf.AddImage(imageExport); + if (imageId < 0) + { + textureId = -1; + return false; + } + + var samplerId = gltf.AddSampler(imageExport.FilterMode, imageExport.WrapModeU, imageExport.WrapModeV); + textureId = gltf.AddTexture(imageId, samplerId); + return true; + } } } diff --git a/Runtime/Scripts/Export/MaterialExportBase.cs b/Runtime/Scripts/Export/MaterialExportBase.cs index b7aae811..7139b079 100644 --- a/Runtime/Scripts/Export/MaterialExportBase.cs +++ b/Runtime/Scripts/Export/MaterialExportBase.cs @@ -202,7 +202,7 @@ protected static TextureInfo ExportTextureInfo( return null; } var imageExport = new ImageExport(texture2d, format); - if (AddImageExport(gltf, imageExport, out var textureId)) + if (MaterialExport.AddImageExport(gltf, imageExport, out var textureId)) { return new TextureInfo { @@ -234,7 +234,7 @@ int normalScalePropId return null; } var imageExport = new NormalImageExport(texture2d); - if (AddImageExport(gltf, imageExport, out var textureId)) + if (MaterialExport.AddImageExport(gltf, imageExport, out var textureId)) { var info = new NormalTextureInfo { @@ -251,26 +251,11 @@ int normalScalePropId return null; } - /// - /// Adds an ImageExport to the glTF. - /// No conversions or channel swizzling - /// - /// glTF to add the image to. - /// Texture generator to be added - /// Resulting texture index. - /// True if the texture was added, false otherwise. + /// + [Obsolete("Use MaterialExport.AddImageExport instead.")] protected static bool AddImageExport(IGltfWritable gltf, ImageExportBase imageExport, out int textureId) { - var imageId = gltf.AddImage(imageExport); - if (imageId < 0) - { - textureId = -1; - return false; - } - - var samplerId = gltf.AddSampler(imageExport.FilterMode, imageExport.WrapModeU, imageExport.WrapModeV); - textureId = gltf.AddTexture(imageId, samplerId); - return true; + return MaterialExport.AddImageExport(gltf, imageExport, out textureId); } /// diff --git a/Runtime/Scripts/Export/MetaMaterialExport.cs b/Runtime/Scripts/Export/MetaMaterialExport.cs new file mode 100644 index 00000000..08375032 --- /dev/null +++ b/Runtime/Scripts/Export/MetaMaterialExport.cs @@ -0,0 +1,71 @@ +// SPDX-FileCopyrightText: 2024 Unity Technologies and the glTFast authors +// SPDX-License-Identifier: Apache-2.0 + +#if UNITY_SHADER_GRAPH + +using System; +using UnityEngine; + +namespace GLTFast.Export +{ + using Logging; + using Schema; + + public class MetaMaterialExport : + IMaterialExport + where TLitExport : IMaterialExport, new() + where TGltfShaderGraphExport : IMaterialExport, new() + { + static IMaterialExport s_LitMaterialExport; + static IMaterialExport s_GltfBuiltInMaterialExport; + static IMaterialExport s_GltfShaderGraphMaterialExport; + static IMaterialExport s_GltfUnlitMaterialExport; + + /// + public bool ConvertMaterial(UnityEngine.Material uMaterial, out Material material, IGltfWritable gltf, ICodeLogger logger) + { + IMaterialExport materialExport; + + var name = uMaterial.shader.name; +#if UNITY_SHADER_GRAPH + if (name.StartsWith("Shader Graphs/glTF-")) + { + if (name.LastIndexOf("nlit") >= 0) + { + // Unlit shader + s_GltfUnlitMaterialExport ??= new GltfUnlitMaterialExporter(); + materialExport = s_GltfUnlitMaterialExport; + } + else + { + s_GltfShaderGraphMaterialExport ??= new TGltfShaderGraphExport(); + materialExport = s_GltfShaderGraphMaterialExport; + } + } + else +#endif + if (name.StartsWith("glTF/")) + { + if (name.LastIndexOf("nlit") >= 0) + { + // Unlit shader + s_GltfUnlitMaterialExport ??= new GltfUnlitMaterialExporter(); + materialExport = s_GltfUnlitMaterialExport; + } + else + { + s_GltfBuiltInMaterialExport ??= new GltfBuiltInShaderMaterialExporter(); + materialExport = s_GltfBuiltInMaterialExport; + } + } + else + { + s_LitMaterialExport ??= new TLitExport(); + materialExport = s_LitMaterialExport; + } + + return materialExport.ConvertMaterial(uMaterial, out material, gltf, logger); + } + } +} +#endif // UNITY_SHADER_GRAPH diff --git a/Runtime/Scripts/Export/MetaMaterialExport.cs.meta b/Runtime/Scripts/Export/MetaMaterialExport.cs.meta new file mode 100644 index 00000000..5972cf32 --- /dev/null +++ b/Runtime/Scripts/Export/MetaMaterialExport.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b55647004f16f43779484197ae1b3948 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Scripts/Export/StandardMaterialExport.cs b/Runtime/Scripts/Export/StandardMaterialExport.cs index 42d89b9c..aa4a5367 100644 --- a/Runtime/Scripts/Export/StandardMaterialExport.cs +++ b/Runtime/Scripts/Export/StandardMaterialExport.cs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 using System; - +using GLTFast.Materials; using Unity.Mathematics; using UnityEngine; @@ -26,7 +26,6 @@ public class StandardMaterialExport : MaterialExportBase #endif const string k_KeywordSmoothnessTextureAlbedoChannelA = "_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A"; - static readonly int k_Cull = Shader.PropertyToID("_Cull"); static readonly int k_EmissionColor = Shader.PropertyToID("_EmissionColor"); static readonly int k_EmissionMap = Shader.PropertyToID("_EmissionMap"); static readonly int k_BumpMap = Shader.PropertyToID("_BumpMap"); @@ -62,7 +61,7 @@ public override bool ConvertMaterial(UnityEngine.Material uMaterial, out Materia }; SetAlphaModeAndCutoff(uMaterial, material); - material.doubleSided = IsDoubleSided(uMaterial, k_Cull); + material.doubleSided = IsDoubleSided(uMaterial, MaterialProperty.Cull); if (uMaterial.IsKeywordEnabled(k_KeywordEmission)) { @@ -232,7 +231,7 @@ public override bool ConvertMaterial(UnityEngine.Material uMaterial, out Materia if (ormImageExport != null && material.pbrMetallicRoughness != null) { - if (AddImageExport(gltf, ormImageExport, out var ormTextureId)) + if (MaterialExport.AddImageExport(gltf, ormImageExport, out var ormTextureId)) { if (material.pbrMetallicRoughness.MetallicRoughnessTexture != null) { @@ -413,7 +412,7 @@ IGltfWritable gltf return null; } var imageExport = new ImageExport(texture2d); - if (AddImageExport(gltf, imageExport, out var textureId)) + if (MaterialExport.AddImageExport(gltf, imageExport, out var textureId)) { return new OcclusionTextureInfo { diff --git a/Runtime/Scripts/Export/glTFast.Export.asmdef b/Runtime/Scripts/Export/glTFast.Export.asmdef index d0c88293..e2f8847f 100644 --- a/Runtime/Scripts/Export/glTFast.Export.asmdef +++ b/Runtime/Scripts/Export/glTFast.Export.asmdef @@ -28,6 +28,11 @@ "expression": "7.3.1", "define": "USING_URP" }, + { + "name": "com.unity.render-pipelines.universal", + "expression": "12", + "define": "USING_URP_12_OR_NEWER" + }, { "name": "com.unity.render-pipelines.high-definition", "expression": "7.3.1", @@ -42,6 +47,11 @@ "name": "com.unity.cloud.draco", "expression": "5.0.0-pre.1", "define": "DRACO_UNITY" + }, + { + "name": "com.unity.shadergraph", + "expression": "", + "define": "UNITY_SHADER_GRAPH" } ], "noEngineReferences": false diff --git a/Runtime/Scripts/Material/BuiltInMaterialGenerator.cs b/Runtime/Scripts/Material/BuiltInMaterialGenerator.cs index 436d4c49..b089348b 100644 --- a/Runtime/Scripts/Material/BuiltInMaterialGenerator.cs +++ b/Runtime/Scripts/Material/BuiltInMaterialGenerator.cs @@ -18,30 +18,7 @@ namespace GLTFast.Materials { using Logging; - using AlphaMode = Schema.Material.AlphaMode; - - /// - /// Built-In render pipeline Standard shader modes - /// - public enum StandardShaderMode - { - /// - /// Opaque mode - /// - Opaque = 0, - /// - /// Cutout mode (alpha test) - /// - Cutout = 1, - /// - /// Fade mode (alpha blended opacity) - /// - Fade = 2, - /// - /// Transparent mode (alpha blended transmission; e.g. glass) - /// - Transparent = 3 - } + using AlphaMode = Schema.MaterialBase.AlphaMode; /// /// Converts glTF materials to Unity materials for the Built-in Render Pipeline @@ -57,8 +34,6 @@ public class BuiltInMaterialGenerator : MaterialGenerator const string k_OcclusionKeyword = "_OCCLUSION"; const string k_SpecGlossMapKeyword = "_SPECGLOSSMAP"; - static readonly int k_ModePropId = Shader.PropertyToID("_Mode"); - #if UNITY_EDITOR const string k_ShaderPathPrefix = "Packages/" + GltfGlobals.GltfPackageName + "/Runtime/Shader/Built-In/"; const string k_PbrMetallicRoughnessShaderPath = "glTFPbrMetallicRoughness.shader"; @@ -103,6 +78,8 @@ protected override Material GenerateDefaultMaterial(bool pointsSupport = false) /// Finds the shader required for metallic/roughness based materials. /// /// Metallic/Roughness shader + // Needs to be non-static outside of the Editor. + // ReSharper disable once MemberCanBeMadeStatic.Local Shader FinderShaderMetallicRoughness() { #if UNITY_EDITOR @@ -116,6 +93,8 @@ Shader FinderShaderMetallicRoughness() /// Finds the shader required for specular/glossiness based materials. /// /// Specular/Glossiness shader + // Needs to be non-static outside of the Editor. + // ReSharper disable once MemberCanBeMadeStatic.Local Shader FinderShaderSpecularGlossiness() { #if UNITY_EDITOR @@ -129,6 +108,8 @@ Shader FinderShaderSpecularGlossiness() /// Finds the shader required for unlit materials. /// /// Unlit shader + // Needs to be non-static outside of the Editor. + // ReSharper disable once MemberCanBeMadeStatic.Local Shader FinderShaderUnlit() { #if UNITY_EDITOR @@ -152,7 +133,7 @@ Material GetPbrMetallicRoughnessMaterial(bool doubleSided = false) if (doubleSided) { // Turn off back-face culling - mat.SetFloat(CullModeProperty, 0); + mat.SetFloat(MaterialProperty.CullMode, 0); #if UNITY_EDITOR mat.doubleSidedGI = true; #endif @@ -174,7 +155,7 @@ Material GetPbrSpecularGlossinessMaterial(bool doubleSided = false) if (doubleSided) { // Turn off back-face culling - mat.SetFloat(CullModeProperty, 0); + mat.SetFloat(MaterialProperty.CullMode, 0); #if UNITY_EDITOR mat.doubleSidedGI = true; #endif @@ -196,7 +177,7 @@ Material GetUnlitMaterial(bool doubleSided = false) if (doubleSided) { // Turn off back-face culling - mat.SetFloat(CullModeProperty, 0); + mat.SetFloat(MaterialProperty.CullMode, 0); #if UNITY_EDITOR mat.doubleSidedGI = true; #endif @@ -243,7 +224,7 @@ public override Material GenerateMaterial( if (gltfMaterial.GetAlphaMode() == AlphaMode.Mask) { - material.SetFloat(AlphaCutoffProperty, gltfMaterial.alphaCutoff); + material.SetFloat(MaterialProperty.AlphaCutoff, gltfMaterial.alphaCutoff); shaderMode = StandardShaderMode.Cutout; } else if (gltfMaterial.GetAlphaMode() == AlphaMode.Blend) @@ -259,27 +240,27 @@ public override Material GenerateMaterial( if (specGloss != null) { baseColorLinear = specGloss.DiffuseColor; - material.SetVector(SpecularFactorProperty, specGloss.SpecularColor); - material.SetFloat(GlossinessFactorProperty, specGloss.glossinessFactor); + material.SetVector(MaterialProperty.SpecularFactor, specGloss.SpecularColor); + material.SetFloat(MaterialProperty.GlossinessFactor, specGloss.glossinessFactor); TrySetTexture( specGloss.diffuseTexture, material, gltf, - BaseColorTextureProperty, - BaseColorTextureScaleTransformProperty, - BaseColorTextureRotationProperty, - BaseColorTextureTexCoordProperty + MaterialProperty.BaseColorTexture, + MaterialProperty.BaseColorTextureScaleTransform, + MaterialProperty.BaseColorTextureRotation, + MaterialProperty.BaseColorTextureTexCoord ); if (TrySetTexture( specGloss.specularGlossinessTexture, material, gltf, - SpecularGlossinessTextureProperty, - SpecularGlossinessTextureScaleTransformProperty, - SpecularGlossinessTextureRotationProperty, - SpecularGlossinessTextureTexCoordProperty + MaterialProperty.SpecularGlossinessTexture, + MaterialProperty.SpecularGlossinessTextureScaleTransform, + MaterialProperty.SpecularGlossinessTextureRotation, + MaterialProperty.SpecularGlossinessTextureTexCoord )) { material.EnableKeyword(k_SpecGlossMapKeyword); @@ -293,27 +274,27 @@ public override Material GenerateMaterial( && gltfMaterial.Extensions?.KHR_materials_pbrSpecularGlossiness == null) { baseColorLinear = gltfMaterial.PbrMetallicRoughness.BaseColor; - material.SetFloat(MetallicProperty, gltfMaterial.PbrMetallicRoughness.metallicFactor); - material.SetFloat(RoughnessFactorProperty, gltfMaterial.PbrMetallicRoughness.roughnessFactor); + material.SetFloat(MaterialProperty.Metallic, gltfMaterial.PbrMetallicRoughness.metallicFactor); + material.SetFloat(MaterialProperty.RoughnessFactor, gltfMaterial.PbrMetallicRoughness.roughnessFactor); TrySetTexture( gltfMaterial.PbrMetallicRoughness.BaseColorTexture, material, gltf, - BaseColorTextureProperty, - BaseColorTextureScaleTransformProperty, - BaseColorTextureRotationProperty, - BaseColorTextureTexCoordProperty + MaterialProperty.BaseColorTexture, + MaterialProperty.BaseColorTextureScaleTransform, + MaterialProperty.BaseColorTextureRotation, + MaterialProperty.BaseColorTextureTexCoord ); if (TrySetTexture( gltfMaterial.PbrMetallicRoughness.MetallicRoughnessTexture, material, gltf, - MetallicRoughnessMapProperty, - MetallicRoughnessMapScaleTransformProperty, - MetallicRoughnessMapRotationProperty, - MetallicRoughnessMapUVChannelProperty + MaterialProperty.MetallicRoughnessMap, + MaterialProperty.MetallicRoughnessMapScaleTransform, + MaterialProperty.MetallicRoughnessMapRotation, + MaterialProperty.MetallicRoughnessMapTexCoord )) { material.EnableKeyword(k_MetallicRoughnessMapKeyword); @@ -324,38 +305,38 @@ public override Material GenerateMaterial( gltfMaterial.NormalTexture, material, gltf, - NormalTextureProperty, - NormalTextureScaleTransformProperty, - NormalTextureRotationProperty, - NormalTextureTexCoordProperty + MaterialProperty.NormalTexture, + MaterialProperty.NormalTextureScaleTransform, + MaterialProperty.NormalTextureRotation, + MaterialProperty.NormalTextureTexCoord )) { material.EnableKeyword(Constants.NormalMapKeyword); - material.SetFloat(NormalTextureScaleProperty, gltfMaterial.NormalTexture.scale); + material.SetFloat(MaterialProperty.NormalTextureScale, gltfMaterial.NormalTexture.scale); } if (TrySetTexture( gltfMaterial.OcclusionTexture, material, gltf, - OcclusionTextureProperty, - OcclusionTextureScaleTransformProperty, - OcclusionTextureRotationProperty, - OcclusionTextureTexCoordProperty + MaterialProperty.OcclusionTexture, + MaterialProperty.OcclusionTextureScaleTransform, + MaterialProperty.OcclusionTextureRotation, + MaterialProperty.OcclusionTextureTexCoord )) { material.EnableKeyword(k_OcclusionKeyword); - material.SetFloat(OcclusionTextureStrengthProperty, gltfMaterial.OcclusionTexture.strength); + material.SetFloat(MaterialProperty.OcclusionTextureStrength, gltfMaterial.OcclusionTexture.strength); } if (TrySetTexture( gltfMaterial.EmissiveTexture, material, gltf, - EmissiveTextureProperty, - EmissiveTextureScaleTransformProperty, - EmissiveTextureRotationProperty, - EmissiveTextureTexCoordProperty + MaterialProperty.EmissiveTexture, + MaterialProperty.EmissiveTextureScaleTransform, + MaterialProperty.EmissiveTextureRotation, + MaterialProperty.EmissiveTextureTexCoord )) { material.EnableKeyword(k_EmissionKeyword); @@ -397,11 +378,11 @@ public override Material GenerateMaterial( break; } - material.SetVector(BaseColorProperty, baseColorLinear.gamma); + material.SetVector(MaterialProperty.BaseColor, baseColorLinear.gamma); if (gltfMaterial.Emissive != Color.black) { - material.SetColor(EmissiveFactorProperty, gltfMaterial.Emissive.gamma); + material.SetColor(MaterialProperty.EmissiveFactor, gltfMaterial.Emissive.gamma); material.EnableKeyword(k_EmissionKeyword); } @@ -416,14 +397,14 @@ public override Material GenerateMaterial( public static void SetAlphaModeMask(Material material, float alphaCutoff) { material.EnableKeyword(AlphaTestOnKeyword); - material.SetInt(ZWriteProperty, 1); + material.SetInt(MaterialProperty.ZWrite, 1); material.DisableKeyword(k_AlphaPremultiplyOnKeyword); material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.AlphaTest; //2450 - material.SetFloat(AlphaCutoffProperty, alphaCutoff); - material.SetFloat(k_ModePropId, (int)StandardShaderMode.Cutout); + material.SetFloat(MaterialProperty.AlphaCutoff, alphaCutoff); + material.SetFloat(MaterialProperty.Mode, (int)StandardShaderMode.Cutout); material.SetOverrideTag(RenderTypeTag, TransparentCutoutRenderType); - material.SetInt(SrcBlendProperty, (int)UnityEngine.Rendering.BlendMode.One); - material.SetInt(DstBlendProperty, (int)UnityEngine.Rendering.BlendMode.Zero); + material.SetInt(MaterialProperty.SrcBlend, (int)UnityEngine.Rendering.BlendMode.One); + material.SetInt(MaterialProperty.DstBlend, (int)UnityEngine.Rendering.BlendMode.Zero); material.DisableKeyword(k_AlphaBlendOnKeyword); } @@ -443,12 +424,12 @@ static void SetAlphaModeMask(Material material, Schema.MaterialBase gltfMaterial /// Target material public static void SetAlphaModeBlend(Material material) { - material.SetFloat(k_ModePropId, (int)StandardShaderMode.Fade); + material.SetFloat(MaterialProperty.Mode, (int)StandardShaderMode.Fade); material.SetOverrideTag(RenderTypeTag, FadeRenderType); material.EnableKeyword(k_AlphaBlendOnKeyword); - material.SetInt(SrcBlendProperty, (int)UnityEngine.Rendering.BlendMode.SrcAlpha);//5 - material.SetInt(DstBlendProperty, (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);//10 - material.SetInt(ZWriteProperty, 0); + material.SetInt(MaterialProperty.SrcBlend, (int)UnityEngine.Rendering.BlendMode.SrcAlpha);//5 + material.SetInt(MaterialProperty.DstBlend, (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);//10 + material.SetInt(MaterialProperty.ZWrite, 0); material.DisableKeyword(k_AlphaPremultiplyOnKeyword); material.DisableKeyword(AlphaTestOnKeyword); material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.Transparent; //3000 @@ -460,12 +441,12 @@ public static void SetAlphaModeBlend(Material material) /// Target material public static void SetAlphaModeTransparent(Material material) { - material.SetFloat(k_ModePropId, (int)StandardShaderMode.Fade); + material.SetFloat(MaterialProperty.Mode, (int)StandardShaderMode.Fade); material.SetOverrideTag(RenderTypeTag, TransparentRenderType); material.EnableKeyword(k_AlphaPremultiplyOnKeyword); - material.SetInt(SrcBlendProperty, (int)UnityEngine.Rendering.BlendMode.One);//1 - material.SetInt(DstBlendProperty, (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);//10 - material.SetInt(ZWriteProperty, 0); + material.SetInt(MaterialProperty.SrcBlend, (int)UnityEngine.Rendering.BlendMode.One);//1 + material.SetInt(MaterialProperty.DstBlend, (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);//10 + material.SetInt(MaterialProperty.ZWrite, 0); material.DisableKeyword(k_AlphaBlendOnKeyword); material.DisableKeyword(AlphaTestOnKeyword); material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.Transparent; //3000 @@ -480,9 +461,9 @@ public static void SetOpaqueMode(Material material) material.SetOverrideTag(RenderTypeTag, OpaqueRenderType); material.DisableKeyword(k_AlphaBlendOnKeyword); material.renderQueue = -1; - material.SetInt(SrcBlendProperty, (int)UnityEngine.Rendering.BlendMode.One); - material.SetInt(DstBlendProperty, (int)UnityEngine.Rendering.BlendMode.Zero); - material.SetInt(ZWriteProperty, 1); + material.SetInt(MaterialProperty.SrcBlend, (int)UnityEngine.Rendering.BlendMode.One); + material.SetInt(MaterialProperty.DstBlend, (int)UnityEngine.Rendering.BlendMode.Zero); + material.SetInt(MaterialProperty.ZWrite, 1); material.DisableKeyword(AlphaTestOnKeyword); material.DisableKeyword(k_AlphaPremultiplyOnKeyword); } diff --git a/Runtime/Scripts/Material/HighDefinitionRPMaterialGenerator.cs b/Runtime/Scripts/Material/HighDefinitionRPMaterialGenerator.cs index 27216bb9..2c3b6178 100644 --- a/Runtime/Scripts/Material/HighDefinitionRPMaterialGenerator.cs +++ b/Runtime/Scripts/Material/HighDefinitionRPMaterialGenerator.cs @@ -27,15 +27,12 @@ public class HighDefinitionRPMaterialGenerator : ShaderGraphMaterialGenerator { // ReSharper restore MemberCanBePrivate.Global - static readonly int k_AlphaCutoffEnable = Shader.PropertyToID("_AlphaCutoffEnable"); static readonly int k_ZTestDepthEqualForOpaque = Shader.PropertyToID("_ZTestDepthEqualForOpaque"); #if USING_HDRP_10_OR_NEWER static readonly int k_RenderQueueType = Shader.PropertyToID("_RenderQueueType"); - static readonly int k_SurfaceType = Shader.PropertyToID("_SurfaceType"); const string k_DoubleSidedOnKeyword = "_DOUBLESIDED_ON"; - static readonly int k_DoubleSidedEnablePropId = Shader.PropertyToID("_DoubleSidedEnable"); static readonly int k_DoubleSidedNormalModePropId = Shader.PropertyToID("_DoubleSidedNormalMode"); static readonly int k_DoubleSidedConstantsPropId = Shader.PropertyToID("_DoubleSidedConstants"); @@ -84,13 +81,13 @@ protected override void SetDoubleSided(Schema.MaterialBase gltfMaterial, Materia base.SetDoubleSided(gltfMaterial,material); material.EnableKeyword(k_DoubleSidedOnKeyword); - material.SetFloat(k_DoubleSidedEnablePropId, 1); + material.SetFloat(MaterialProperty.DoubleSidedEnable, 1); // UnityEditor.Rendering.HighDefinition.DoubleSidedNormalMode.Flip material.SetFloat(k_DoubleSidedNormalModePropId, 0); material.SetVector(k_DoubleSidedConstantsPropId, new Vector4(-1,-1,-1,0)); - material.SetFloat(CullModeProperty, (int)CullMode.Off); + material.SetFloat(MaterialProperty.CullMode, (int)CullMode.Off); material.SetFloat(CullModeForwardProperty, (int)CullMode.Off); } #endif // USING_HDRP_10_OR_NEWER @@ -98,7 +95,7 @@ protected override void SetDoubleSided(Schema.MaterialBase gltfMaterial, Materia protected override void SetAlphaModeMask(Schema.MaterialBase gltfMaterial, Material material) { base.SetAlphaModeMask(gltfMaterial,material); - material.SetFloat(k_AlphaCutoffEnable, 1); + material.SetFloat(MaterialProperty.AlphaCutoffEnable, 1); material.SetOverrideTag(MotionVectorTag, MotionVectorUser); material.SetShaderPassEnabled(MotionVectorsPass, false); @@ -119,12 +116,12 @@ protected override void SetAlphaModeMask(Schema.MaterialBase gltfMaterial, Mater #endif // USING_HDRP_10_OR_NEWER material.SetOverrideTag(RenderTypeTag,TransparentRenderType); material.SetShaderPassEnabled(DistortionVectorsPass,false); - material.SetFloat(DstBlendProperty, (int)BlendMode.OneMinusSrcAlpha);//10 - material.SetFloat(SrcBlendProperty, (int) BlendMode.One); + material.SetFloat(MaterialProperty.DstBlend, (int)BlendMode.OneMinusSrcAlpha);//10 + material.SetFloat(MaterialProperty.SrcBlend, (int) BlendMode.One); // material.SetFloat(k_RenderQueueType, 4); // material.SetFloat(k_SurfaceType, 1); material.SetFloat(k_ZTestDepthEqualForOpaque, (int)CompareFunction.LessEqual); - material.SetFloat(ZWriteProperty, 0); + material.SetFloat(MaterialProperty.ZWrite, 0); } } @@ -174,15 +171,15 @@ protected override void SetShaderModeBlend(Schema.MaterialBase gltfMaterial, Mat material.SetShaderPassEnabled(ShaderPassRayTracingPrepass, false); material.SetShaderPassEnabled(ShaderPassDepthOnlyPass, false); - material.SetFloat(k_AlphaCutoffEnable, 0); + material.SetFloat(MaterialProperty.AlphaCutoffEnable, 0); material.SetFloat(k_RenderQueueType, (int)CustomPass.RenderQueueType.PreRefraction );// 4 - material.SetFloat(k_SurfaceType, 1 ); - material.SetFloat(ZWriteProperty, 0); + material.SetFloat(MaterialProperty.SurfaceType, 1 ); + material.SetFloat(MaterialProperty.ZWrite, 0); material.SetFloat(ZTestGBufferProperty, (int)CompareFunction.LessEqual); //4 material.SetFloat(k_ZTestDepthEqualForOpaque, (int)CompareFunction.LessEqual); //4 material.SetFloat(AlphaDstBlendProperty, (int)BlendMode.OneMinusSrcAlpha);//10 - material.SetFloat(DstBlendProperty, (int)BlendMode.OneMinusSrcAlpha);//10 - material.SetFloat(SrcBlendProperty, (int) BlendMode.SrcAlpha);//5 + material.SetFloat(MaterialProperty.DstBlend, (int)BlendMode.OneMinusSrcAlpha);//10 + material.SetFloat(MaterialProperty.SrcBlend, (int) BlendMode.SrcAlpha);//5 } #endif // USING_HDRP_10_OR_NEWER } diff --git a/Runtime/Scripts/Material/MaterialGenerator.cs b/Runtime/Scripts/Material/MaterialGenerator.cs index e70236e4..188c6cf7 100644 --- a/Runtime/Scripts/Material/MaterialGenerator.cs +++ b/Runtime/Scripts/Material/MaterialGenerator.cs @@ -74,92 +74,135 @@ protected enum MaterialType /// Shader keyword _UV_CHANNEL_SELECT public const string UVChannelSelectKeyword = "_UV_CHANNEL_SELECT"; - /// Shader property ID for property alphaCutoff - public static readonly int AlphaCutoffProperty = Shader.PropertyToID("alphaCutoff"); - /// Shader property ID for property baseColorFactor - public static readonly int BaseColorProperty = Shader.PropertyToID("baseColorFactor"); - /// Shader property ID for property baseColorTexture - public static readonly int BaseColorTextureProperty = Shader.PropertyToID("baseColorTexture"); - /// Shader property ID for property baseColorTexture_Rotation - public static readonly int BaseColorTextureRotationProperty = Shader.PropertyToID("baseColorTexture_Rotation"); - /// Shader property ID for property baseColorTexture_ST - public static readonly int BaseColorTextureScaleTransformProperty = Shader.PropertyToID("baseColorTexture_ST"); - /// Shader property ID for property baseColorTexture_texCoord - public static readonly int BaseColorTextureTexCoordProperty = Shader.PropertyToID("baseColorTexture_texCoord"); - /// Shader property ID for property _CullMode - public static readonly int CullModeProperty = Shader.PropertyToID("_CullMode"); - /// Shader property ID for property _Cull - public static readonly int CullProperty = Shader.PropertyToID("_Cull"); - /// Shader property ID for property _DstBlend - public static readonly int DstBlendProperty = Shader.PropertyToID("_DstBlend"); - /// Shader property ID for property diffuseFactor - public static readonly int DiffuseFactorProperty = Shader.PropertyToID("diffuseFactor"); - /// Shader property ID for property diffuseTexture - public static readonly int DiffuseTextureProperty = Shader.PropertyToID("diffuseTexture"); - /// Shader property ID for property diffuseTexture_ST - public static readonly int DiffuseTextureScaleTransformProperty = Shader.PropertyToID("diffuseTexture_ST"); - /// Shader property ID for property diffuseTexture_Rotation - public static readonly int DiffuseTextureRotationProperty = Shader.PropertyToID("diffuseTexture_Rotation"); - /// Shader property ID for property diffuseTexture_texCoord - public static readonly int DiffuseTextureTexCoordProperty = Shader.PropertyToID("diffuseTexture_texCoord"); - /// Shader property ID for property emissiveFactor - public static readonly int EmissiveFactorProperty = Shader.PropertyToID("emissiveFactor"); - /// Shader property ID for property emissiveTexture - public static readonly int EmissiveTextureProperty = Shader.PropertyToID("emissiveTexture"); - /// Shader property ID for property emissiveTexture_Rotation - public static readonly int EmissiveTextureRotationProperty = Shader.PropertyToID("emissiveTexture_Rotation"); - /// Shader property ID for property emissiveTexture_ST - public static readonly int EmissiveTextureScaleTransformProperty = Shader.PropertyToID("emissiveTexture_ST"); - /// Shader property ID for property emissiveTexture_texCoord - public static readonly int EmissiveTextureTexCoordProperty = Shader.PropertyToID("emissiveTexture_texCoord"); - /// Shader property ID for property glossinessFactor - public static readonly int GlossinessFactorProperty = Shader.PropertyToID("glossinessFactor"); - /// Shader property ID for property normalTexture - public static readonly int NormalTextureProperty = Shader.PropertyToID("normalTexture"); - /// Shader property ID for property normalTexture_Rotation - public static readonly int NormalTextureRotationProperty = Shader.PropertyToID("normalTexture_Rotation"); - /// Shader property ID for property normalTexture_ST - public static readonly int NormalTextureScaleTransformProperty = Shader.PropertyToID("normalTexture_ST"); - /// Shader property ID for property normalTexture_texCoord - public static readonly int NormalTextureTexCoordProperty = Shader.PropertyToID("normalTexture_texCoord"); - /// Shader property ID for property normalTexture_scale - public static readonly int NormalTextureScaleProperty = Shader.PropertyToID("normalTexture_scale"); - /// Shader property ID for property metallicFactor - public static readonly int MetallicProperty = Shader.PropertyToID("metallicFactor"); - /// Shader property ID for property metallicRoughnessTexture - public static readonly int MetallicRoughnessMapProperty = Shader.PropertyToID("metallicRoughnessTexture"); - /// Shader property ID for property metallicRoughnessTexture_ST - public static readonly int MetallicRoughnessMapScaleTransformProperty = Shader.PropertyToID("metallicRoughnessTexture_ST"); - /// Shader property ID for property metallicRoughnessTexture_Rotation - public static readonly int MetallicRoughnessMapRotationProperty = Shader.PropertyToID("metallicRoughnessTexture_Rotation"); - /// Shader property ID for property metallicRoughnessTexture_texCoord - public static readonly int MetallicRoughnessMapUVChannelProperty = Shader.PropertyToID("metallicRoughnessTexture_texCoord"); - /// Shader property ID for property occlusionTexture - public static readonly int OcclusionTextureProperty = Shader.PropertyToID("occlusionTexture"); - /// Shader property ID for property occlusionTexture_strength - public static readonly int OcclusionTextureStrengthProperty = Shader.PropertyToID("occlusionTexture_strength"); - /// Shader property ID for property occlusionTexture_Rotation - public static readonly int OcclusionTextureRotationProperty = Shader.PropertyToID("occlusionTexture_Rotation"); - /// Shader property ID for property occlusionTexture_ST - public static readonly int OcclusionTextureScaleTransformProperty = Shader.PropertyToID("occlusionTexture_ST"); - /// Shader property ID for property occlusionTexture_texCoord - public static readonly int OcclusionTextureTexCoordProperty = Shader.PropertyToID("occlusionTexture_texCoord"); - /// Shader property ID for property roughnessFactor - public static readonly int RoughnessFactorProperty = Shader.PropertyToID("roughnessFactor"); - /// Shader property ID for property specularFactor - public static readonly int SpecularFactorProperty = Shader.PropertyToID("specularFactor"); - /// Shader property ID for property specularGlossinessTexture - public static readonly int SpecularGlossinessTextureProperty = Shader.PropertyToID("specularGlossinessTexture"); - /// Shader property ID for property specularGlossinessTexture_ST - public static readonly int SpecularGlossinessTextureScaleTransformProperty = Shader.PropertyToID("specularGlossinessTexture_ST"); // TODO: Support in shader! - /// Shader property ID for property specularGlossinessTexture_Rotation - public static readonly int SpecularGlossinessTextureRotationProperty = Shader.PropertyToID("specularGlossinessTexture_Rotation"); // TODO: Support in shader! - /// Shader property ID for property specularGlossinessTexture_texCoord - public static readonly int SpecularGlossinessTextureTexCoordProperty = Shader.PropertyToID("specularGlossinessTexture_texCoord"); // TODO: Support in shader! - /// Shader property ID for property _SrcBlend - public static readonly int SrcBlendProperty = Shader.PropertyToID("_SrcBlend"); - /// Shader property ID for property _ZWrite - public static readonly int ZWriteProperty = Shader.PropertyToID("_ZWrite"); + /// + [Obsolete("Use MaterialProperty.AlphaCutoff instead.")] + public static readonly int AlphaCutoffProperty = MaterialProperty.AlphaCutoff; + /// + [Obsolete("Use MaterialProperty.BaseColor instead.")] + public static readonly int BaseColorProperty = MaterialProperty.BaseColor; + /// + [Obsolete("Use MaterialProperty.BaseColorTexture instead.")] + public static readonly int BaseColorTextureProperty = MaterialProperty.BaseColorTexture; + /// + [Obsolete("Use MaterialProperty.BaseColorTextureRotation instead.")] + public static readonly int BaseColorTextureRotationProperty = MaterialProperty.BaseColorTextureRotation; + /// + [Obsolete("Use MaterialProperty.BaseColorTextureScaleTransform instead.")] + public static readonly int BaseColorTextureScaleTransformProperty = MaterialProperty.BaseColorTextureScaleTransform; + /// + [Obsolete("Use MaterialProperty.BaseColorTextureTexCoord instead.")] + public static readonly int BaseColorTextureTexCoordProperty = MaterialProperty.BaseColorTextureTexCoord; + /// + [Obsolete("Use MaterialProperty.CullMode instead.")] + public static readonly int CullModeProperty = MaterialProperty.CullMode; + /// + [Obsolete("Use MaterialProperty.Cull instead.")] + public static readonly int CullProperty = MaterialProperty.Cull; + /// + [Obsolete("Use MaterialProperty.DstBlend instead.")] + public static readonly int DstBlendProperty = MaterialProperty.DstBlend; + /// + [Obsolete("Use MaterialProperty.DiffuseFactor instead.")] + public static readonly int DiffuseFactorProperty = MaterialProperty.DiffuseFactor; + /// + [Obsolete("Use MaterialProperty.DiffuseTexture instead.")] + public static readonly int DiffuseTextureProperty = MaterialProperty.DiffuseTexture; + /// + [Obsolete("Use MaterialProperty.DiffuseTextureScaleTransform instead.")] + public static readonly int DiffuseTextureScaleTransformProperty = MaterialProperty.DiffuseTextureScaleTransform; + /// + [Obsolete("Use MaterialProperty.DiffuseTextureRotation instead.")] + public static readonly int DiffuseTextureRotationProperty = MaterialProperty.DiffuseTextureRotation; + /// + [Obsolete("Use MaterialProperty.DiffuseTextureTexCoord instead.")] + public static readonly int DiffuseTextureTexCoordProperty = MaterialProperty.DiffuseTextureTexCoord; + /// + [Obsolete("Use MaterialProperty.EmissiveFactor instead.")] + public static readonly int EmissiveFactorProperty = MaterialProperty.EmissiveFactor; + /// + [Obsolete("Use MaterialProperty.EmissiveTexture instead.")] + public static readonly int EmissiveTextureProperty = MaterialProperty.EmissiveTexture; + /// + [Obsolete("Use MaterialProperty.EmissiveTextureRotation instead.")] + public static readonly int EmissiveTextureRotationProperty = MaterialProperty.EmissiveTextureRotation; + /// + [Obsolete("Use MaterialProperty.EmissiveTextureScaleTransform instead.")] + public static readonly int EmissiveTextureScaleTransformProperty = MaterialProperty.EmissiveTextureScaleTransform; + /// + [Obsolete("Use MaterialProperty.EmissiveTextureTexCoord instead.")] + public static readonly int EmissiveTextureTexCoordProperty = MaterialProperty.EmissiveTextureTexCoord; + /// + [Obsolete("Use MaterialProperty.GlossinessFactor instead.")] + public static readonly int GlossinessFactorProperty = MaterialProperty.GlossinessFactor; + /// + [Obsolete("Use MaterialProperty.NormalTexture instead.")] + public static readonly int NormalTextureProperty = MaterialProperty.NormalTexture; + /// + [Obsolete("Use MaterialProperty.NormalTextureRotation instead.")] + public static readonly int NormalTextureRotationProperty = MaterialProperty.NormalTextureRotation; + /// + [Obsolete("Use MaterialProperty.NormalTextureScaleTransform instead.")] + public static readonly int NormalTextureScaleTransformProperty = MaterialProperty.NormalTextureScaleTransform; + /// + [Obsolete("Use MaterialProperty.NormalTextureTexCoord instead.")] + public static readonly int NormalTextureTexCoordProperty = MaterialProperty.NormalTextureTexCoord; + /// + [Obsolete("Use MaterialProperty.NormalTextureScale instead.")] + public static readonly int NormalTextureScaleProperty = MaterialProperty.NormalTextureScale; + /// + [Obsolete("Use MaterialProperty.Metallic instead.")] + public static readonly int MetallicProperty = MaterialProperty.Metallic; + /// + [Obsolete("Use MaterialProperty.MetallicRoughnessMap instead.")] + public static readonly int MetallicRoughnessMapProperty = MaterialProperty.MetallicRoughnessMap; + /// + [Obsolete("Use MaterialProperty.MetallicRoughnessMapScaleTransform instead.")] + public static readonly int MetallicRoughnessMapScaleTransformProperty = MaterialProperty.MetallicRoughnessMapScaleTransform; + /// + [Obsolete("Use MaterialProperty.MetallicRoughnessMapRotation instead.")] + public static readonly int MetallicRoughnessMapRotationProperty = MaterialProperty.MetallicRoughnessMapRotation; + /// + [Obsolete("Use MaterialProperty.MetallicRoughnessMapTexCoord instead.")] + public static readonly int MetallicRoughnessMapUVChannelProperty = MaterialProperty.MetallicRoughnessMapTexCoord; + /// + [Obsolete("Use MaterialProperty.OcclusionTexture instead.")] + public static readonly int OcclusionTextureProperty = MaterialProperty.OcclusionTexture; + /// + [Obsolete("Use MaterialProperty.OcclusionTextureStrength instead.")] + public static readonly int OcclusionTextureStrengthProperty = MaterialProperty.OcclusionTextureStrength; + /// + [Obsolete("Use MaterialProperty.OcclusionTextureRotation instead.")] + public static readonly int OcclusionTextureRotationProperty = MaterialProperty.OcclusionTextureRotation; + /// + [Obsolete("Use MaterialProperty.OcclusionTextureScaleTransform instead.")] + public static readonly int OcclusionTextureScaleTransformProperty = MaterialProperty.OcclusionTextureScaleTransform; + /// + [Obsolete("Use MaterialProperty.OcclusionTextureTexCoord instead.")] + public static readonly int OcclusionTextureTexCoordProperty = MaterialProperty.OcclusionTextureTexCoord; + /// + [Obsolete("Use MaterialProperty.RoughnessFactor instead.")] + public static readonly int RoughnessFactorProperty = MaterialProperty.RoughnessFactor; + /// + [Obsolete("Use MaterialProperty.SpecularFactor instead.")] + public static readonly int SpecularFactorProperty = MaterialProperty.SpecularFactor; + /// + [Obsolete("Use MaterialProperty.SpecularGlossinessTexture instead.")] + public static readonly int SpecularGlossinessTextureProperty = MaterialProperty.SpecularGlossinessTexture; + /// + [Obsolete("Use MaterialProperty.SpecularGlossinessTextureScaleTransform instead.")] + public static readonly int SpecularGlossinessTextureScaleTransformProperty = MaterialProperty.SpecularGlossinessTextureScaleTransform; + /// + [Obsolete("Use MaterialProperty.SpecularGlossinessTextureRotation instead.")] + public static readonly int SpecularGlossinessTextureRotationProperty = MaterialProperty.SpecularGlossinessTextureRotation; + /// + [Obsolete("Use MaterialProperty.SpecularGlossinessTextureTexCoord instead.")] + public static readonly int SpecularGlossinessTextureTexCoordProperty = MaterialProperty.SpecularGlossinessTextureTexCoord; + /// + [Obsolete("Use MaterialProperty.SrcBlend instead.")] + public static readonly int SrcBlendProperty = MaterialProperty.SrcBlend; + /// + [Obsolete("Use MaterialProperty.ZWrite instead.")] + public static readonly int ZWriteProperty = MaterialProperty.ZWrite; // ReSharper restore MemberCanBeProtected.Global // ReSharper restore MemberCanBePrivate.Global diff --git a/Runtime/Scripts/Material/MaterialProperty.cs b/Runtime/Scripts/Material/MaterialProperty.cs new file mode 100644 index 00000000..9e95c8ef --- /dev/null +++ b/Runtime/Scripts/Material/MaterialProperty.cs @@ -0,0 +1,119 @@ +// SPDX-FileCopyrightText: 2024 Unity Technologies and the glTFast authors +// SPDX-License-Identifier: Apache-2.0 + +using System; +using UnityEngine; + +namespace GLTFast.Materials +{ + /// + /// Holds static material property identifiers. + /// + public static class MaterialProperty + { + /// Shader property ID for property alphaCutoff + public static readonly int AlphaCutoff = Shader.PropertyToID("alphaCutoff"); + /// Shader property ID for property baseColorTexture + public static readonly int BaseColor = Shader.PropertyToID("baseColorFactor"); + /// Shader property ID for property baseColorTexture + public static readonly int BaseColorTexture = Shader.PropertyToID("baseColorTexture"); + /// Shader property ID for property baseColorTexture_Rotation + public static readonly int BaseColorTextureRotation = Shader.PropertyToID("baseColorTexture_Rotation"); + /// Shader property ID for property baseColorTexture_ST + public static readonly int BaseColorTextureScaleTransform = Shader.PropertyToID("baseColorTexture_ST"); + /// Shader property ID for property baseColorTexture_texCoord + public static readonly int BaseColorTextureTexCoord = Shader.PropertyToID("baseColorTexture_texCoord"); + /// Shader property ID for property _Cull + public static readonly int Cull = Shader.PropertyToID("_Cull"); + /// Shader property ID for property _CullMode + public static readonly int CullMode = Shader.PropertyToID("_CullMode"); + /// Shader property ID for property _DstBlend + public static readonly int DstBlend = Shader.PropertyToID("_DstBlend"); + /// Shader property ID for property diffuseFactor + public static readonly int DiffuseFactor = Shader.PropertyToID("diffuseFactor"); + /// Shader property ID for property diffuseTexture + public static readonly int DiffuseTexture = Shader.PropertyToID("diffuseTexture"); + /// Shader property ID for property diffuseTexture_ST + public static readonly int DiffuseTextureScaleTransform = Shader.PropertyToID("diffuseTexture_ST"); + /// Shader property ID for property diffuseTexture_Rotation + public static readonly int DiffuseTextureRotation = Shader.PropertyToID("diffuseTexture_Rotation"); + /// Shader property ID for property diffuseTexture_texCoord + public static readonly int DiffuseTextureTexCoord = Shader.PropertyToID("diffuseTexture_texCoord"); + /// Shader property ID for property emissiveFactor + public static readonly int EmissiveFactor = Shader.PropertyToID("emissiveFactor"); + /// Shader property ID for property emissiveTexture + public static readonly int EmissiveTexture = Shader.PropertyToID("emissiveTexture"); + /// Shader property ID for property emissiveTexture_Rotation + public static readonly int EmissiveTextureRotation = Shader.PropertyToID("emissiveTexture_Rotation"); + /// Shader property ID for property emissiveTexture_ST + public static readonly int EmissiveTextureScaleTransform = Shader.PropertyToID("emissiveTexture_ST"); + /// Shader property ID for property emissiveTexture_texCoord + public static readonly int EmissiveTextureTexCoord = Shader.PropertyToID("emissiveTexture_texCoord"); + /// Shader property ID for property glossinessFactor + public static readonly int GlossinessFactor = Shader.PropertyToID("glossinessFactor"); + /// Shader property ID for property normalTexture + public static readonly int NormalTexture = Shader.PropertyToID("normalTexture"); + /// Shader property ID for property normalTexture_Rotation + public static readonly int NormalTextureRotation = Shader.PropertyToID("normalTexture_Rotation"); + /// Shader property ID for property normalTexture_ST + public static readonly int NormalTextureScaleTransform = Shader.PropertyToID("normalTexture_ST"); + /// Shader property ID for property normalTexture_texCoord + public static readonly int NormalTextureTexCoord = Shader.PropertyToID("normalTexture_texCoord"); + /// Shader property ID for property normalTexture_scale + public static readonly int NormalTextureScale = Shader.PropertyToID("normalTexture_scale"); + /// Shader property ID for property metallicFactor + public static readonly int Metallic = Shader.PropertyToID("metallicFactor"); + /// Shader property ID for property metallicRoughnessTexture + public static readonly int MetallicRoughnessMap = Shader.PropertyToID("metallicRoughnessTexture"); + /// Shader property ID for property metallicRoughnessTexture_ST + public static readonly int MetallicRoughnessMapScaleTransform = Shader.PropertyToID("metallicRoughnessTexture_ST"); + /// Shader property ID for property metallicRoughnessTexture_Rotation + public static readonly int MetallicRoughnessMapRotation = Shader.PropertyToID("metallicRoughnessTexture_Rotation"); + /// Shader property ID for property metallicRoughnessTexture_texCoord + public static readonly int MetallicRoughnessMapTexCoord = Shader.PropertyToID("metallicRoughnessTexture_texCoord"); + /// Shader property ID for property _Mode + public static readonly int Mode = Shader.PropertyToID("_Mode"); + /// Shader property ID for property occlusionTexture + public static readonly int OcclusionTexture = Shader.PropertyToID("occlusionTexture"); + /// Shader property ID for property occlusionTexture_strength + public static readonly int OcclusionTextureStrength = Shader.PropertyToID("occlusionTexture_strength"); + /// Shader property ID for property occlusionTexture_Rotation + public static readonly int OcclusionTextureRotation = Shader.PropertyToID("occlusionTexture_Rotation"); + /// Shader property ID for property occlusionTexture_ST + public static readonly int OcclusionTextureScaleTransform = Shader.PropertyToID("occlusionTexture_ST"); + /// Shader property ID for property occlusionTexture_texCoord + public static readonly int OcclusionTextureTexCoord = Shader.PropertyToID("occlusionTexture_texCoord"); + /// Shader property ID for property roughnessFactor + public static readonly int RoughnessFactor = Shader.PropertyToID("roughnessFactor"); + /// Shader property ID for property specularFactor + public static readonly int SpecularFactor = Shader.PropertyToID("specularFactor"); + /// Shader property ID for property specularGlossinessTexture + public static readonly int SpecularGlossinessTexture = Shader.PropertyToID("specularGlossinessTexture"); + /// Shader property ID for property specularGlossinessTexture_ST + public static readonly int SpecularGlossinessTextureScaleTransform = Shader.PropertyToID("specularGlossinessTexture_ST"); // TODO: Support in shader! + /// Shader property ID for property specularGlossinessTexture_Rotation + public static readonly int SpecularGlossinessTextureRotation = Shader.PropertyToID("specularGlossinessTexture_Rotation"); // TODO: Support in shader! + /// Shader property ID for property specularGlossinessTexture_texCoord + public static readonly int SpecularGlossinessTextureTexCoord = Shader.PropertyToID("specularGlossinessTexture_texCoord"); // TODO: Support in shader! + /// Shader property ID for property _SrcBlend + public static readonly int SrcBlend = Shader.PropertyToID("_SrcBlend"); + /// Shader property ID for property _ZWrite + public static readonly int ZWrite = Shader.PropertyToID("_ZWrite"); + +#if UNITY_SHADER_GRAPH + /// Shader property ID for property _AlphaClip + public static readonly int AlphaClip = Shader.PropertyToID("_AlphaClip"); + /// Shader property ID for property _Surface + public static readonly int Surface = Shader.PropertyToID("_Surface"); +#endif + +#if USING_HDRP + /// Shader property ID for property _AlphaCutoffEnable + public static readonly int AlphaCutoffEnable = Shader.PropertyToID("_AlphaCutoffEnable"); + /// Shader property ID for property _DoubleSidedEnable + public static readonly int DoubleSidedEnable = Shader.PropertyToID("_DoubleSidedEnable"); + /// Shader property ID for property _SurfaceType + public static readonly int SurfaceType = Shader.PropertyToID("_SurfaceType"); +#endif + } +} diff --git a/Runtime/Scripts/Material/MaterialProperty.cs.meta b/Runtime/Scripts/Material/MaterialProperty.cs.meta new file mode 100644 index 00000000..85843ebe --- /dev/null +++ b/Runtime/Scripts/Material/MaterialProperty.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 46ffb279168944b629c5b48e26eeba18 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Scripts/Material/ShaderGraphMaterialGenerator.cs b/Runtime/Scripts/Material/ShaderGraphMaterialGenerator.cs index 8f758400..7fa78893 100644 --- a/Runtime/Scripts/Material/ShaderGraphMaterialGenerator.cs +++ b/Runtime/Scripts/Material/ShaderGraphMaterialGenerator.cs @@ -266,32 +266,32 @@ public override Material GenerateMaterial( PbrSpecularGlossiness specGloss = gltfMaterial.Extensions.KHR_materials_pbrSpecularGlossiness; if (specGloss != null) { baseColorLinear = specGloss.DiffuseColor; - material.SetVector( DiffuseFactorProperty, specGloss.DiffuseColor.gamma); + material.SetVector( MaterialProperty.DiffuseFactor, specGloss.DiffuseColor.gamma); #if UNITY_SHADER_GRAPH_12_OR_NEWER - material.SetVector(SpecularFactorProperty, specGloss.SpecularColor); + material.SetVector(MaterialProperty.SpecularFactor, specGloss.SpecularColor); #else - material.SetVector(SpecularFactorProperty, specGloss.SpecularColor); + material.SetVector(MaterialProperty.SpecularFactor, specGloss.SpecularColor); #endif - material.SetFloat(GlossinessFactorProperty, specGloss.glossinessFactor); + material.SetFloat(MaterialProperty.GlossinessFactor, specGloss.glossinessFactor); TrySetTexture( specGloss.diffuseTexture, material, gltf, - DiffuseTextureProperty, - DiffuseTextureScaleTransformProperty, - DiffuseTextureRotationProperty, - DiffuseTextureTexCoordProperty + MaterialProperty.DiffuseTexture, + MaterialProperty.DiffuseTextureScaleTransform, + MaterialProperty.DiffuseTextureRotation, + MaterialProperty.DiffuseTextureTexCoord ); if (TrySetTexture( specGloss.specularGlossinessTexture, material, gltf, - SpecularGlossinessTextureProperty, - SpecularGlossinessTextureScaleTransformProperty, - SpecularGlossinessTextureRotationProperty, - SpecularGlossinessTextureTexCoordProperty + MaterialProperty.SpecularGlossinessTexture, + MaterialProperty.SpecularGlossinessTextureScaleTransform, + MaterialProperty.SpecularGlossinessTextureRotation, + MaterialProperty.SpecularGlossinessTextureTexCoord )) { // material.EnableKeyword(); @@ -321,17 +321,17 @@ public override Material GenerateMaterial( if (materialType==MaterialType.MetallicRoughness) { - material.SetFloat(MetallicProperty, gltfMaterial.PbrMetallicRoughness.metallicFactor ); - material.SetFloat(RoughnessFactorProperty, gltfMaterial.PbrMetallicRoughness.roughnessFactor ); + material.SetFloat(MaterialProperty.Metallic, gltfMaterial.PbrMetallicRoughness.metallicFactor ); + material.SetFloat(MaterialProperty.RoughnessFactor, gltfMaterial.PbrMetallicRoughness.roughnessFactor ); if(TrySetTexture( gltfMaterial.PbrMetallicRoughness.MetallicRoughnessTexture, material, gltf, - MetallicRoughnessMapProperty, - MetallicRoughnessMapScaleTransformProperty, - MetallicRoughnessMapRotationProperty, - MetallicRoughnessMapUVChannelProperty + MaterialProperty.MetallicRoughnessMap, + MaterialProperty.MetallicRoughnessMapScaleTransform, + MaterialProperty.MetallicRoughnessMapRotation, + MaterialProperty.MetallicRoughnessMapTexCoord )) { // material.EnableKeyword(KW_METALLIC_ROUGHNESS_MAP); } @@ -347,36 +347,36 @@ public override Material GenerateMaterial( gltfMaterial.NormalTexture, material, gltf, - NormalTextureProperty, - NormalTextureScaleTransformProperty, - NormalTextureRotationProperty, - NormalTextureTexCoordProperty + MaterialProperty.NormalTexture, + MaterialProperty.NormalTextureScaleTransform, + MaterialProperty.NormalTextureRotation, + MaterialProperty.NormalTextureTexCoord )) { // material.EnableKeyword(ShaderKeyword.normalMap); - material.SetFloat(NormalTextureScaleProperty,gltfMaterial.NormalTexture.scale); + material.SetFloat(MaterialProperty.NormalTextureScale,gltfMaterial.NormalTexture.scale); } if(TrySetTexture( gltfMaterial.OcclusionTexture, material, gltf, - OcclusionTextureProperty, - OcclusionTextureScaleTransformProperty, - OcclusionTextureRotationProperty, - OcclusionTextureTexCoordProperty + MaterialProperty.OcclusionTexture, + MaterialProperty.OcclusionTextureScaleTransform, + MaterialProperty.OcclusionTextureRotation, + MaterialProperty.OcclusionTextureTexCoord )) { material.EnableKeyword(k_OcclusionKeyword); - material.SetFloat(OcclusionTextureStrengthProperty,gltfMaterial.OcclusionTexture.strength); + material.SetFloat(MaterialProperty.OcclusionTextureStrength,gltfMaterial.OcclusionTexture.strength); } if(TrySetTexture( gltfMaterial.EmissiveTexture, material, gltf, - EmissiveTextureProperty, - EmissiveTextureScaleTransformProperty, - EmissiveTextureRotationProperty, - EmissiveTextureTexCoordProperty + MaterialProperty.EmissiveTexture, + MaterialProperty.EmissiveTextureScaleTransform, + MaterialProperty.EmissiveTextureRotation, + MaterialProperty.EmissiveTextureTexCoord )) { material.EnableKeyword(k_EmissiveKeyword); } @@ -399,7 +399,7 @@ public override Material GenerateMaterial( #endif renderQueue = RenderQueue.AlphaTest; } else { - material.SetFloat(AlphaCutoffProperty, 0); + material.SetFloat(MaterialProperty.AlphaCutoff, 0); // double sided opaque would make errors in HDRP 7.3 otherwise material.SetOverrideTag(MotionVectorTag,MotionVectorUser); material.SetShaderPassEnabled(MotionVectorsPass,false); @@ -432,10 +432,10 @@ public override Material GenerateMaterial( break; } - material.SetVector(BaseColorProperty, baseColorLinear.gamma); + material.SetVector(MaterialProperty.BaseColor, baseColorLinear.gamma); if(gltfMaterial.Emissive != Color.black) { - material.SetColor(EmissiveFactorProperty, gltfMaterial.Emissive); + material.SetColor(MaterialProperty.EmissiveFactor, gltfMaterial.Emissive); material.EnableKeyword(k_EmissiveKeyword); } @@ -600,7 +600,7 @@ protected virtual void SetDoubleSided(MaterialBase gltfMaterial, Material materi } protected virtual void SetAlphaModeMask(MaterialBase gltfMaterial, Material material) { - material.SetFloat(AlphaCutoffProperty, gltfMaterial.alphaCutoff); + material.SetFloat(MaterialProperty.AlphaCutoff, gltfMaterial.alphaCutoff); #if USING_HDRP_10_OR_NEWER || USING_URP_12_OR_NEWER material.EnableKeyword(AlphaTestOnKeyword); material.SetOverrideTag(RenderTypeTag, TransparentCutoutRenderType); diff --git a/Runtime/Scripts/Material/StandardShaderMode.cs b/Runtime/Scripts/Material/StandardShaderMode.cs new file mode 100644 index 00000000..2c4b56ca --- /dev/null +++ b/Runtime/Scripts/Material/StandardShaderMode.cs @@ -0,0 +1,30 @@ +// SPDX-FileCopyrightText: 2024 Unity Technologies and the glTFast authors +// SPDX-License-Identifier: Apache-2.0 + +using System; + +namespace GLTFast.Materials +{ + /// + /// Built-In render pipeline Standard shader modes + /// + public enum StandardShaderMode + { + /// + /// Opaque mode + /// + Opaque = 0, + /// + /// Cutout mode (alpha test) + /// + Cutout = 1, + /// + /// Fade mode (alpha blended opacity) + /// + Fade = 2, + /// + /// Transparent mode (alpha blended transmission; e.g. glass) + /// + Transparent = 3 + } +} diff --git a/Runtime/Scripts/Material/StandardShaderMode.cs.meta b/Runtime/Scripts/Material/StandardShaderMode.cs.meta new file mode 100644 index 00000000..3a0ab76b --- /dev/null +++ b/Runtime/Scripts/Material/StandardShaderMode.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: a715adcf96ba44d4942421825c100be0 +timeCreated: 1714414594 \ No newline at end of file diff --git a/Runtime/Scripts/Material/UniveralRPMaterialGenerator.cs b/Runtime/Scripts/Material/UniveralRPMaterialGenerator.cs index 354ba591..a7e7d6e4 100644 --- a/Runtime/Scripts/Material/UniveralRPMaterialGenerator.cs +++ b/Runtime/Scripts/Material/UniveralRPMaterialGenerator.cs @@ -25,9 +25,6 @@ public class UniversalRPMaterialGenerator : ShaderGraphMaterialGenerator { static bool s_SupportsCameraOpaqueTexture; #if USING_URP_12_OR_NEWER - static readonly int k_AlphaClipPropId = Shader.PropertyToID("_AlphaClip"); - static readonly int k_SurfacePropId = Shader.PropertyToID("_Surface"); - #if UNITY_EDITOR /// Guid of the shader graph with clearcoat support const string k_MetallicClearcoatShaderGuid = "c18c97ae1ce021b4980c5d19a54f0d3c"; @@ -46,12 +43,12 @@ public UniversalRPMaterialGenerator(UniversalRenderPipelineAsset renderPipelineA #if USING_URP_12_OR_NEWER protected override void SetDoubleSided(MaterialBase gltfMaterial, Material material) { base.SetDoubleSided(gltfMaterial,material); - material.SetFloat(CullProperty, (int)CullMode.Off); + material.SetFloat(MaterialProperty.Cull, (int)CullMode.Off); } protected override void SetAlphaModeMask(MaterialBase gltfMaterial, Material material) { base.SetAlphaModeMask(gltfMaterial, material); - material.SetFloat(k_AlphaClipPropId, 1); + material.SetFloat(MaterialProperty.AlphaClip, 1); } protected override void SetShaderModeBlend(MaterialBase gltfMaterial, Material material) { @@ -64,12 +61,12 @@ protected override void SetShaderModeBlend(MaterialBase gltfMaterial, Material m material.SetShaderPassEnabled(ShaderPassTransparentBackface, false); material.SetShaderPassEnabled(ShaderPassRayTracingPrepass, false); material.SetShaderPassEnabled(ShaderPassDepthOnlyPass, false); - material.SetFloat(SrcBlendProperty, (int) BlendMode.SrcAlpha);//5 - material.SetFloat(DstBlendProperty, (int)BlendMode.OneMinusSrcAlpha);//10 + material.SetFloat(MaterialProperty.SrcBlend, (int) BlendMode.SrcAlpha);//5 + material.SetFloat(MaterialProperty.DstBlend, (int)BlendMode.OneMinusSrcAlpha);//10 material.SetFloat(ZTestGBufferProperty, (int)CompareFunction.Equal); //3 material.SetFloat(AlphaDstBlendProperty, (int)BlendMode.OneMinusSrcAlpha);//10 - material.SetFloat(k_SurfacePropId, 1); - material.SetFloat(ZWriteProperty, 0); + material.SetFloat(MaterialProperty.Surface, 1); + material.SetFloat(MaterialProperty.ZWrite, 0); } /// diff --git a/Runtime/Scripts/Schema/Skin.cs b/Runtime/Scripts/Schema/Skin.cs index 04a2854d..de1f3cce 100644 --- a/Runtime/Scripts/Schema/Skin.cs +++ b/Runtime/Scripts/Schema/Skin.cs @@ -31,8 +31,23 @@ internal void GltfSerialize(JsonWriter writer) { writer.AddObject(); GltfSerializeName(writer); + + if (inverseBindMatrices != -1) + { + writer.AddProperty("inverseBindMatrices", inverseBindMatrices); + } + + if (skeleton != -1) + { + writer.AddProperty("skeleton", skeleton); + } + + if (joints != null) + { + writer.AddArrayProperty("joints", joints); + } + writer.Close(); - throw new System.NotImplementedException($"GltfSerialize missing on {GetType()}"); } } } diff --git a/Runtime/Scripts/UvTransform.cs b/Runtime/Scripts/UvTransform.cs new file mode 100644 index 00000000..e49ace06 --- /dev/null +++ b/Runtime/Scripts/UvTransform.cs @@ -0,0 +1,40 @@ +// SPDX-FileCopyrightText: 2024 Unity Technologies and the glTFast authors +// SPDX-License-Identifier: Apache-2.0 + +using Unity.Mathematics; +using UnityEngine; + +namespace GLTFast +{ + struct UvTransform + { + public float rotation; + public float2 scale; + + public static UvTransform FromMaterial(Material material, int scaleTransformPropertyId, int rotationPropertyId) + { + var st = material.GetVector(scaleTransformPropertyId); + var r = material.GetVector(rotationPropertyId); + + return FromMatrix( + new float2x2(st.x, st.y, r.x, r.y) + ); + } + + public static UvTransform FromMatrix(float2x2 scaleRotation) + { + var result = new UvTransform + { + scale = new float2( + Mathematics.Normalize(new float2(scaleRotation.c0.x, scaleRotation.c1.y), out var r1), + Mathematics.Normalize(new float2(scaleRotation.c0.y, scaleRotation.c1.x), out var r2) + ) + }; + + var acos = math.acos(r1.x); + if (r2.x < 0) acos = math.PI * 2 - acos; + result.rotation = acos * math.TODEGREES; + return result; + } + } +} diff --git a/Runtime/Scripts/UvTransform.cs.meta b/Runtime/Scripts/UvTransform.cs.meta new file mode 100644 index 00000000..b7eb92fd --- /dev/null +++ b/Runtime/Scripts/UvTransform.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 510ed86a32ba54bd686670620424afbc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Scripts/glTFast.asmdef b/Runtime/Scripts/glTFast.asmdef index abe37c44..f2c3b0f0 100644 --- a/Runtime/Scripts/glTFast.asmdef +++ b/Runtime/Scripts/glTFast.asmdef @@ -89,6 +89,11 @@ "expression": "12", "define": "USING_URP_12_OR_NEWER" }, + { + "name": "com.unity.shadergraph", + "expression": "", + "define": "UNITY_SHADER_GRAPH" + }, { "name": "com.unity.shadergraph", "expression": "12", diff --git a/Tests/Resources/Export.meta b/Tests/Resources/Export.meta new file mode 100644 index 00000000..b53829dc --- /dev/null +++ b/Tests/Resources/Export.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7952bc0a685044205ab7791335bd308c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials.meta b/Tests/Resources/Export/Materials.meta new file mode 100644 index 00000000..dcc1f69b --- /dev/null +++ b/Tests/Resources/Export/Materials.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0f9c1b74a1ffd4def81c74710cb8019f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/Built-In.meta b/Tests/Resources/Export/Materials/Built-In.meta new file mode 100644 index 00000000..6423e997 --- /dev/null +++ b/Tests/Resources/Export/Materials/Built-In.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 47052910485b343edb79884a9b5aeb4f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/Built-In/BaseColor.mat b/Tests/Resources/Export/Materials/Built-In/BaseColor.mat new file mode 100644 index 00000000..44c678f0 --- /dev/null +++ b/Tests/Resources/Export/Materials/Built-In/BaseColor.mat @@ -0,0 +1,67 @@ +%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: BaseColor + m_Shader: {fileID: 4800000, guid: 99fa998bbbed3408aafa652b466d261d, type: 3} + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 1 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _CullMode: 0 + - _DstBlend: 0 + - _Mode: 0 + - _SrcBlend: 1 + - _ZWrite: 1 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 0.5 + m_Colors: + - baseColorFactor: {r: 0.48452914, g: 0.7353569, b: 0.880825, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] diff --git a/Tests/Resources/Export/Materials/Built-In/BaseColor.mat.meta b/Tests/Resources/Export/Materials/Built-In/BaseColor.mat.meta new file mode 100644 index 00000000..7fd3a33e --- /dev/null +++ b/Tests/Resources/Export/Materials/Built-In/BaseColor.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 80eff3504ca1e481fa92ece0de4b930a +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/Built-In/BaseColorTexture.mat b/Tests/Resources/Export/Materials/Built-In/BaseColorTexture.mat new file mode 100644 index 00000000..eb42dd2c --- /dev/null +++ b/Tests/Resources/Export/Materials/Built-In/BaseColorTexture.mat @@ -0,0 +1,67 @@ +%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: BaseColorTexture + m_Shader: {fileID: 4800000, guid: 99fa998bbbed3408aafa652b466d261d, type: 3} + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 1 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 2800000, guid: 767b013dd53264d2a858edf8651b320d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _CullMode: 0 + - _DstBlend: 0 + - _Mode: 0 + - _SrcBlend: 1 + - _ZWrite: 1 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 0.5 + m_Colors: + - baseColorFactor: {r: 0.9, g: 0.8, b: 0.7, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] diff --git a/Tests/Resources/Export/Materials/Built-In/BaseColorTexture.mat.meta b/Tests/Resources/Export/Materials/Built-In/BaseColorTexture.mat.meta new file mode 100644 index 00000000..0b40b371 --- /dev/null +++ b/Tests/Resources/Export/Materials/Built-In/BaseColorTexture.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bbf033fcc7dba47a38b1d2c8831631e8 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/Built-In/BaseColorTextureCutout.mat b/Tests/Resources/Export/Materials/Built-In/BaseColorTextureCutout.mat new file mode 100644 index 00000000..e495ce5a --- /dev/null +++ b/Tests/Resources/Export/Materials/Built-In/BaseColorTextureCutout.mat @@ -0,0 +1,67 @@ +%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: BaseColorTextureCutout + m_Shader: {fileID: 4800000, guid: 99fa998bbbed3408aafa652b466d261d, type: 3} + m_ShaderKeywords: _ALPHATEST_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 1 + m_CustomRenderQueue: 2450 + stringTagMap: + RenderType: TransparentCutout + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 2800000, guid: 1e22bd6b46ceb4d0c99cfdb552ec8586, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _CullMode: 2 + - _DstBlend: 0 + - _Mode: 1 + - _SrcBlend: 1 + - _ZWrite: 1 + - alphaCutoff: 0.6 + - baseColorTexture_texCoord: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 0 + m_Colors: + - baseColorFactor: {r: 0.9, g: 0.8, b: 0.7, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] diff --git a/Tests/Resources/Export/Materials/Built-In/BaseColorTextureCutout.mat.meta b/Tests/Resources/Export/Materials/Built-In/BaseColorTextureCutout.mat.meta new file mode 100644 index 00000000..89abd9d1 --- /dev/null +++ b/Tests/Resources/Export/Materials/Built-In/BaseColorTextureCutout.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5b914df6eb36642f6ab65059988ac09b +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/Built-In/BaseColorTextureRotated.mat b/Tests/Resources/Export/Materials/Built-In/BaseColorTextureRotated.mat new file mode 100644 index 00000000..b611c915 --- /dev/null +++ b/Tests/Resources/Export/Materials/Built-In/BaseColorTextureRotated.mat @@ -0,0 +1,67 @@ +%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: BaseColorTextureRotated + m_Shader: {fileID: 4800000, guid: 99fa998bbbed3408aafa652b466d261d, type: 3} + m_ShaderKeywords: _TEXTURE_TRANSFORM + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 1 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 2800000, guid: 767b013dd53264d2a858edf8651b320d, type: 3} + m_Scale: {x: 0.70710677, y: 0.70710677} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _CullMode: 0 + - _DstBlend: 0 + - _Mode: 0 + - _SrcBlend: 1 + - _ZWrite: 1 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 0.5 + m_Colors: + - baseColorFactor: {r: 0.9, g: 0.8, b: 0.7, a: 1} + - baseColorTexture_Rotation: {r: 0.70710677, g: -0.70710677, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] diff --git a/Tests/Resources/Export/Materials/Built-In/BaseColorTextureRotated.mat.meta b/Tests/Resources/Export/Materials/Built-In/BaseColorTextureRotated.mat.meta new file mode 100644 index 00000000..e6b053fe --- /dev/null +++ b/Tests/Resources/Export/Materials/Built-In/BaseColorTextureRotated.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c4131b7e7f6bc4425813ec057b530fb6 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/Built-In/BaseColorTextureScaled.mat b/Tests/Resources/Export/Materials/Built-In/BaseColorTextureScaled.mat new file mode 100644 index 00000000..59e17a7d --- /dev/null +++ b/Tests/Resources/Export/Materials/Built-In/BaseColorTextureScaled.mat @@ -0,0 +1,67 @@ +%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: BaseColorTextureScaled + m_Shader: {fileID: 4800000, guid: 99fa998bbbed3408aafa652b466d261d, type: 3} + m_ShaderKeywords: _TEXTURE_TRANSFORM + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 1 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 2800000, guid: 767b013dd53264d2a858edf8651b320d, type: 3} + m_Scale: {x: 1.2, y: 1.3} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _CullMode: 0 + - _DstBlend: 0 + - _Mode: 0 + - _SrcBlend: 1 + - _ZWrite: 1 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 0.5 + m_Colors: + - baseColorFactor: {r: 0.9, g: 0.8, b: 0.7, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] diff --git a/Tests/Resources/Export/Materials/Built-In/BaseColorTextureScaled.mat.meta b/Tests/Resources/Export/Materials/Built-In/BaseColorTextureScaled.mat.meta new file mode 100644 index 00000000..3a425a65 --- /dev/null +++ b/Tests/Resources/Export/Materials/Built-In/BaseColorTextureScaled.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 85ba04bd97c034de78bd0ec7e4cb3819 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/Built-In/BaseColorTextureTranslated.mat b/Tests/Resources/Export/Materials/Built-In/BaseColorTextureTranslated.mat new file mode 100644 index 00000000..cd23cd49 --- /dev/null +++ b/Tests/Resources/Export/Materials/Built-In/BaseColorTextureTranslated.mat @@ -0,0 +1,67 @@ +%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: BaseColorTextureTranslated + m_Shader: {fileID: 4800000, guid: 99fa998bbbed3408aafa652b466d261d, type: 3} + m_ShaderKeywords: _TEXTURE_TRANSFORM + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 1 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 2800000, guid: 767b013dd53264d2a858edf8651b320d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0.4, y: 0.6} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _CullMode: 0 + - _DstBlend: 0 + - _Mode: 0 + - _SrcBlend: 1 + - _ZWrite: 1 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 0.5 + m_Colors: + - baseColorFactor: {r: 0.9, g: 0.8, b: 0.7, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] diff --git a/Tests/Resources/Export/Materials/Built-In/BaseColorTextureTranslated.mat.meta b/Tests/Resources/Export/Materials/Built-In/BaseColorTextureTranslated.mat.meta new file mode 100644 index 00000000..f3d3ae96 --- /dev/null +++ b/Tests/Resources/Export/Materials/Built-In/BaseColorTextureTranslated.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 710978f54602d42a797a2f7ed35a4cfe +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/Built-In/BaseColorTextureTransparent.mat b/Tests/Resources/Export/Materials/Built-In/BaseColorTextureTransparent.mat new file mode 100644 index 00000000..2bf68311 --- /dev/null +++ b/Tests/Resources/Export/Materials/Built-In/BaseColorTextureTransparent.mat @@ -0,0 +1,67 @@ +%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: BaseColorTextureTransparent + m_Shader: {fileID: 4800000, guid: 99fa998bbbed3408aafa652b466d261d, type: 3} + m_ShaderKeywords: _ALPHABLEND_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 1 + m_CustomRenderQueue: 3000 + stringTagMap: + RenderType: Fade + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 2800000, guid: 1e22bd6b46ceb4d0c99cfdb552ec8586, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _CullMode: 2 + - _DstBlend: 10 + - _Mode: 2 + - _SrcBlend: 5 + - _ZWrite: 0 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 0 + m_Colors: + - baseColorFactor: {r: 0.9, g: 0.8, b: 0.7, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] diff --git a/Tests/Resources/Export/Materials/Built-In/BaseColorTextureTransparent.mat.meta b/Tests/Resources/Export/Materials/Built-In/BaseColorTextureTransparent.mat.meta new file mode 100644 index 00000000..07ea7ec8 --- /dev/null +++ b/Tests/Resources/Export/Materials/Built-In/BaseColorTextureTransparent.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e2663bf7c8a9a4b1591e6845b56b0726 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/Built-In/DoubleSided.mat b/Tests/Resources/Export/Materials/Built-In/DoubleSided.mat new file mode 100644 index 00000000..a298309c --- /dev/null +++ b/Tests/Resources/Export/Materials/Built-In/DoubleSided.mat @@ -0,0 +1,67 @@ +%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: DoubleSided + m_Shader: {fileID: 4800000, guid: 99fa998bbbed3408aafa652b466d261d, type: 3} + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 1 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _CullMode: 0 + - _DstBlend: 0 + - _Mode: 0 + - _SrcBlend: 1 + - _ZWrite: 1 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 0.7 + m_Colors: + - baseColorFactor: {r: 0, g: 0.32675865, b: 1, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] diff --git a/Tests/Resources/Export/Materials/Built-In/DoubleSided.mat.meta b/Tests/Resources/Export/Materials/Built-In/DoubleSided.mat.meta new file mode 100644 index 00000000..20bbdb42 --- /dev/null +++ b/Tests/Resources/Export/Materials/Built-In/DoubleSided.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4bdd9ed023c9a4e509fe6b05fb68f71e +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/Built-In/EmissiveFactor.mat b/Tests/Resources/Export/Materials/Built-In/EmissiveFactor.mat new file mode 100644 index 00000000..3101a7c5 --- /dev/null +++ b/Tests/Resources/Export/Materials/Built-In/EmissiveFactor.mat @@ -0,0 +1,67 @@ +%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: EmissiveFactor + m_Shader: {fileID: 4800000, guid: 99fa998bbbed3408aafa652b466d261d, type: 3} + m_ShaderKeywords: _EMISSION + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 1 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _CullMode: 2 + - _DstBlend: 0 + - _Mode: 0 + - _SrcBlend: 1 + - _ZWrite: 1 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 1 + m_Colors: + - baseColorFactor: {r: 0, g: 0, b: 0, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 1, g: 1, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] diff --git a/Tests/Resources/Export/Materials/Built-In/EmissiveFactor.mat.meta b/Tests/Resources/Export/Materials/Built-In/EmissiveFactor.mat.meta new file mode 100644 index 00000000..d488bdcc --- /dev/null +++ b/Tests/Resources/Export/Materials/Built-In/EmissiveFactor.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ac8c5cd7cb45a4783b5f82543256b871 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/Built-In/EmissiveTexture.mat b/Tests/Resources/Export/Materials/Built-In/EmissiveTexture.mat new file mode 100644 index 00000000..b3838fd4 --- /dev/null +++ b/Tests/Resources/Export/Materials/Built-In/EmissiveTexture.mat @@ -0,0 +1,67 @@ +%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: EmissiveTexture + m_Shader: {fileID: 4800000, guid: 99fa998bbbed3408aafa652b466d261d, type: 3} + m_ShaderKeywords: _EMISSION + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 1 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 2800000, guid: f53f6abdff34c42bf8b9a9487f5fba4d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _CullMode: 2 + - _DstBlend: 0 + - _Mode: 0 + - _SrcBlend: 1 + - _ZWrite: 1 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 1 + m_Colors: + - baseColorFactor: {r: 0, g: 0, b: 0, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 1, g: 1, b: 1, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] diff --git a/Tests/Resources/Export/Materials/Built-In/EmissiveTexture.mat.meta b/Tests/Resources/Export/Materials/Built-In/EmissiveTexture.mat.meta new file mode 100644 index 00000000..7740aece --- /dev/null +++ b/Tests/Resources/Export/Materials/Built-In/EmissiveTexture.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c2014ccd823b04e2b8bf470d5152e9fa +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/Built-In/EmissiveTextureFactor.mat b/Tests/Resources/Export/Materials/Built-In/EmissiveTextureFactor.mat new file mode 100644 index 00000000..0c8c2d66 --- /dev/null +++ b/Tests/Resources/Export/Materials/Built-In/EmissiveTextureFactor.mat @@ -0,0 +1,67 @@ +%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: EmissiveTextureFactor + m_Shader: {fileID: 4800000, guid: 99fa998bbbed3408aafa652b466d261d, type: 3} + m_ShaderKeywords: _EMISSION _TEXTURE_TRANSFORM + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 1 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 2800000, guid: f53f6abdff34c42bf8b9a9487f5fba4d, type: 3} + m_Scale: {x: 2, y: 3} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _CullMode: 2 + - _DstBlend: 0 + - _Mode: 0 + - _SrcBlend: 1 + - _ZWrite: 1 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 1 + m_Colors: + - baseColorFactor: {r: 0, g: 0, b: 0, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 1, g: 0.7353569, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] diff --git a/Tests/Resources/Export/Materials/Built-In/EmissiveTextureFactor.mat.meta b/Tests/Resources/Export/Materials/Built-In/EmissiveTextureFactor.mat.meta new file mode 100644 index 00000000..603733e3 --- /dev/null +++ b/Tests/Resources/Export/Materials/Built-In/EmissiveTextureFactor.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e0fb2433cd3414df7a1179de0aefe076 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/Built-In/Metallic.mat b/Tests/Resources/Export/Materials/Built-In/Metallic.mat new file mode 100644 index 00000000..a8ceedaf --- /dev/null +++ b/Tests/Resources/Export/Materials/Built-In/Metallic.mat @@ -0,0 +1,67 @@ +%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: Metallic + m_Shader: {fileID: 4800000, guid: 99fa998bbbed3408aafa652b466d261d, type: 3} + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 1 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _CullMode: 2 + - _DstBlend: 0 + - _Mode: 0 + - _SrcBlend: 1 + - _ZWrite: 1 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0.89 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 0 + m_Colors: + - baseColorFactor: {r: 1, g: 1, b: 1, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] diff --git a/Tests/Resources/Export/Materials/Built-In/Metallic.mat.meta b/Tests/Resources/Export/Materials/Built-In/Metallic.mat.meta new file mode 100644 index 00000000..7ae88cc1 --- /dev/null +++ b/Tests/Resources/Export/Materials/Built-In/Metallic.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 549d849394275453098d228037491cfe +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/Built-In/MetallicRoughnessOcclusionTexture.mat b/Tests/Resources/Export/Materials/Built-In/MetallicRoughnessOcclusionTexture.mat new file mode 100644 index 00000000..b4f6a084 --- /dev/null +++ b/Tests/Resources/Export/Materials/Built-In/MetallicRoughnessOcclusionTexture.mat @@ -0,0 +1,67 @@ +%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: MetallicRoughnessOcclusionTexture + m_Shader: {fileID: 4800000, guid: 99fa998bbbed3408aafa652b466d261d, type: 3} + m_ShaderKeywords: _METALLICGLOSSMAP _OCCLUSION + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 1 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 2800000, guid: e6a8dbc8ea6f7452db96210e86372550, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 2800000, guid: e6a8dbc8ea6f7452db96210e86372550, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _CullMode: 2 + - _DstBlend: 0 + - _Mode: 0 + - _SrcBlend: 1 + - _ZWrite: 1 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 1 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 0.8 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 1 + m_Colors: + - baseColorFactor: {r: 0.30588236, g: 0.94509804, b: 1, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] diff --git a/Tests/Resources/Export/Materials/Built-In/MetallicRoughnessOcclusionTexture.mat.meta b/Tests/Resources/Export/Materials/Built-In/MetallicRoughnessOcclusionTexture.mat.meta new file mode 100644 index 00000000..586c7268 --- /dev/null +++ b/Tests/Resources/Export/Materials/Built-In/MetallicRoughnessOcclusionTexture.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a0e9294a1583e456e973634bf42c8f98 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/Built-In/MetallicRoughnessTexture.mat b/Tests/Resources/Export/Materials/Built-In/MetallicRoughnessTexture.mat new file mode 100644 index 00000000..2905a17d --- /dev/null +++ b/Tests/Resources/Export/Materials/Built-In/MetallicRoughnessTexture.mat @@ -0,0 +1,67 @@ +%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: MetallicRoughnessTexture + m_Shader: {fileID: 4800000, guid: 99fa998bbbed3408aafa652b466d261d, type: 3} + m_ShaderKeywords: _METALLICGLOSSMAP + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 1 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 2800000, guid: e6a8dbc8ea6f7452db96210e86372550, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _CullMode: 2 + - _DstBlend: 0 + - _Mode: 0 + - _SrcBlend: 1 + - _ZWrite: 1 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 1 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 1 + m_Colors: + - baseColorFactor: {r: 0.30588236, g: 1, b: 0.3882353, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] diff --git a/Tests/Resources/Export/Materials/Built-In/MetallicRoughnessTexture.mat.meta b/Tests/Resources/Export/Materials/Built-In/MetallicRoughnessTexture.mat.meta new file mode 100644 index 00000000..414e8268 --- /dev/null +++ b/Tests/Resources/Export/Materials/Built-In/MetallicRoughnessTexture.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 276fe359dd1fb43f9be12f1ab031195f +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/Built-In/MetallicTexture.mat b/Tests/Resources/Export/Materials/Built-In/MetallicTexture.mat new file mode 100644 index 00000000..74bc0e5f --- /dev/null +++ b/Tests/Resources/Export/Materials/Built-In/MetallicTexture.mat @@ -0,0 +1,67 @@ +%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: MetallicTexture + m_Shader: {fileID: 4800000, guid: 99fa998bbbed3408aafa652b466d261d, type: 3} + m_ShaderKeywords: _METALLICGLOSSMAP _TEXTURE_TRANSFORM + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 1 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 2800000, guid: 8da4e4c98bfa44b25a9faa40105892f1, type: 3} + m_Scale: {x: 2, y: 2} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _CullMode: 2 + - _DstBlend: 0 + - _Mode: 0 + - _SrcBlend: 1 + - _ZWrite: 1 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 1 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 1 + m_Colors: + - baseColorFactor: {r: 0.30588236, g: 1, b: 0.3882353, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] diff --git a/Tests/Resources/Export/Materials/Built-In/MetallicTexture.mat.meta b/Tests/Resources/Export/Materials/Built-In/MetallicTexture.mat.meta new file mode 100644 index 00000000..3522cc87 --- /dev/null +++ b/Tests/Resources/Export/Materials/Built-In/MetallicTexture.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: df1fc8cd0047648dc81658bf9b5d53fa +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/Built-In/NormalTexture.mat b/Tests/Resources/Export/Materials/Built-In/NormalTexture.mat new file mode 100644 index 00000000..770b8a86 --- /dev/null +++ b/Tests/Resources/Export/Materials/Built-In/NormalTexture.mat @@ -0,0 +1,67 @@ +%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: NormalTexture + m_Shader: {fileID: 4800000, guid: 99fa998bbbed3408aafa652b466d261d, type: 3} + m_ShaderKeywords: _NORMALMAP _TEXTURE_TRANSFORM + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 1 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 2800000, guid: e5fa3fd4c4ccd4b5c972e3746a01539d, type: 3} + m_Scale: {x: 1.5, y: 1.2} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _CullMode: 2 + - _DstBlend: 0 + - _Mode: 0 + - _SrcBlend: 1 + - _ZWrite: 1 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1.1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 0.5 + m_Colors: + - baseColorFactor: {r: 1, g: 1, b: 1, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] diff --git a/Tests/Resources/Export/Materials/Built-In/NormalTexture.mat.meta b/Tests/Resources/Export/Materials/Built-In/NormalTexture.mat.meta new file mode 100644 index 00000000..b37536ba --- /dev/null +++ b/Tests/Resources/Export/Materials/Built-In/NormalTexture.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0bb37c71773914c56a61834e5ab7e491 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/Built-In/NotGltf.mat b/Tests/Resources/Export/Materials/Built-In/NotGltf.mat new file mode 100644 index 00000000..1535a897 --- /dev/null +++ b/Tests/Resources/Export/Materials/Built-In/NotGltf.mat @@ -0,0 +1,78 @@ +%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: NotGltf + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + m_BuildTextureStacks: [] diff --git a/Tests/Resources/Export/Materials/Built-In/NotGltf.mat.meta b/Tests/Resources/Export/Materials/Built-In/NotGltf.mat.meta new file mode 100644 index 00000000..04d62f5e --- /dev/null +++ b/Tests/Resources/Export/Materials/Built-In/NotGltf.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: abff76eec17a14bf88e5a41e3ba830b6 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/Built-In/OcclusionTexture.mat b/Tests/Resources/Export/Materials/Built-In/OcclusionTexture.mat new file mode 100644 index 00000000..75f8ed1f --- /dev/null +++ b/Tests/Resources/Export/Materials/Built-In/OcclusionTexture.mat @@ -0,0 +1,67 @@ +%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: OcclusionTexture + m_Shader: {fileID: 4800000, guid: 99fa998bbbed3408aafa652b466d261d, type: 3} + m_ShaderKeywords: _OCCLUSION _TEXTURE_TRANSFORM + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 1 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 2800000, guid: a0989fa75442a4f299d3e16bd238de3b, type: 3} + m_Scale: {x: 2, y: 2} + m_Offset: {x: 0, y: 0} + m_Floats: + - _CullMode: 2 + - _DstBlend: 0 + - _Mode: 0 + - _SrcBlend: 1 + - _ZWrite: 1 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 0.8 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 0.7 + m_Colors: + - baseColorFactor: {r: 1, g: 0.85672647, b: 0.58965355, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] diff --git a/Tests/Resources/Export/Materials/Built-In/OcclusionTexture.mat.meta b/Tests/Resources/Export/Materials/Built-In/OcclusionTexture.mat.meta new file mode 100644 index 00000000..ec3fae81 --- /dev/null +++ b/Tests/Resources/Export/Materials/Built-In/OcclusionTexture.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 65d05fd20e64c4a33ad12ed1b61eb28b +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/Built-In/Omni.mat b/Tests/Resources/Export/Materials/Built-In/Omni.mat new file mode 100644 index 00000000..becd1f2e --- /dev/null +++ b/Tests/Resources/Export/Materials/Built-In/Omni.mat @@ -0,0 +1,67 @@ +%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: Omni + m_Shader: {fileID: 4800000, guid: 99fa998bbbed3408aafa652b466d261d, type: 3} + m_ShaderKeywords: _METALLICGLOSSMAP _OCCLUSION _TEXTURE_TRANSFORM _EMISSION _NORMALMAP + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 1 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 2800000, guid: 767b013dd53264d2a858edf8651b320d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0.4, y: 0.6} + - emissiveTexture: + m_Texture: {fileID: 2800000, guid: f53f6abdff34c42bf8b9a9487f5fba4d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0.1, y: 0.2} + - metallicRoughnessTexture: + m_Texture: {fileID: 2800000, guid: e6a8dbc8ea6f7452db96210e86372550, type: 3} + m_Scale: {x: 1.11, y: 1.21} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 2800000, guid: e5fa3fd4c4ccd4b5c972e3746a01539d, type: 3} + m_Scale: {x: 1.5, y: 1.2} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 2800000, guid: e6a8dbc8ea6f7452db96210e86372550, type: 3} + m_Scale: {x: 1.1, y: 1.2} + m_Offset: {x: 0, y: 0} + m_Floats: + - _CullMode: 0 + - _DstBlend: 0 + - _Mode: 0 + - _SrcBlend: 1 + - _ZWrite: 1 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0.95 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 0.42 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 0.58 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 0.93 + m_Colors: + - baseColorFactor: {r: 0.9, g: 0.8, b: 0.7, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 1, g: 1, b: 1, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] diff --git a/Tests/Resources/Export/Materials/Built-In/Omni.mat.meta b/Tests/Resources/Export/Materials/Built-In/Omni.mat.meta new file mode 100644 index 00000000..c39ee5cb --- /dev/null +++ b/Tests/Resources/Export/Materials/Built-In/Omni.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 44b8ac7a7b0884b79b6093a83b5ab343 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/Built-In/RoughnessTexture.mat b/Tests/Resources/Export/Materials/Built-In/RoughnessTexture.mat new file mode 100644 index 00000000..aa2f9be1 --- /dev/null +++ b/Tests/Resources/Export/Materials/Built-In/RoughnessTexture.mat @@ -0,0 +1,67 @@ +%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: RoughnessTexture + m_Shader: {fileID: 4800000, guid: 99fa998bbbed3408aafa652b466d261d, type: 3} + m_ShaderKeywords: _METALLICGLOSSMAP + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 1 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 2800000, guid: 236ba889a0d5e48bf977cee24ffcb55f, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _CullMode: 2 + - _DstBlend: 0 + - _Mode: 0 + - _SrcBlend: 1 + - _ZWrite: 1 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 0.89 + m_Colors: + - baseColorFactor: {r: 0.30588236, g: 1, b: 0.3882353, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] diff --git a/Tests/Resources/Export/Materials/Built-In/RoughnessTexture.mat.meta b/Tests/Resources/Export/Materials/Built-In/RoughnessTexture.mat.meta new file mode 100644 index 00000000..093d7e7e --- /dev/null +++ b/Tests/Resources/Export/Materials/Built-In/RoughnessTexture.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6b28d65289d8344f4ae483988f93728d +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/HDRP.meta b/Tests/Resources/Export/Materials/HDRP.meta new file mode 100644 index 00000000..0cc84c36 --- /dev/null +++ b/Tests/Resources/Export/Materials/HDRP.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: acda2baa68ebf4967a27112152108568 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/HDRP/BaseColor.mat b/Tests/Resources/Export/Materials/HDRP/BaseColor.mat new file mode 100644 index 00000000..02dd89d3 --- /dev/null +++ b/Tests/Resources/Export/Materials/HDRP/BaseColor.mat @@ -0,0 +1,197 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-6868728779799944013 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 0 +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: BaseColor + m_Shader: {fileID: -6465566751694194690, guid: b9d29dfa1474148e792ac720cbd45122, type: 3} + m_ShaderKeywords: _ALPHATEST_ON _DISABLE_SSR_TRANSPARENT + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2475 + stringTagMap: + RenderType: TransparentCutout + disabledShaderPasses: + - MOTIONVECTORS + - TransparentDepthPrepass + - TransparentDepthPostpass + - TransparentBackface + - RayTracingPrepass + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - transmissionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaCutoffEnable: 1 + - _AlphaDstBlend: 0 + - _AlphaSrcBlend: 1 + - _AlphaToMask: 0 + - _AlphaToMaskInspectorValue: 0 + - _BUILTIN_AlphaClip: 0 + - _BUILTIN_Blend: 0 + - _BUILTIN_CullMode: 2 + - _BUILTIN_DstBlend: 0 + - _BUILTIN_QueueControl: -1 + - _BUILTIN_QueueOffset: 0 + - _BUILTIN_SrcBlend: 1 + - _BUILTIN_Surface: 0 + - _BUILTIN_ZTest: 4 + - _BUILTIN_ZWrite: 1 + - _BUILTIN_ZWriteControl: 0 + - _Blend: 0 + - _BlendMode: 0 + - _BlendModePreserveSpecular: 0 + - _CastShadows: 1 + - _Cull: 2 + - _CullMode: 2 + - _CullModeForward: 2 + - _DepthOffsetEnable: 0 + - _DoubleSidedEnable: 0 + - _DoubleSidedNormalMode: 2 + - _DstBlend: 0 + - _EnableBlendModePreserveSpecularLighting: 1 + - _EnableFogOnTransparent: 1 + - _Mode: 0 + - _OpaqueCullMode: 2 + - _QueueControl: 0 + - _QueueOffset: 0 + - _RayTracing: 0 + - _ReceiveShadows: 1 + - _ReceivesSSR: 1 + - _ReceivesSSRTransparent: 0 + - _RefractionModel: 0 + - _RenderQueueType: 1 + - _RequireSplitLighting: 0 + - _SrcBlend: 1 + - _StencilRef: 0 + - _StencilRefDepth: 8 + - _StencilRefDistortionVec: 4 + - _StencilRefGBuffer: 10 + - _StencilRefMV: 40 + - _StencilWriteMask: 6 + - _StencilWriteMaskDepth: 8 + - _StencilWriteMaskDistortionVec: 4 + - _StencilWriteMaskGBuffer: 14 + - _StencilWriteMaskMV: 40 + - _SupportDecals: 1 + - _Surface: 0 + - _SurfaceType: 0 + - _TransparentBackfaceEnable: 0 + - _TransparentCullMode: 2 + - _TransparentDepthPostpassEnable: 0 + - _TransparentDepthPrepassEnable: 0 + - _TransparentSortPriority: 0 + - _TransparentWritingMotionVec: 0 + - _TransparentZWrite: 0 + - _UseShadowThreshold: 0 + - _WorkflowMode: 1 + - _ZTest: 4 + - _ZTestDepthEqualForOpaque: 3 + - _ZTestGBuffer: 3 + - _ZTestTransparent: 4 + - _ZWrite: 1 + - _ZWriteControl: 0 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveExposureWeight: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 0.5 + - transmissionFactor: 0 + m_Colors: + - _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0} + - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} + - baseColorFactor: {r: 0.48452914, g: 0.7353569, b: 0.880825, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] +--- !u!114 &3748538558603016288 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 11 +--- !u!114 &8190096692948843879 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 diff --git a/Tests/Resources/Export/Materials/HDRP/BaseColor.mat.meta b/Tests/Resources/Export/Materials/HDRP/BaseColor.mat.meta new file mode 100644 index 00000000..bb156d8c --- /dev/null +++ b/Tests/Resources/Export/Materials/HDRP/BaseColor.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b8a9fb2d38ff94a98a5d16783249d495 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/HDRP/BaseColorTexture.mat b/Tests/Resources/Export/Materials/HDRP/BaseColorTexture.mat new file mode 100644 index 00000000..5cece5f7 --- /dev/null +++ b/Tests/Resources/Export/Materials/HDRP/BaseColorTexture.mat @@ -0,0 +1,197 @@ +%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: BaseColorTexture + m_Shader: {fileID: -6465566751694194690, guid: b9d29dfa1474148e792ac720cbd45122, type: 3} + m_ShaderKeywords: _ALPHATEST_ON _DISABLE_SSR_TRANSPARENT + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2475 + stringTagMap: + RenderType: TransparentCutout + disabledShaderPasses: + - MOTIONVECTORS + - TransparentDepthPrepass + - TransparentDepthPostpass + - TransparentBackface + - RayTracingPrepass + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 2800000, guid: 767b013dd53264d2a858edf8651b320d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - transmissionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaCutoffEnable: 1 + - _AlphaDstBlend: 0 + - _AlphaSrcBlend: 1 + - _AlphaToMask: 0 + - _AlphaToMaskInspectorValue: 0 + - _BUILTIN_AlphaClip: 0 + - _BUILTIN_Blend: 0 + - _BUILTIN_CullMode: 2 + - _BUILTIN_DstBlend: 0 + - _BUILTIN_QueueControl: -1 + - _BUILTIN_QueueOffset: 0 + - _BUILTIN_SrcBlend: 1 + - _BUILTIN_Surface: 0 + - _BUILTIN_ZTest: 4 + - _BUILTIN_ZWrite: 1 + - _BUILTIN_ZWriteControl: 0 + - _Blend: 0 + - _BlendMode: 0 + - _BlendModePreserveSpecular: 0 + - _CastShadows: 1 + - _Cull: 2 + - _CullMode: 2 + - _CullModeForward: 2 + - _DepthOffsetEnable: 0 + - _DoubleSidedEnable: 0 + - _DoubleSidedNormalMode: 2 + - _DstBlend: 0 + - _EnableBlendModePreserveSpecularLighting: 1 + - _EnableFogOnTransparent: 1 + - _Mode: 0 + - _OpaqueCullMode: 2 + - _QueueControl: 0 + - _QueueOffset: 0 + - _RayTracing: 0 + - _ReceiveShadows: 1 + - _ReceivesSSR: 1 + - _ReceivesSSRTransparent: 0 + - _RefractionModel: 0 + - _RenderQueueType: 1 + - _RequireSplitLighting: 0 + - _SrcBlend: 1 + - _StencilRef: 0 + - _StencilRefDepth: 8 + - _StencilRefDistortionVec: 4 + - _StencilRefGBuffer: 10 + - _StencilRefMV: 40 + - _StencilWriteMask: 6 + - _StencilWriteMaskDepth: 8 + - _StencilWriteMaskDistortionVec: 4 + - _StencilWriteMaskGBuffer: 14 + - _StencilWriteMaskMV: 40 + - _SupportDecals: 1 + - _Surface: 0 + - _SurfaceType: 0 + - _TransparentBackfaceEnable: 0 + - _TransparentCullMode: 2 + - _TransparentDepthPostpassEnable: 0 + - _TransparentDepthPrepassEnable: 0 + - _TransparentSortPriority: 0 + - _TransparentWritingMotionVec: 0 + - _TransparentZWrite: 0 + - _UseShadowThreshold: 0 + - _WorkflowMode: 1 + - _ZTest: 4 + - _ZTestDepthEqualForOpaque: 3 + - _ZTestGBuffer: 3 + - _ZTestTransparent: 4 + - _ZWrite: 1 + - _ZWriteControl: 0 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveExposureWeight: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 0.5 + - transmissionFactor: 0 + m_Colors: + - _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0} + - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} + - baseColorFactor: {r: 0.9, g: 0.8, b: 0.7, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] +--- !u!114 &3271681715824319525 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 0 +--- !u!114 &4242709241036237138 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 11 +--- !u!114 &8297463674298635704 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 diff --git a/Tests/Resources/Export/Materials/HDRP/BaseColorTexture.mat.meta b/Tests/Resources/Export/Materials/HDRP/BaseColorTexture.mat.meta new file mode 100644 index 00000000..cbc95f91 --- /dev/null +++ b/Tests/Resources/Export/Materials/HDRP/BaseColorTexture.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7e9d3c1b8914c4f548572e4588cdd34b +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/HDRP/BaseColorTextureCutout.mat b/Tests/Resources/Export/Materials/HDRP/BaseColorTextureCutout.mat new file mode 100644 index 00000000..373c60b6 --- /dev/null +++ b/Tests/Resources/Export/Materials/HDRP/BaseColorTextureCutout.mat @@ -0,0 +1,196 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-6792439800286000282 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 0 +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: BaseColorTextureCutout + m_Shader: {fileID: -6465566751694194690, guid: b9d29dfa1474148e792ac720cbd45122, type: 3} + m_ShaderKeywords: _ALPHATEST_ON _DISABLE_SSR_TRANSPARENT + m_LightmapFlags: 2 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2475 + stringTagMap: + MotionVector: User + RenderType: TransparentCutout + disabledShaderPasses: + - TransparentDepthPrepass + - TransparentDepthPostpass + - TransparentBackface + - RayTracingPrepass + - MOTIONVECTORS + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 2800000, guid: 1e22bd6b46ceb4d0c99cfdb552ec8586, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - transmissionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 1 + - _AlphaCutoffEnable: 1 + - _AlphaDstBlend: 0 + - _AlphaSrcBlend: 1 + - _AlphaToMask: 0 + - _AlphaToMaskInspectorValue: 0 + - _BUILTIN_AlphaClip: 0 + - _BUILTIN_Blend: 0 + - _BUILTIN_CullMode: 2 + - _BUILTIN_DstBlend: 0 + - _BUILTIN_QueueControl: 1 + - _BUILTIN_QueueOffset: 0 + - _BUILTIN_SrcBlend: 1 + - _BUILTIN_Surface: 0 + - _BUILTIN_ZTest: 4 + - _BUILTIN_ZWrite: 1 + - _BUILTIN_ZWriteControl: 0 + - _Blend: 0 + - _BlendMode: 0 + - _CastShadows: 1 + - _Cull: 2 + - _CullMode: 2 + - _CullModeForward: 2 + - _DepthOffsetEnable: 0 + - _DoubleSidedEnable: 0 + - _DoubleSidedNormalMode: 2 + - _DstBlend: 0 + - _EnableBlendModePreserveSpecularLighting: 1 + - _EnableFogOnTransparent: 1 + - _OpaqueCullMode: 2 + - _QueueControl: 1 + - _QueueOffset: 0 + - _RayTracing: 0 + - _ReceiveShadows: 1 + - _ReceivesSSR: 1 + - _ReceivesSSRTransparent: 0 + - _RefractionModel: 0 + - _RenderQueueType: 1 + - _RequireSplitLighting: 0 + - _SrcBlend: 1 + - _StencilRef: 0 + - _StencilRefDepth: 8 + - _StencilRefDistortionVec: 4 + - _StencilRefGBuffer: 10 + - _StencilRefMV: 40 + - _StencilWriteMask: 6 + - _StencilWriteMaskDepth: 8 + - _StencilWriteMaskDistortionVec: 4 + - _StencilWriteMaskGBuffer: 14 + - _StencilWriteMaskMV: 40 + - _SupportDecals: 1 + - _Surface: 0 + - _SurfaceType: 0 + - _TransparentBackfaceEnable: 0 + - _TransparentCullMode: 2 + - _TransparentDepthPostpassEnable: 0 + - _TransparentDepthPrepassEnable: 0 + - _TransparentSortPriority: 0 + - _TransparentWritingMotionVec: 0 + - _TransparentZWrite: 0 + - _UseShadowThreshold: 0 + - _WorkflowMode: 1 + - _ZTest: 4 + - _ZTestDepthEqualForOpaque: 3 + - _ZTestGBuffer: 3 + - _ZTestTransparent: 4 + - _ZWrite: 1 + - _ZWriteControl: 0 + - alphaCutoff: 0.6 + - baseColorTexture_texCoord: 0 + - emissiveExposureWeight: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 0 + - transmissionFactor: 0 + m_Colors: + - _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0} + - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} + - baseColorFactor: {r: 0.9, g: 0.8, b: 0.7, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] +--- !u!114 &749680127556728278 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 11 +--- !u!114 &1818509006005091842 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 5 diff --git a/Tests/Resources/Export/Materials/HDRP/BaseColorTextureCutout.mat.meta b/Tests/Resources/Export/Materials/HDRP/BaseColorTextureCutout.mat.meta new file mode 100644 index 00000000..94d54b58 --- /dev/null +++ b/Tests/Resources/Export/Materials/HDRP/BaseColorTextureCutout.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9b08608d3a097402cbb361cb9b2665f6 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/HDRP/BaseColorTextureRotated.mat b/Tests/Resources/Export/Materials/HDRP/BaseColorTextureRotated.mat new file mode 100644 index 00000000..1933f4c6 --- /dev/null +++ b/Tests/Resources/Export/Materials/HDRP/BaseColorTextureRotated.mat @@ -0,0 +1,198 @@ +%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: BaseColorTextureRotated + m_Shader: {fileID: -6465566751694194690, guid: b9d29dfa1474148e792ac720cbd45122, type: 3} + m_ShaderKeywords: _ALPHATEST_ON _DISABLE_SSR_TRANSPARENT _TEXTURE_TRANSFORM + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2475 + stringTagMap: + MotionVector: User + RenderType: TransparentCutout + disabledShaderPasses: + - MOTIONVECTORS + - TransparentDepthPrepass + - TransparentDepthPostpass + - TransparentBackface + - RayTracingPrepass + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 2800000, guid: 767b013dd53264d2a858edf8651b320d, type: 3} + m_Scale: {x: 0.70710677, y: 0.70710677} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - transmissionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaCutoffEnable: 1 + - _AlphaDstBlend: 0 + - _AlphaSrcBlend: 1 + - _AlphaToMask: 0 + - _AlphaToMaskInspectorValue: 0 + - _BUILTIN_AlphaClip: 0 + - _BUILTIN_Blend: 0 + - _BUILTIN_CullMode: 2 + - _BUILTIN_DstBlend: 0 + - _BUILTIN_QueueControl: -1 + - _BUILTIN_QueueOffset: 0 + - _BUILTIN_SrcBlend: 1 + - _BUILTIN_Surface: 0 + - _BUILTIN_ZTest: 4 + - _BUILTIN_ZWrite: 1 + - _BUILTIN_ZWriteControl: 0 + - _Blend: 0 + - _BlendMode: 0 + - _BlendModePreserveSpecular: 0 + - _CastShadows: 1 + - _Cull: 2 + - _CullMode: 2 + - _CullModeForward: 2 + - _DepthOffsetEnable: 0 + - _DoubleSidedEnable: 0 + - _DoubleSidedNormalMode: 2 + - _DstBlend: 0 + - _EnableBlendModePreserveSpecularLighting: 1 + - _EnableFogOnTransparent: 1 + - _Mode: 0 + - _OpaqueCullMode: 2 + - _QueueControl: 0 + - _QueueOffset: 0 + - _RayTracing: 0 + - _ReceiveShadows: 1 + - _ReceivesSSR: 1 + - _ReceivesSSRTransparent: 0 + - _RefractionModel: 0 + - _RenderQueueType: 1 + - _RequireSplitLighting: 0 + - _SrcBlend: 1 + - _StencilRef: 0 + - _StencilRefDepth: 8 + - _StencilRefDistortionVec: 4 + - _StencilRefGBuffer: 10 + - _StencilRefMV: 40 + - _StencilWriteMask: 6 + - _StencilWriteMaskDepth: 8 + - _StencilWriteMaskDistortionVec: 4 + - _StencilWriteMaskGBuffer: 14 + - _StencilWriteMaskMV: 40 + - _SupportDecals: 1 + - _Surface: 0 + - _SurfaceType: 0 + - _TransparentBackfaceEnable: 0 + - _TransparentCullMode: 2 + - _TransparentDepthPostpassEnable: 0 + - _TransparentDepthPrepassEnable: 0 + - _TransparentSortPriority: 0 + - _TransparentWritingMotionVec: 0 + - _TransparentZWrite: 0 + - _UseShadowThreshold: 0 + - _WorkflowMode: 1 + - _ZTest: 4 + - _ZTestDepthEqualForOpaque: 3 + - _ZTestGBuffer: 3 + - _ZTestTransparent: 4 + - _ZWrite: 1 + - _ZWriteControl: 0 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveExposureWeight: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 0.5 + - transmissionFactor: 0 + m_Colors: + - _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0} + - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} + - baseColorFactor: {r: 0.9, g: 0.8, b: 0.7, a: 1} + - baseColorTexture_Rotation: {r: 0.70710677, g: -0.70710677, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] +--- !u!114 &4496889970596464588 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 11 +--- !u!114 &5005384916937477244 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 +--- !u!114 &8468717510162963845 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 0 diff --git a/Tests/Resources/Export/Materials/HDRP/BaseColorTextureRotated.mat.meta b/Tests/Resources/Export/Materials/HDRP/BaseColorTextureRotated.mat.meta new file mode 100644 index 00000000..be832dc7 --- /dev/null +++ b/Tests/Resources/Export/Materials/HDRP/BaseColorTextureRotated.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9fe2bc2702cbf42728d0462dbb707b1f +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/HDRP/BaseColorTextureScaled.mat b/Tests/Resources/Export/Materials/HDRP/BaseColorTextureScaled.mat new file mode 100644 index 00000000..90b063c3 --- /dev/null +++ b/Tests/Resources/Export/Materials/HDRP/BaseColorTextureScaled.mat @@ -0,0 +1,198 @@ +%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: BaseColorTextureScaled + m_Shader: {fileID: -6465566751694194690, guid: b9d29dfa1474148e792ac720cbd45122, type: 3} + m_ShaderKeywords: _ALPHATEST_ON _DISABLE_SSR_TRANSPARENT _TEXTURE_TRANSFORM + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2475 + stringTagMap: + MotionVector: User + RenderType: TransparentCutout + disabledShaderPasses: + - MOTIONVECTORS + - TransparentDepthPrepass + - TransparentDepthPostpass + - TransparentBackface + - RayTracingPrepass + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 2800000, guid: 767b013dd53264d2a858edf8651b320d, type: 3} + m_Scale: {x: 1.2, y: 1.3} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - transmissionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaCutoffEnable: 1 + - _AlphaDstBlend: 0 + - _AlphaSrcBlend: 1 + - _AlphaToMask: 0 + - _AlphaToMaskInspectorValue: 0 + - _BUILTIN_AlphaClip: 0 + - _BUILTIN_Blend: 0 + - _BUILTIN_CullMode: 2 + - _BUILTIN_DstBlend: 0 + - _BUILTIN_QueueControl: -1 + - _BUILTIN_QueueOffset: 0 + - _BUILTIN_SrcBlend: 1 + - _BUILTIN_Surface: 0 + - _BUILTIN_ZTest: 4 + - _BUILTIN_ZWrite: 1 + - _BUILTIN_ZWriteControl: 0 + - _Blend: 0 + - _BlendMode: 0 + - _BlendModePreserveSpecular: 0 + - _CastShadows: 1 + - _Cull: 2 + - _CullMode: 2 + - _CullModeForward: 2 + - _DepthOffsetEnable: 0 + - _DoubleSidedEnable: 0 + - _DoubleSidedNormalMode: 2 + - _DstBlend: 0 + - _EnableBlendModePreserveSpecularLighting: 1 + - _EnableFogOnTransparent: 1 + - _Mode: 0 + - _OpaqueCullMode: 2 + - _QueueControl: 0 + - _QueueOffset: 0 + - _RayTracing: 0 + - _ReceiveShadows: 1 + - _ReceivesSSR: 1 + - _ReceivesSSRTransparent: 0 + - _RefractionModel: 0 + - _RenderQueueType: 1 + - _RequireSplitLighting: 0 + - _SrcBlend: 1 + - _StencilRef: 0 + - _StencilRefDepth: 8 + - _StencilRefDistortionVec: 4 + - _StencilRefGBuffer: 10 + - _StencilRefMV: 40 + - _StencilWriteMask: 6 + - _StencilWriteMaskDepth: 8 + - _StencilWriteMaskDistortionVec: 4 + - _StencilWriteMaskGBuffer: 14 + - _StencilWriteMaskMV: 40 + - _SupportDecals: 1 + - _Surface: 0 + - _SurfaceType: 0 + - _TransparentBackfaceEnable: 0 + - _TransparentCullMode: 2 + - _TransparentDepthPostpassEnable: 0 + - _TransparentDepthPrepassEnable: 0 + - _TransparentSortPriority: 0 + - _TransparentWritingMotionVec: 0 + - _TransparentZWrite: 0 + - _UseShadowThreshold: 0 + - _WorkflowMode: 1 + - _ZTest: 4 + - _ZTestDepthEqualForOpaque: 3 + - _ZTestGBuffer: 3 + - _ZTestTransparent: 4 + - _ZWrite: 1 + - _ZWriteControl: 0 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveExposureWeight: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 0.5 + - transmissionFactor: 0 + m_Colors: + - _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0} + - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} + - baseColorFactor: {r: 0.9, g: 0.8, b: 0.7, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] +--- !u!114 &327049786189296091 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 0 +--- !u!114 &5338241427485034969 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 11 +--- !u!114 &7754129217665426590 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 diff --git a/Tests/Resources/Export/Materials/HDRP/BaseColorTextureScaled.mat.meta b/Tests/Resources/Export/Materials/HDRP/BaseColorTextureScaled.mat.meta new file mode 100644 index 00000000..31c06bb9 --- /dev/null +++ b/Tests/Resources/Export/Materials/HDRP/BaseColorTextureScaled.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 558c57e3e99e0416aaf1d0c2df90252d +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/HDRP/BaseColorTextureTranslated.mat b/Tests/Resources/Export/Materials/HDRP/BaseColorTextureTranslated.mat new file mode 100644 index 00000000..74d22503 --- /dev/null +++ b/Tests/Resources/Export/Materials/HDRP/BaseColorTextureTranslated.mat @@ -0,0 +1,198 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-6755628218167242280 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 +--- !u!114 &-6631252386267038805 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 11 +--- !u!114 &-3521330490493970405 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 0 +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: BaseColorTextureTranslated + m_Shader: {fileID: -6465566751694194690, guid: b9d29dfa1474148e792ac720cbd45122, type: 3} + m_ShaderKeywords: _ALPHATEST_ON _DISABLE_SSR_TRANSPARENT _TEXTURE_TRANSFORM + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2475 + stringTagMap: + MotionVector: User + RenderType: TransparentCutout + disabledShaderPasses: + - MOTIONVECTORS + - TransparentDepthPrepass + - TransparentDepthPostpass + - TransparentBackface + - RayTracingPrepass + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 2800000, guid: 767b013dd53264d2a858edf8651b320d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0.4, y: 0.6} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - transmissionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaCutoffEnable: 1 + - _AlphaDstBlend: 0 + - _AlphaSrcBlend: 1 + - _AlphaToMask: 0 + - _AlphaToMaskInspectorValue: 0 + - _BUILTIN_AlphaClip: 0 + - _BUILTIN_Blend: 0 + - _BUILTIN_CullMode: 2 + - _BUILTIN_DstBlend: 0 + - _BUILTIN_QueueControl: -1 + - _BUILTIN_QueueOffset: 0 + - _BUILTIN_SrcBlend: 1 + - _BUILTIN_Surface: 0 + - _BUILTIN_ZTest: 4 + - _BUILTIN_ZWrite: 1 + - _BUILTIN_ZWriteControl: 0 + - _Blend: 0 + - _BlendMode: 0 + - _BlendModePreserveSpecular: 0 + - _CastShadows: 1 + - _Cull: 2 + - _CullMode: 2 + - _CullModeForward: 2 + - _DepthOffsetEnable: 0 + - _DoubleSidedEnable: 0 + - _DoubleSidedNormalMode: 2 + - _DstBlend: 0 + - _EnableBlendModePreserveSpecularLighting: 1 + - _EnableFogOnTransparent: 1 + - _Mode: 0 + - _OpaqueCullMode: 2 + - _QueueControl: 0 + - _QueueOffset: 0 + - _RayTracing: 0 + - _ReceiveShadows: 1 + - _ReceivesSSR: 1 + - _ReceivesSSRTransparent: 0 + - _RefractionModel: 0 + - _RenderQueueType: 1 + - _RequireSplitLighting: 0 + - _SrcBlend: 1 + - _StencilRef: 0 + - _StencilRefDepth: 8 + - _StencilRefDistortionVec: 4 + - _StencilRefGBuffer: 10 + - _StencilRefMV: 40 + - _StencilWriteMask: 6 + - _StencilWriteMaskDepth: 8 + - _StencilWriteMaskDistortionVec: 4 + - _StencilWriteMaskGBuffer: 14 + - _StencilWriteMaskMV: 40 + - _SupportDecals: 1 + - _Surface: 0 + - _SurfaceType: 0 + - _TransparentBackfaceEnable: 0 + - _TransparentCullMode: 2 + - _TransparentDepthPostpassEnable: 0 + - _TransparentDepthPrepassEnable: 0 + - _TransparentSortPriority: 0 + - _TransparentWritingMotionVec: 0 + - _TransparentZWrite: 0 + - _UseShadowThreshold: 0 + - _WorkflowMode: 1 + - _ZTest: 4 + - _ZTestDepthEqualForOpaque: 3 + - _ZTestGBuffer: 3 + - _ZTestTransparent: 4 + - _ZWrite: 1 + - _ZWriteControl: 0 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveExposureWeight: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 0.5 + - transmissionFactor: 0 + m_Colors: + - _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0} + - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} + - baseColorFactor: {r: 0.9, g: 0.8, b: 0.7, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] diff --git a/Tests/Resources/Export/Materials/HDRP/BaseColorTextureTranslated.mat.meta b/Tests/Resources/Export/Materials/HDRP/BaseColorTextureTranslated.mat.meta new file mode 100644 index 00000000..974381b4 --- /dev/null +++ b/Tests/Resources/Export/Materials/HDRP/BaseColorTextureTranslated.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5db17e564eab44192950d5e3cb55928a +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/HDRP/BaseColorTextureTransparent.mat b/Tests/Resources/Export/Materials/HDRP/BaseColorTextureTransparent.mat new file mode 100644 index 00000000..94407ce6 --- /dev/null +++ b/Tests/Resources/Export/Materials/HDRP/BaseColorTextureTransparent.mat @@ -0,0 +1,149 @@ +%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: BaseColorTextureTransparent + m_Shader: {fileID: -6465566751694194690, guid: b9d29dfa1474148e792ac720cbd45122, type: 3} + m_ShaderKeywords: _DISABLE_SSR_TRANSPARENT _ENABLE_FOG_ON_TRANSPARENT _SURFACE_TYPE_TRANSPARENT + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 3000 + stringTagMap: + MotionVector: User + RenderType: Transparent + disabledShaderPasses: + - MOTIONVECTORS + - TransparentDepthPrepass + - TransparentDepthPostpass + - TransparentBackface + - RayTracingPrepass + - DepthOnly + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 2800000, guid: 1e22bd6b46ceb4d0c99cfdb552ec8586, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - transmissionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaCutoffEnable: 0 + - _AlphaDstBlend: 10 + - _AlphaSrcBlend: 1 + - _AlphaToMask: 0 + - _AlphaToMaskInspectorValue: 0 + - _BlendMode: 0 + - _CullMode: 2 + - _CullModeForward: 2 + - _DepthOffsetEnable: 0 + - _DoubleSidedEnable: 0 + - _DoubleSidedNormalMode: 2 + - _DstBlend: 10 + - _EnableBlendModePreserveSpecularLighting: 1 + - _EnableFogOnTransparent: 1 + - _OpaqueCullMode: 2 + - _RayTracing: 0 + - _ReceivesSSR: 1 + - _ReceivesSSRTransparent: 0 + - _RefractionModel: 0 + - _RenderQueueType: 4 + - _RequireSplitLighting: 0 + - _SrcBlend: 1 + - _StencilRef: 0 + - _StencilRefDepth: 0 + - _StencilRefDistortionVec: 4 + - _StencilRefGBuffer: 2 + - _StencilRefMV: 32 + - _StencilWriteMask: 6 + - _StencilWriteMaskDepth: 8 + - _StencilWriteMaskDistortionVec: 4 + - _StencilWriteMaskGBuffer: 14 + - _StencilWriteMaskMV: 40 + - _SupportDecals: 1 + - _SurfaceType: 1 + - _TransparentBackfaceEnable: 0 + - _TransparentCullMode: 2 + - _TransparentDepthPostpassEnable: 0 + - _TransparentDepthPrepassEnable: 0 + - _TransparentSortPriority: 0 + - _TransparentWritingMotionVec: 0 + - _TransparentZWrite: 0 + - _UseShadowThreshold: 0 + - _ZTestDepthEqualForOpaque: 4 + - _ZTestGBuffer: 4 + - _ZTestTransparent: 4 + - _ZWrite: 0 + - alphaCutoff: 0 + - baseColorTexture_texCoord: 0 + - emissiveExposureWeight: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 0 + - transmissionFactor: 0 + m_Colors: + - _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0} + - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} + - baseColorFactor: {r: 0.9, g: 0.8, b: 0.7, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] +--- !u!114 &2680468846725150881 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 11 diff --git a/Tests/Resources/Export/Materials/HDRP/BaseColorTextureTransparent.mat.meta b/Tests/Resources/Export/Materials/HDRP/BaseColorTextureTransparent.mat.meta new file mode 100644 index 00000000..3bad371d --- /dev/null +++ b/Tests/Resources/Export/Materials/HDRP/BaseColorTextureTransparent.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: be3900004a1a74d91915b1efea559abd +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/HDRP/DoubleSided.mat b/Tests/Resources/Export/Materials/HDRP/DoubleSided.mat new file mode 100644 index 00000000..ea55f123 --- /dev/null +++ b/Tests/Resources/Export/Materials/HDRP/DoubleSided.mat @@ -0,0 +1,148 @@ +%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: DoubleSided + m_Shader: {fileID: -6465566751694194690, guid: b9d29dfa1474148e792ac720cbd45122, type: 3} + m_ShaderKeywords: _ALPHATEST_ON _DISABLE_SSR_TRANSPARENT _DOUBLESIDED_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 1 + m_CustomRenderQueue: 2475 + stringTagMap: + MotionVector: User + RenderType: TransparentCutout + disabledShaderPasses: + - MOTIONVECTORS + - TransparentDepthPrepass + - TransparentDepthPostpass + - TransparentBackface + - RayTracingPrepass + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - transmissionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaCutoffEnable: 1 + - _AlphaDstBlend: 0 + - _AlphaSrcBlend: 1 + - _AlphaToMask: 0 + - _AlphaToMaskInspectorValue: 0 + - _BlendMode: 0 + - _CullMode: 0 + - _CullModeForward: 0 + - _DepthOffsetEnable: 0 + - _DoubleSidedEnable: 1 + - _DoubleSidedNormalMode: 0 + - _DstBlend: 0 + - _EnableBlendModePreserveSpecularLighting: 1 + - _EnableFogOnTransparent: 1 + - _OpaqueCullMode: 2 + - _RayTracing: 0 + - _ReceivesSSR: 1 + - _ReceivesSSRTransparent: 0 + - _RefractionModel: 0 + - _RenderQueueType: 1 + - _RequireSplitLighting: 0 + - _SrcBlend: 1 + - _StencilRef: 0 + - _StencilRefDepth: 8 + - _StencilRefDistortionVec: 4 + - _StencilRefGBuffer: 10 + - _StencilRefMV: 40 + - _StencilWriteMask: 6 + - _StencilWriteMaskDepth: 8 + - _StencilWriteMaskDistortionVec: 4 + - _StencilWriteMaskGBuffer: 14 + - _StencilWriteMaskMV: 40 + - _SupportDecals: 1 + - _SurfaceType: 0 + - _TransparentBackfaceEnable: 0 + - _TransparentCullMode: 2 + - _TransparentDepthPostpassEnable: 0 + - _TransparentDepthPrepassEnable: 0 + - _TransparentSortPriority: 0 + - _TransparentWritingMotionVec: 0 + - _TransparentZWrite: 0 + - _UseShadowThreshold: 0 + - _ZTestDepthEqualForOpaque: 3 + - _ZTestGBuffer: 3 + - _ZTestTransparent: 4 + - _ZWrite: 1 + - alphaCutoff: 0 + - baseColorTexture_texCoord: 0 + - emissiveExposureWeight: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 0.7 + - transmissionFactor: 0 + m_Colors: + - _DoubleSidedConstants: {r: -1, g: -1, b: -1, a: 0} + - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} + - baseColorFactor: {r: 0, g: 0.32675865, b: 1, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] +--- !u!114 &4402156155436136961 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 11 diff --git a/Tests/Resources/Export/Materials/HDRP/DoubleSided.mat.meta b/Tests/Resources/Export/Materials/HDRP/DoubleSided.mat.meta new file mode 100644 index 00000000..f7ad6beb --- /dev/null +++ b/Tests/Resources/Export/Materials/HDRP/DoubleSided.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4cb4eaa6072024bb9b1d173757700a44 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/HDRP/EmissiveFactor.mat b/Tests/Resources/Export/Materials/HDRP/EmissiveFactor.mat new file mode 100644 index 00000000..5f798fd7 --- /dev/null +++ b/Tests/Resources/Export/Materials/HDRP/EmissiveFactor.mat @@ -0,0 +1,198 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-1551366186088804395 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: EmissiveFactor + m_Shader: {fileID: -6465566751694194690, guid: b9d29dfa1474148e792ac720cbd45122, type: 3} + m_ShaderKeywords: _ALPHATEST_ON _DISABLE_SSR_TRANSPARENT _EMISSIVE + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2475 + stringTagMap: + MotionVector: User + RenderType: TransparentCutout + disabledShaderPasses: + - MOTIONVECTORS + - TransparentDepthPrepass + - TransparentDepthPostpass + - TransparentBackface + - RayTracingPrepass + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - transmissionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaCutoffEnable: 1 + - _AlphaDstBlend: 0 + - _AlphaSrcBlend: 1 + - _AlphaToMask: 0 + - _AlphaToMaskInspectorValue: 0 + - _BUILTIN_AlphaClip: 0 + - _BUILTIN_Blend: 0 + - _BUILTIN_CullMode: 2 + - _BUILTIN_DstBlend: 0 + - _BUILTIN_QueueControl: -1 + - _BUILTIN_QueueOffset: 0 + - _BUILTIN_SrcBlend: 1 + - _BUILTIN_Surface: 0 + - _BUILTIN_ZTest: 4 + - _BUILTIN_ZWrite: 1 + - _BUILTIN_ZWriteControl: 0 + - _Blend: 0 + - _BlendMode: 0 + - _BlendModePreserveSpecular: 0 + - _CastShadows: 1 + - _Cull: 2 + - _CullMode: 2 + - _CullModeForward: 2 + - _DepthOffsetEnable: 0 + - _DoubleSidedEnable: 0 + - _DoubleSidedNormalMode: 2 + - _DstBlend: 0 + - _EnableBlendModePreserveSpecularLighting: 1 + - _EnableFogOnTransparent: 1 + - _Mode: 0 + - _OpaqueCullMode: 2 + - _QueueControl: 0 + - _QueueOffset: 0 + - _RayTracing: 0 + - _ReceiveShadows: 1 + - _ReceivesSSR: 1 + - _ReceivesSSRTransparent: 0 + - _RefractionModel: 0 + - _RenderQueueType: 1 + - _RequireSplitLighting: 0 + - _SrcBlend: 1 + - _StencilRef: 0 + - _StencilRefDepth: 8 + - _StencilRefDistortionVec: 4 + - _StencilRefGBuffer: 10 + - _StencilRefMV: 40 + - _StencilWriteMask: 6 + - _StencilWriteMaskDepth: 8 + - _StencilWriteMaskDistortionVec: 4 + - _StencilWriteMaskGBuffer: 14 + - _StencilWriteMaskMV: 40 + - _SupportDecals: 1 + - _Surface: 0 + - _SurfaceType: 0 + - _TransparentBackfaceEnable: 0 + - _TransparentCullMode: 2 + - _TransparentDepthPostpassEnable: 0 + - _TransparentDepthPrepassEnable: 0 + - _TransparentSortPriority: 0 + - _TransparentWritingMotionVec: 0 + - _TransparentZWrite: 0 + - _UseShadowThreshold: 0 + - _WorkflowMode: 1 + - _ZTest: 4 + - _ZTestDepthEqualForOpaque: 3 + - _ZTestGBuffer: 3 + - _ZTestTransparent: 4 + - _ZWrite: 1 + - _ZWriteControl: 0 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveExposureWeight: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 1 + - transmissionFactor: 0 + m_Colors: + - _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0} + - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} + - baseColorFactor: {r: 0, g: 0, b: 0, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 1, g: 1, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] +--- !u!114 &752764914036390117 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 0 +--- !u!114 &4882466098009885765 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 11 diff --git a/Tests/Resources/Export/Materials/HDRP/EmissiveFactor.mat.meta b/Tests/Resources/Export/Materials/HDRP/EmissiveFactor.mat.meta new file mode 100644 index 00000000..6e3b9aac --- /dev/null +++ b/Tests/Resources/Export/Materials/HDRP/EmissiveFactor.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ffa41ae1b5f2c455eb3a837cf7ef2ff2 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/HDRP/EmissiveTexture.mat b/Tests/Resources/Export/Materials/HDRP/EmissiveTexture.mat new file mode 100644 index 00000000..40aa15ef --- /dev/null +++ b/Tests/Resources/Export/Materials/HDRP/EmissiveTexture.mat @@ -0,0 +1,198 @@ +%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: EmissiveTexture + m_Shader: {fileID: -6465566751694194690, guid: b9d29dfa1474148e792ac720cbd45122, type: 3} + m_ShaderKeywords: _ALPHATEST_ON _DISABLE_SSR_TRANSPARENT _EMISSIVE + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2475 + stringTagMap: + MotionVector: User + RenderType: TransparentCutout + disabledShaderPasses: + - MOTIONVECTORS + - TransparentDepthPrepass + - TransparentDepthPostpass + - TransparentBackface + - RayTracingPrepass + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 2800000, guid: f53f6abdff34c42bf8b9a9487f5fba4d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - transmissionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaCutoffEnable: 1 + - _AlphaDstBlend: 0 + - _AlphaSrcBlend: 1 + - _AlphaToMask: 0 + - _AlphaToMaskInspectorValue: 0 + - _BUILTIN_AlphaClip: 0 + - _BUILTIN_Blend: 0 + - _BUILTIN_CullMode: 2 + - _BUILTIN_DstBlend: 0 + - _BUILTIN_QueueControl: -1 + - _BUILTIN_QueueOffset: 0 + - _BUILTIN_SrcBlend: 1 + - _BUILTIN_Surface: 0 + - _BUILTIN_ZTest: 4 + - _BUILTIN_ZWrite: 1 + - _BUILTIN_ZWriteControl: 0 + - _Blend: 0 + - _BlendMode: 0 + - _BlendModePreserveSpecular: 0 + - _CastShadows: 1 + - _Cull: 2 + - _CullMode: 2 + - _CullModeForward: 2 + - _DepthOffsetEnable: 0 + - _DoubleSidedEnable: 0 + - _DoubleSidedNormalMode: 2 + - _DstBlend: 0 + - _EnableBlendModePreserveSpecularLighting: 1 + - _EnableFogOnTransparent: 1 + - _Mode: 0 + - _OpaqueCullMode: 2 + - _QueueControl: 0 + - _QueueOffset: 0 + - _RayTracing: 0 + - _ReceiveShadows: 1 + - _ReceivesSSR: 1 + - _ReceivesSSRTransparent: 0 + - _RefractionModel: 0 + - _RenderQueueType: 1 + - _RequireSplitLighting: 0 + - _SrcBlend: 1 + - _StencilRef: 0 + - _StencilRefDepth: 8 + - _StencilRefDistortionVec: 4 + - _StencilRefGBuffer: 10 + - _StencilRefMV: 40 + - _StencilWriteMask: 6 + - _StencilWriteMaskDepth: 8 + - _StencilWriteMaskDistortionVec: 4 + - _StencilWriteMaskGBuffer: 14 + - _StencilWriteMaskMV: 40 + - _SupportDecals: 1 + - _Surface: 0 + - _SurfaceType: 0 + - _TransparentBackfaceEnable: 0 + - _TransparentCullMode: 2 + - _TransparentDepthPostpassEnable: 0 + - _TransparentDepthPrepassEnable: 0 + - _TransparentSortPriority: 0 + - _TransparentWritingMotionVec: 0 + - _TransparentZWrite: 0 + - _UseShadowThreshold: 0 + - _WorkflowMode: 1 + - _ZTest: 4 + - _ZTestDepthEqualForOpaque: 3 + - _ZTestGBuffer: 3 + - _ZTestTransparent: 4 + - _ZWrite: 1 + - _ZWriteControl: 0 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveExposureWeight: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 1 + - transmissionFactor: 0 + m_Colors: + - _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0} + - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} + - baseColorFactor: {r: 0, g: 0, b: 0, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 1, g: 1, b: 1, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] +--- !u!114 &2579796636048872692 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 11 +--- !u!114 &3024038785185664378 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 0 +--- !u!114 &6458052233830712772 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 diff --git a/Tests/Resources/Export/Materials/HDRP/EmissiveTexture.mat.meta b/Tests/Resources/Export/Materials/HDRP/EmissiveTexture.mat.meta new file mode 100644 index 00000000..d1456bc2 --- /dev/null +++ b/Tests/Resources/Export/Materials/HDRP/EmissiveTexture.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7bd4e1a423ca64ec79b0aee304858a18 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/HDRP/EmissiveTextureFactor.mat b/Tests/Resources/Export/Materials/HDRP/EmissiveTextureFactor.mat new file mode 100644 index 00000000..75eca1b7 --- /dev/null +++ b/Tests/Resources/Export/Materials/HDRP/EmissiveTextureFactor.mat @@ -0,0 +1,198 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-8930221280936305980 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 0 +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: EmissiveTextureFactor + m_Shader: {fileID: -6465566751694194690, guid: b9d29dfa1474148e792ac720cbd45122, type: 3} + m_ShaderKeywords: _ALPHATEST_ON _DISABLE_SSR_TRANSPARENT _EMISSIVE _TEXTURE_TRANSFORM + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2475 + stringTagMap: + MotionVector: User + RenderType: TransparentCutout + disabledShaderPasses: + - MOTIONVECTORS + - TransparentDepthPrepass + - TransparentDepthPostpass + - TransparentBackface + - RayTracingPrepass + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 2800000, guid: f53f6abdff34c42bf8b9a9487f5fba4d, type: 3} + m_Scale: {x: 2, y: 3} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - transmissionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaCutoffEnable: 1 + - _AlphaDstBlend: 0 + - _AlphaSrcBlend: 1 + - _AlphaToMask: 0 + - _AlphaToMaskInspectorValue: 0 + - _BUILTIN_AlphaClip: 0 + - _BUILTIN_Blend: 0 + - _BUILTIN_CullMode: 2 + - _BUILTIN_DstBlend: 0 + - _BUILTIN_QueueControl: -1 + - _BUILTIN_QueueOffset: 0 + - _BUILTIN_SrcBlend: 1 + - _BUILTIN_Surface: 0 + - _BUILTIN_ZTest: 4 + - _BUILTIN_ZWrite: 1 + - _BUILTIN_ZWriteControl: 0 + - _Blend: 0 + - _BlendMode: 0 + - _BlendModePreserveSpecular: 0 + - _CastShadows: 1 + - _Cull: 2 + - _CullMode: 2 + - _CullModeForward: 2 + - _DepthOffsetEnable: 0 + - _DoubleSidedEnable: 0 + - _DoubleSidedNormalMode: 2 + - _DstBlend: 0 + - _EnableBlendModePreserveSpecularLighting: 1 + - _EnableFogOnTransparent: 1 + - _Mode: 0 + - _OpaqueCullMode: 2 + - _QueueControl: 0 + - _QueueOffset: 0 + - _RayTracing: 0 + - _ReceiveShadows: 1 + - _ReceivesSSR: 1 + - _ReceivesSSRTransparent: 0 + - _RefractionModel: 0 + - _RenderQueueType: 1 + - _RequireSplitLighting: 0 + - _SrcBlend: 1 + - _StencilRef: 0 + - _StencilRefDepth: 8 + - _StencilRefDistortionVec: 4 + - _StencilRefGBuffer: 10 + - _StencilRefMV: 40 + - _StencilWriteMask: 6 + - _StencilWriteMaskDepth: 8 + - _StencilWriteMaskDistortionVec: 4 + - _StencilWriteMaskGBuffer: 14 + - _StencilWriteMaskMV: 40 + - _SupportDecals: 1 + - _Surface: 0 + - _SurfaceType: 0 + - _TransparentBackfaceEnable: 0 + - _TransparentCullMode: 2 + - _TransparentDepthPostpassEnable: 0 + - _TransparentDepthPrepassEnable: 0 + - _TransparentSortPriority: 0 + - _TransparentWritingMotionVec: 0 + - _TransparentZWrite: 0 + - _UseShadowThreshold: 0 + - _WorkflowMode: 1 + - _ZTest: 4 + - _ZTestDepthEqualForOpaque: 3 + - _ZTestGBuffer: 3 + - _ZTestTransparent: 4 + - _ZWrite: 1 + - _ZWriteControl: 0 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveExposureWeight: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 1 + - transmissionFactor: 0 + m_Colors: + - _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0} + - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} + - baseColorFactor: {r: 0, g: 0, b: 0, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 1, g: 0.7353569, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] +--- !u!114 &2581781820884484437 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 +--- !u!114 &6741184414440526089 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 11 diff --git a/Tests/Resources/Export/Materials/HDRP/EmissiveTextureFactor.mat.meta b/Tests/Resources/Export/Materials/HDRP/EmissiveTextureFactor.mat.meta new file mode 100644 index 00000000..bb4de258 --- /dev/null +++ b/Tests/Resources/Export/Materials/HDRP/EmissiveTextureFactor.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7ff491a41b19042f59c7341b78a8ab3a +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/HDRP/Metallic.mat b/Tests/Resources/Export/Materials/HDRP/Metallic.mat new file mode 100644 index 00000000..1cf2e844 --- /dev/null +++ b/Tests/Resources/Export/Materials/HDRP/Metallic.mat @@ -0,0 +1,197 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-3607148911885502513 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 11 +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Metallic + m_Shader: {fileID: -6465566751694194690, guid: b9d29dfa1474148e792ac720cbd45122, type: 3} + m_ShaderKeywords: _ALPHATEST_ON _DISABLE_SSR_TRANSPARENT + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2475 + stringTagMap: + RenderType: TransparentCutout + disabledShaderPasses: + - MOTIONVECTORS + - TransparentDepthPrepass + - TransparentDepthPostpass + - TransparentBackface + - RayTracingPrepass + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - transmissionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaCutoffEnable: 1 + - _AlphaDstBlend: 0 + - _AlphaSrcBlend: 1 + - _AlphaToMask: 0 + - _AlphaToMaskInspectorValue: 0 + - _BUILTIN_AlphaClip: 0 + - _BUILTIN_Blend: 0 + - _BUILTIN_CullMode: 2 + - _BUILTIN_DstBlend: 0 + - _BUILTIN_QueueControl: -1 + - _BUILTIN_QueueOffset: 0 + - _BUILTIN_SrcBlend: 1 + - _BUILTIN_Surface: 0 + - _BUILTIN_ZTest: 4 + - _BUILTIN_ZWrite: 1 + - _BUILTIN_ZWriteControl: 0 + - _Blend: 0 + - _BlendMode: 0 + - _BlendModePreserveSpecular: 0 + - _CastShadows: 1 + - _Cull: 2 + - _CullMode: 2 + - _CullModeForward: 2 + - _DepthOffsetEnable: 0 + - _DoubleSidedEnable: 0 + - _DoubleSidedNormalMode: 2 + - _DstBlend: 0 + - _EnableBlendModePreserveSpecularLighting: 1 + - _EnableFogOnTransparent: 1 + - _Mode: 0 + - _OpaqueCullMode: 2 + - _QueueControl: 0 + - _QueueOffset: 0 + - _RayTracing: 0 + - _ReceiveShadows: 1 + - _ReceivesSSR: 1 + - _ReceivesSSRTransparent: 0 + - _RefractionModel: 0 + - _RenderQueueType: 1 + - _RequireSplitLighting: 0 + - _SrcBlend: 1 + - _StencilRef: 0 + - _StencilRefDepth: 8 + - _StencilRefDistortionVec: 4 + - _StencilRefGBuffer: 10 + - _StencilRefMV: 40 + - _StencilWriteMask: 6 + - _StencilWriteMaskDepth: 8 + - _StencilWriteMaskDistortionVec: 4 + - _StencilWriteMaskGBuffer: 14 + - _StencilWriteMaskMV: 40 + - _SupportDecals: 1 + - _Surface: 0 + - _SurfaceType: 0 + - _TransparentBackfaceEnable: 0 + - _TransparentCullMode: 2 + - _TransparentDepthPostpassEnable: 0 + - _TransparentDepthPrepassEnable: 0 + - _TransparentSortPriority: 0 + - _TransparentWritingMotionVec: 0 + - _TransparentZWrite: 0 + - _UseShadowThreshold: 0 + - _WorkflowMode: 1 + - _ZTest: 4 + - _ZTestDepthEqualForOpaque: 3 + - _ZTestGBuffer: 3 + - _ZTestTransparent: 4 + - _ZWrite: 1 + - _ZWriteControl: 0 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveExposureWeight: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0.89 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 0 + - transmissionFactor: 0 + m_Colors: + - _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0} + - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} + - baseColorFactor: {r: 1, g: 1, b: 1, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] +--- !u!114 &1203086932070529331 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 0 +--- !u!114 &7677109854519655275 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 diff --git a/Tests/Resources/Export/Materials/HDRP/Metallic.mat.meta b/Tests/Resources/Export/Materials/HDRP/Metallic.mat.meta new file mode 100644 index 00000000..42813c0f --- /dev/null +++ b/Tests/Resources/Export/Materials/HDRP/Metallic.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 25f2a94764230451589dbf1e7021d58e +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/HDRP/MetallicRoughnessOcclusionTexture.mat b/Tests/Resources/Export/Materials/HDRP/MetallicRoughnessOcclusionTexture.mat new file mode 100644 index 00000000..27bdb587 --- /dev/null +++ b/Tests/Resources/Export/Materials/HDRP/MetallicRoughnessOcclusionTexture.mat @@ -0,0 +1,197 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-7393323642559032507 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 0 +--- !u!114 &-4181352363440409036 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 11 +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: MetallicRoughnessOcclusionTexture + m_Shader: {fileID: -6465566751694194690, guid: b9d29dfa1474148e792ac720cbd45122, type: 3} + m_ShaderKeywords: _ALPHATEST_ON _DISABLE_SSR_TRANSPARENT + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2475 + stringTagMap: + RenderType: TransparentCutout + disabledShaderPasses: + - MOTIONVECTORS + - TransparentDepthPrepass + - TransparentDepthPostpass + - TransparentBackface + - RayTracingPrepass + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 2800000, guid: e6a8dbc8ea6f7452db96210e86372550, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 2800000, guid: e6a8dbc8ea6f7452db96210e86372550, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - transmissionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaCutoffEnable: 1 + - _AlphaDstBlend: 0 + - _AlphaSrcBlend: 1 + - _AlphaToMask: 0 + - _AlphaToMaskInspectorValue: 0 + - _BUILTIN_AlphaClip: 0 + - _BUILTIN_Blend: 0 + - _BUILTIN_CullMode: 2 + - _BUILTIN_DstBlend: 0 + - _BUILTIN_QueueControl: -1 + - _BUILTIN_QueueOffset: 0 + - _BUILTIN_SrcBlend: 1 + - _BUILTIN_Surface: 0 + - _BUILTIN_ZTest: 4 + - _BUILTIN_ZWrite: 1 + - _BUILTIN_ZWriteControl: 0 + - _Blend: 0 + - _BlendMode: 0 + - _BlendModePreserveSpecular: 0 + - _CastShadows: 1 + - _Cull: 2 + - _CullMode: 2 + - _CullModeForward: 2 + - _DepthOffsetEnable: 0 + - _DoubleSidedEnable: 0 + - _DoubleSidedNormalMode: 2 + - _DstBlend: 0 + - _EnableBlendModePreserveSpecularLighting: 1 + - _EnableFogOnTransparent: 1 + - _Mode: 0 + - _OpaqueCullMode: 2 + - _QueueControl: 0 + - _QueueOffset: 0 + - _RayTracing: 0 + - _ReceiveShadows: 1 + - _ReceivesSSR: 1 + - _ReceivesSSRTransparent: 0 + - _RefractionModel: 0 + - _RenderQueueType: 1 + - _RequireSplitLighting: 0 + - _SrcBlend: 1 + - _StencilRef: 0 + - _StencilRefDepth: 8 + - _StencilRefDistortionVec: 4 + - _StencilRefGBuffer: 10 + - _StencilRefMV: 40 + - _StencilWriteMask: 6 + - _StencilWriteMaskDepth: 8 + - _StencilWriteMaskDistortionVec: 4 + - _StencilWriteMaskGBuffer: 14 + - _StencilWriteMaskMV: 40 + - _SupportDecals: 1 + - _Surface: 0 + - _SurfaceType: 0 + - _TransparentBackfaceEnable: 0 + - _TransparentCullMode: 2 + - _TransparentDepthPostpassEnable: 0 + - _TransparentDepthPrepassEnable: 0 + - _TransparentSortPriority: 0 + - _TransparentWritingMotionVec: 0 + - _TransparentZWrite: 0 + - _UseShadowThreshold: 0 + - _WorkflowMode: 1 + - _ZTest: 4 + - _ZTestDepthEqualForOpaque: 3 + - _ZTestGBuffer: 3 + - _ZTestTransparent: 4 + - _ZWrite: 1 + - _ZWriteControl: 0 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveExposureWeight: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 1 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 0.8 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 1 + - transmissionFactor: 0 + m_Colors: + - _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0} + - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} + - baseColorFactor: {r: 0.30588236, g: 0.94509804, b: 1, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] +--- !u!114 &8822211145023048442 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 diff --git a/Tests/Resources/Export/Materials/HDRP/MetallicRoughnessOcclusionTexture.mat.meta b/Tests/Resources/Export/Materials/HDRP/MetallicRoughnessOcclusionTexture.mat.meta new file mode 100644 index 00000000..04cf2c52 --- /dev/null +++ b/Tests/Resources/Export/Materials/HDRP/MetallicRoughnessOcclusionTexture.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 005b847b2165341f3bb154b351cf8b72 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/HDRP/MetallicRoughnessTexture.mat b/Tests/Resources/Export/Materials/HDRP/MetallicRoughnessTexture.mat new file mode 100644 index 00000000..22fd1639 --- /dev/null +++ b/Tests/Resources/Export/Materials/HDRP/MetallicRoughnessTexture.mat @@ -0,0 +1,197 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-5749603472449940425 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: MetallicRoughnessTexture + m_Shader: {fileID: -6465566751694194690, guid: b9d29dfa1474148e792ac720cbd45122, type: 3} + m_ShaderKeywords: _ALPHATEST_ON _DISABLE_SSR_TRANSPARENT + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2475 + stringTagMap: + RenderType: TransparentCutout + disabledShaderPasses: + - MOTIONVECTORS + - TransparentDepthPrepass + - TransparentDepthPostpass + - TransparentBackface + - RayTracingPrepass + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 2800000, guid: e6a8dbc8ea6f7452db96210e86372550, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - transmissionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaCutoffEnable: 1 + - _AlphaDstBlend: 0 + - _AlphaSrcBlend: 1 + - _AlphaToMask: 0 + - _AlphaToMaskInspectorValue: 0 + - _BUILTIN_AlphaClip: 0 + - _BUILTIN_Blend: 0 + - _BUILTIN_CullMode: 2 + - _BUILTIN_DstBlend: 0 + - _BUILTIN_QueueControl: -1 + - _BUILTIN_QueueOffset: 0 + - _BUILTIN_SrcBlend: 1 + - _BUILTIN_Surface: 0 + - _BUILTIN_ZTest: 4 + - _BUILTIN_ZWrite: 1 + - _BUILTIN_ZWriteControl: 0 + - _Blend: 0 + - _BlendMode: 0 + - _BlendModePreserveSpecular: 0 + - _CastShadows: 1 + - _Cull: 2 + - _CullMode: 2 + - _CullModeForward: 2 + - _DepthOffsetEnable: 0 + - _DoubleSidedEnable: 0 + - _DoubleSidedNormalMode: 2 + - _DstBlend: 0 + - _EnableBlendModePreserveSpecularLighting: 1 + - _EnableFogOnTransparent: 1 + - _Mode: 0 + - _OpaqueCullMode: 2 + - _QueueControl: 0 + - _QueueOffset: 0 + - _RayTracing: 0 + - _ReceiveShadows: 1 + - _ReceivesSSR: 1 + - _ReceivesSSRTransparent: 0 + - _RefractionModel: 0 + - _RenderQueueType: 1 + - _RequireSplitLighting: 0 + - _SrcBlend: 1 + - _StencilRef: 0 + - _StencilRefDepth: 8 + - _StencilRefDistortionVec: 4 + - _StencilRefGBuffer: 10 + - _StencilRefMV: 40 + - _StencilWriteMask: 6 + - _StencilWriteMaskDepth: 8 + - _StencilWriteMaskDistortionVec: 4 + - _StencilWriteMaskGBuffer: 14 + - _StencilWriteMaskMV: 40 + - _SupportDecals: 1 + - _Surface: 0 + - _SurfaceType: 0 + - _TransparentBackfaceEnable: 0 + - _TransparentCullMode: 2 + - _TransparentDepthPostpassEnable: 0 + - _TransparentDepthPrepassEnable: 0 + - _TransparentSortPriority: 0 + - _TransparentWritingMotionVec: 0 + - _TransparentZWrite: 0 + - _UseShadowThreshold: 0 + - _WorkflowMode: 1 + - _ZTest: 4 + - _ZTestDepthEqualForOpaque: 3 + - _ZTestGBuffer: 3 + - _ZTestTransparent: 4 + - _ZWrite: 1 + - _ZWriteControl: 0 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveExposureWeight: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 1 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 1 + - transmissionFactor: 0 + m_Colors: + - _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0} + - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} + - baseColorFactor: {r: 0.30588236, g: 1, b: 0.3882353, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] +--- !u!114 &5792399793874184331 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 0 +--- !u!114 &6252396589539094185 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 11 diff --git a/Tests/Resources/Export/Materials/HDRP/MetallicRoughnessTexture.mat.meta b/Tests/Resources/Export/Materials/HDRP/MetallicRoughnessTexture.mat.meta new file mode 100644 index 00000000..657bb14a --- /dev/null +++ b/Tests/Resources/Export/Materials/HDRP/MetallicRoughnessTexture.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 56586ef84a7354afeab038a887b4944a +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/HDRP/MetallicTexture.mat b/Tests/Resources/Export/Materials/HDRP/MetallicTexture.mat new file mode 100644 index 00000000..67eba7fc --- /dev/null +++ b/Tests/Resources/Export/Materials/HDRP/MetallicTexture.mat @@ -0,0 +1,197 @@ +%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: MetallicTexture + m_Shader: {fileID: -6465566751694194690, guid: b9d29dfa1474148e792ac720cbd45122, type: 3} + m_ShaderKeywords: _ALPHATEST_ON _DISABLE_SSR_TRANSPARENT _TEXTURE_TRANSFORM + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2475 + stringTagMap: + RenderType: TransparentCutout + disabledShaderPasses: + - MOTIONVECTORS + - TransparentDepthPrepass + - TransparentDepthPostpass + - TransparentBackface + - RayTracingPrepass + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 2800000, guid: 8da4e4c98bfa44b25a9faa40105892f1, type: 3} + m_Scale: {x: 2, y: 2} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - transmissionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaCutoffEnable: 1 + - _AlphaDstBlend: 0 + - _AlphaSrcBlend: 1 + - _AlphaToMask: 0 + - _AlphaToMaskInspectorValue: 0 + - _BUILTIN_AlphaClip: 0 + - _BUILTIN_Blend: 0 + - _BUILTIN_CullMode: 2 + - _BUILTIN_DstBlend: 0 + - _BUILTIN_QueueControl: -1 + - _BUILTIN_QueueOffset: 0 + - _BUILTIN_SrcBlend: 1 + - _BUILTIN_Surface: 0 + - _BUILTIN_ZTest: 4 + - _BUILTIN_ZWrite: 1 + - _BUILTIN_ZWriteControl: 0 + - _Blend: 0 + - _BlendMode: 0 + - _BlendModePreserveSpecular: 0 + - _CastShadows: 1 + - _Cull: 2 + - _CullMode: 2 + - _CullModeForward: 2 + - _DepthOffsetEnable: 0 + - _DoubleSidedEnable: 0 + - _DoubleSidedNormalMode: 2 + - _DstBlend: 0 + - _EnableBlendModePreserveSpecularLighting: 1 + - _EnableFogOnTransparent: 1 + - _Mode: 0 + - _OpaqueCullMode: 2 + - _QueueControl: 0 + - _QueueOffset: 0 + - _RayTracing: 0 + - _ReceiveShadows: 1 + - _ReceivesSSR: 1 + - _ReceivesSSRTransparent: 0 + - _RefractionModel: 0 + - _RenderQueueType: 1 + - _RequireSplitLighting: 0 + - _SrcBlend: 1 + - _StencilRef: 0 + - _StencilRefDepth: 8 + - _StencilRefDistortionVec: 4 + - _StencilRefGBuffer: 10 + - _StencilRefMV: 40 + - _StencilWriteMask: 6 + - _StencilWriteMaskDepth: 8 + - _StencilWriteMaskDistortionVec: 4 + - _StencilWriteMaskGBuffer: 14 + - _StencilWriteMaskMV: 40 + - _SupportDecals: 1 + - _Surface: 0 + - _SurfaceType: 0 + - _TransparentBackfaceEnable: 0 + - _TransparentCullMode: 2 + - _TransparentDepthPostpassEnable: 0 + - _TransparentDepthPrepassEnable: 0 + - _TransparentSortPriority: 0 + - _TransparentWritingMotionVec: 0 + - _TransparentZWrite: 0 + - _UseShadowThreshold: 0 + - _WorkflowMode: 1 + - _ZTest: 4 + - _ZTestDepthEqualForOpaque: 3 + - _ZTestGBuffer: 3 + - _ZTestTransparent: 4 + - _ZWrite: 1 + - _ZWriteControl: 0 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveExposureWeight: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 1 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 1 + - transmissionFactor: 0 + m_Colors: + - _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0} + - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} + - baseColorFactor: {r: 0.30588236, g: 1, b: 0.3882353, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] +--- !u!114 &6329480415554470436 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 +--- !u!114 &6688152443506402959 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 0 +--- !u!114 &7887590303826644738 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 11 diff --git a/Tests/Resources/Export/Materials/HDRP/MetallicTexture.mat.meta b/Tests/Resources/Export/Materials/HDRP/MetallicTexture.mat.meta new file mode 100644 index 00000000..89b730d0 --- /dev/null +++ b/Tests/Resources/Export/Materials/HDRP/MetallicTexture.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6a23a9597c84549e8bbec183f45d1d6a +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/HDRP/NormalTexture.mat b/Tests/Resources/Export/Materials/HDRP/NormalTexture.mat new file mode 100644 index 00000000..c47e6867 --- /dev/null +++ b/Tests/Resources/Export/Materials/HDRP/NormalTexture.mat @@ -0,0 +1,198 @@ +%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: NormalTexture + m_Shader: {fileID: -6465566751694194690, guid: b9d29dfa1474148e792ac720cbd45122, type: 3} + m_ShaderKeywords: _ALPHATEST_ON _DISABLE_SSR_TRANSPARENT _TEXTURE_TRANSFORM + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2475 + stringTagMap: + MotionVector: User + RenderType: TransparentCutout + disabledShaderPasses: + - MOTIONVECTORS + - TransparentDepthPrepass + - TransparentDepthPostpass + - TransparentBackface + - RayTracingPrepass + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 2800000, guid: e5fa3fd4c4ccd4b5c972e3746a01539d, type: 3} + m_Scale: {x: 1.5, y: 1.2} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - transmissionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaCutoffEnable: 1 + - _AlphaDstBlend: 0 + - _AlphaSrcBlend: 1 + - _AlphaToMask: 0 + - _AlphaToMaskInspectorValue: 0 + - _BUILTIN_AlphaClip: 0 + - _BUILTIN_Blend: 0 + - _BUILTIN_CullMode: 2 + - _BUILTIN_DstBlend: 0 + - _BUILTIN_QueueControl: -1 + - _BUILTIN_QueueOffset: 0 + - _BUILTIN_SrcBlend: 1 + - _BUILTIN_Surface: 0 + - _BUILTIN_ZTest: 4 + - _BUILTIN_ZWrite: 1 + - _BUILTIN_ZWriteControl: 0 + - _Blend: 0 + - _BlendMode: 0 + - _BlendModePreserveSpecular: 0 + - _CastShadows: 1 + - _Cull: 2 + - _CullMode: 2 + - _CullModeForward: 2 + - _DepthOffsetEnable: 0 + - _DoubleSidedEnable: 0 + - _DoubleSidedNormalMode: 2 + - _DstBlend: 0 + - _EnableBlendModePreserveSpecularLighting: 1 + - _EnableFogOnTransparent: 1 + - _Mode: 0 + - _OpaqueCullMode: 2 + - _QueueControl: 0 + - _QueueOffset: 0 + - _RayTracing: 0 + - _ReceiveShadows: 1 + - _ReceivesSSR: 1 + - _ReceivesSSRTransparent: 0 + - _RefractionModel: 0 + - _RenderQueueType: 1 + - _RequireSplitLighting: 0 + - _SrcBlend: 1 + - _StencilRef: 0 + - _StencilRefDepth: 8 + - _StencilRefDistortionVec: 4 + - _StencilRefGBuffer: 10 + - _StencilRefMV: 40 + - _StencilWriteMask: 6 + - _StencilWriteMaskDepth: 8 + - _StencilWriteMaskDistortionVec: 4 + - _StencilWriteMaskGBuffer: 14 + - _StencilWriteMaskMV: 40 + - _SupportDecals: 1 + - _Surface: 0 + - _SurfaceType: 0 + - _TransparentBackfaceEnable: 0 + - _TransparentCullMode: 2 + - _TransparentDepthPostpassEnable: 0 + - _TransparentDepthPrepassEnable: 0 + - _TransparentSortPriority: 0 + - _TransparentWritingMotionVec: 0 + - _TransparentZWrite: 0 + - _UseShadowThreshold: 0 + - _WorkflowMode: 1 + - _ZTest: 4 + - _ZTestDepthEqualForOpaque: 3 + - _ZTestGBuffer: 3 + - _ZTestTransparent: 4 + - _ZWrite: 1 + - _ZWriteControl: 0 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveExposureWeight: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1.1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 0.5 + - transmissionFactor: 0 + m_Colors: + - _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0} + - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} + - baseColorFactor: {r: 1, g: 1, b: 1, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] +--- !u!114 &1138547567241307365 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 0 +--- !u!114 &3626248866102231885 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 +--- !u!114 &5196027134451525230 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 11 diff --git a/Tests/Resources/Export/Materials/HDRP/NormalTexture.mat.meta b/Tests/Resources/Export/Materials/HDRP/NormalTexture.mat.meta new file mode 100644 index 00000000..b2577c9a --- /dev/null +++ b/Tests/Resources/Export/Materials/HDRP/NormalTexture.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b1b1f8cdb0cae4b5fa2f293ee3fa4300 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/HDRP/NotGltf.mat b/Tests/Resources/Export/Materials/HDRP/NotGltf.mat new file mode 100644 index 00000000..7e49eb73 --- /dev/null +++ b/Tests/Resources/Export/Materials/HDRP/NotGltf.mat @@ -0,0 +1,209 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-3162871190671430744 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 +--- !u!114 &-2485062674677238067 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 0 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: NotGltf + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - baseColorTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - transmissionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _BUILTIN_AlphaClip: 0 + - _BUILTIN_Blend: 0 + - _BUILTIN_CullMode: 2 + - _BUILTIN_DstBlend: 0 + - _BUILTIN_QueueControl: -1 + - _BUILTIN_QueueOffset: 0 + - _BUILTIN_SrcBlend: 1 + - _BUILTIN_Surface: 0 + - _BUILTIN_ZTest: 4 + - _BUILTIN_ZWrite: 1 + - _BUILTIN_ZWriteControl: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 0 + - _BumpScale: 1 + - _CastShadows: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _QueueControl: 0 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0.5 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _UVSec: 0 + - _WorkflowMode: 1 + - _ZTest: 4 + - _ZWrite: 1 + - _ZWriteControl: 0 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveExposureWeight: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 1 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 1 + - transmissionFactor: 0 + m_Colors: + - _BaseColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + - baseColorFactor: {r: 1, g: 1, b: 1, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] + m_AllowLocking: 1 diff --git a/Tests/Resources/Export/Materials/HDRP/NotGltf.mat.meta b/Tests/Resources/Export/Materials/HDRP/NotGltf.mat.meta new file mode 100644 index 00000000..c9056987 --- /dev/null +++ b/Tests/Resources/Export/Materials/HDRP/NotGltf.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6b6837e5525a04fe7b58b1af4435ba0d +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/HDRP/OcclusionTexture.mat b/Tests/Resources/Export/Materials/HDRP/OcclusionTexture.mat new file mode 100644 index 00000000..c1c2381c --- /dev/null +++ b/Tests/Resources/Export/Materials/HDRP/OcclusionTexture.mat @@ -0,0 +1,197 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-6563399278336437715 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: OcclusionTexture + m_Shader: {fileID: -6465566751694194690, guid: b9d29dfa1474148e792ac720cbd45122, type: 3} + m_ShaderKeywords: _ALPHATEST_ON _DISABLE_SSR_TRANSPARENT _TEXTURE_TRANSFORM + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2475 + stringTagMap: + RenderType: TransparentCutout + disabledShaderPasses: + - MOTIONVECTORS + - TransparentDepthPrepass + - TransparentDepthPostpass + - TransparentBackface + - RayTracingPrepass + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 2800000, guid: a0989fa75442a4f299d3e16bd238de3b, type: 3} + m_Scale: {x: 2, y: 2} + m_Offset: {x: 0, y: 0} + - transmissionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaCutoffEnable: 1 + - _AlphaDstBlend: 0 + - _AlphaSrcBlend: 1 + - _AlphaToMask: 0 + - _AlphaToMaskInspectorValue: 0 + - _BUILTIN_AlphaClip: 0 + - _BUILTIN_Blend: 0 + - _BUILTIN_CullMode: 2 + - _BUILTIN_DstBlend: 0 + - _BUILTIN_QueueControl: -1 + - _BUILTIN_QueueOffset: 0 + - _BUILTIN_SrcBlend: 1 + - _BUILTIN_Surface: 0 + - _BUILTIN_ZTest: 4 + - _BUILTIN_ZWrite: 1 + - _BUILTIN_ZWriteControl: 0 + - _Blend: 0 + - _BlendMode: 0 + - _BlendModePreserveSpecular: 0 + - _CastShadows: 1 + - _Cull: 2 + - _CullMode: 2 + - _CullModeForward: 2 + - _DepthOffsetEnable: 0 + - _DoubleSidedEnable: 0 + - _DoubleSidedNormalMode: 2 + - _DstBlend: 0 + - _EnableBlendModePreserveSpecularLighting: 1 + - _EnableFogOnTransparent: 1 + - _Mode: 0 + - _OpaqueCullMode: 2 + - _QueueControl: 0 + - _QueueOffset: 0 + - _RayTracing: 0 + - _ReceiveShadows: 1 + - _ReceivesSSR: 1 + - _ReceivesSSRTransparent: 0 + - _RefractionModel: 0 + - _RenderQueueType: 1 + - _RequireSplitLighting: 0 + - _SrcBlend: 1 + - _StencilRef: 0 + - _StencilRefDepth: 8 + - _StencilRefDistortionVec: 4 + - _StencilRefGBuffer: 10 + - _StencilRefMV: 40 + - _StencilWriteMask: 6 + - _StencilWriteMaskDepth: 8 + - _StencilWriteMaskDistortionVec: 4 + - _StencilWriteMaskGBuffer: 14 + - _StencilWriteMaskMV: 40 + - _SupportDecals: 1 + - _Surface: 0 + - _SurfaceType: 0 + - _TransparentBackfaceEnable: 0 + - _TransparentCullMode: 2 + - _TransparentDepthPostpassEnable: 0 + - _TransparentDepthPrepassEnable: 0 + - _TransparentSortPriority: 0 + - _TransparentWritingMotionVec: 0 + - _TransparentZWrite: 0 + - _UseShadowThreshold: 0 + - _WorkflowMode: 1 + - _ZTest: 4 + - _ZTestDepthEqualForOpaque: 3 + - _ZTestGBuffer: 3 + - _ZTestTransparent: 4 + - _ZWrite: 1 + - _ZWriteControl: 0 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveExposureWeight: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 0.8 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 0.7 + - transmissionFactor: 0 + m_Colors: + - _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0} + - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} + - baseColorFactor: {r: 1, g: 0.85672647, b: 0.58965355, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] +--- !u!114 &4661383101410321536 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 0 +--- !u!114 &6970435888722911132 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 11 diff --git a/Tests/Resources/Export/Materials/HDRP/OcclusionTexture.mat.meta b/Tests/Resources/Export/Materials/HDRP/OcclusionTexture.mat.meta new file mode 100644 index 00000000..7fd8e770 --- /dev/null +++ b/Tests/Resources/Export/Materials/HDRP/OcclusionTexture.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5bd1e29e7543846c8b76044599b3c70a +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/HDRP/Omni.mat b/Tests/Resources/Export/Materials/HDRP/Omni.mat new file mode 100644 index 00000000..bcf184dd --- /dev/null +++ b/Tests/Resources/Export/Materials/HDRP/Omni.mat @@ -0,0 +1,199 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-7342136019923642577 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 11 +--- !u!114 &-937208297705619245 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Omni + m_Shader: {fileID: -6465566751694194690, guid: b9d29dfa1474148e792ac720cbd45122, type: 3} + m_ShaderKeywords: _ALPHATEST_ON _DISABLE_SSR_TRANSPARENT _TEXTURE_TRANSFORM _EMISSIVE + _OCCLUSION + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2475 + stringTagMap: + MotionVector: User + RenderType: TransparentCutout + disabledShaderPasses: + - MOTIONVECTORS + - TransparentDepthPrepass + - TransparentDepthPostpass + - TransparentBackface + - RayTracingPrepass + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 2800000, guid: 767b013dd53264d2a858edf8651b320d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0.4, y: 0.6} + - emissiveTexture: + m_Texture: {fileID: 2800000, guid: f53f6abdff34c42bf8b9a9487f5fba4d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0.1, y: 0.2} + - metallicRoughnessTexture: + m_Texture: {fileID: 2800000, guid: e6a8dbc8ea6f7452db96210e86372550, type: 3} + m_Scale: {x: 1.11, y: 1.21} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 2800000, guid: e5fa3fd4c4ccd4b5c972e3746a01539d, type: 3} + m_Scale: {x: 1.5, y: 1.2} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 2800000, guid: e6a8dbc8ea6f7452db96210e86372550, type: 3} + m_Scale: {x: 1.1, y: 1.2} + m_Offset: {x: 0, y: 0} + - transmissionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaCutoffEnable: 1 + - _AlphaDstBlend: 0 + - _AlphaSrcBlend: 1 + - _AlphaToMask: 0 + - _AlphaToMaskInspectorValue: 0 + - _BUILTIN_AlphaClip: 0 + - _BUILTIN_Blend: 0 + - _BUILTIN_CullMode: 2 + - _BUILTIN_DstBlend: 0 + - _BUILTIN_QueueControl: -1 + - _BUILTIN_QueueOffset: 0 + - _BUILTIN_SrcBlend: 1 + - _BUILTIN_Surface: 0 + - _BUILTIN_ZTest: 4 + - _BUILTIN_ZWrite: 1 + - _BUILTIN_ZWriteControl: 0 + - _Blend: 0 + - _BlendMode: 0 + - _BlendModePreserveSpecular: 0 + - _CastShadows: 1 + - _Cull: 2 + - _CullMode: 2 + - _CullModeForward: 2 + - _DepthOffsetEnable: 0 + - _DoubleSidedEnable: 0 + - _DoubleSidedNormalMode: 2 + - _DstBlend: 0 + - _EnableBlendModePreserveSpecularLighting: 1 + - _EnableFogOnTransparent: 1 + - _Mode: 0 + - _OpaqueCullMode: 2 + - _QueueControl: 0 + - _QueueOffset: 0 + - _RayTracing: 0 + - _ReceiveShadows: 1 + - _ReceivesSSR: 1 + - _ReceivesSSRTransparent: 0 + - _RefractionModel: 0 + - _RenderQueueType: 1 + - _RequireSplitLighting: 0 + - _SrcBlend: 1 + - _StencilRef: 0 + - _StencilRefDepth: 8 + - _StencilRefDistortionVec: 4 + - _StencilRefGBuffer: 10 + - _StencilRefMV: 40 + - _StencilWriteMask: 6 + - _StencilWriteMaskDepth: 8 + - _StencilWriteMaskDistortionVec: 4 + - _StencilWriteMaskGBuffer: 14 + - _StencilWriteMaskMV: 40 + - _SupportDecals: 1 + - _Surface: 0 + - _SurfaceType: 0 + - _TransparentBackfaceEnable: 0 + - _TransparentCullMode: 2 + - _TransparentDepthPostpassEnable: 0 + - _TransparentDepthPrepassEnable: 0 + - _TransparentSortPriority: 0 + - _TransparentWritingMotionVec: 0 + - _TransparentZWrite: 0 + - _UseShadowThreshold: 0 + - _WorkflowMode: 1 + - _ZTest: 4 + - _ZTestDepthEqualForOpaque: 3 + - _ZTestGBuffer: 3 + - _ZTestTransparent: 4 + - _ZWrite: 1 + - _ZWriteControl: 0 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveExposureWeight: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0.95 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 0.42 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 0.58 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 0.93 + - transmissionFactor: 0 + m_Colors: + - _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0} + - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} + - baseColorFactor: {r: 0.9, g: 0.8, b: 0.7, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 1, g: 1, b: 1, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] +--- !u!114 &4475698861775716853 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 0 diff --git a/Tests/Resources/Export/Materials/HDRP/Omni.mat.meta b/Tests/Resources/Export/Materials/HDRP/Omni.mat.meta new file mode 100644 index 00000000..51b7f28a --- /dev/null +++ b/Tests/Resources/Export/Materials/HDRP/Omni.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 634b5f771917c4c5699102dbd7289163 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/HDRP/RoughnessTexture.mat b/Tests/Resources/Export/Materials/HDRP/RoughnessTexture.mat new file mode 100644 index 00000000..8265ea50 --- /dev/null +++ b/Tests/Resources/Export/Materials/HDRP/RoughnessTexture.mat @@ -0,0 +1,197 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-7184335634477803850 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: RoughnessTexture + m_Shader: {fileID: -6465566751694194690, guid: b9d29dfa1474148e792ac720cbd45122, type: 3} + m_ShaderKeywords: _ALPHATEST_ON _DISABLE_SSR_TRANSPARENT + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2475 + stringTagMap: + RenderType: TransparentCutout + disabledShaderPasses: + - MOTIONVECTORS + - TransparentDepthPrepass + - TransparentDepthPostpass + - TransparentBackface + - RayTracingPrepass + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 2800000, guid: 236ba889a0d5e48bf977cee24ffcb55f, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - transmissionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaCutoffEnable: 1 + - _AlphaDstBlend: 0 + - _AlphaSrcBlend: 1 + - _AlphaToMask: 0 + - _AlphaToMaskInspectorValue: 0 + - _BUILTIN_AlphaClip: 0 + - _BUILTIN_Blend: 0 + - _BUILTIN_CullMode: 2 + - _BUILTIN_DstBlend: 0 + - _BUILTIN_QueueControl: -1 + - _BUILTIN_QueueOffset: 0 + - _BUILTIN_SrcBlend: 1 + - _BUILTIN_Surface: 0 + - _BUILTIN_ZTest: 4 + - _BUILTIN_ZWrite: 1 + - _BUILTIN_ZWriteControl: 0 + - _Blend: 0 + - _BlendMode: 0 + - _BlendModePreserveSpecular: 0 + - _CastShadows: 1 + - _Cull: 2 + - _CullMode: 2 + - _CullModeForward: 2 + - _DepthOffsetEnable: 0 + - _DoubleSidedEnable: 0 + - _DoubleSidedNormalMode: 2 + - _DstBlend: 0 + - _EnableBlendModePreserveSpecularLighting: 1 + - _EnableFogOnTransparent: 1 + - _Mode: 0 + - _OpaqueCullMode: 2 + - _QueueControl: 0 + - _QueueOffset: 0 + - _RayTracing: 0 + - _ReceiveShadows: 1 + - _ReceivesSSR: 1 + - _ReceivesSSRTransparent: 0 + - _RefractionModel: 0 + - _RenderQueueType: 1 + - _RequireSplitLighting: 0 + - _SrcBlend: 1 + - _StencilRef: 0 + - _StencilRefDepth: 8 + - _StencilRefDistortionVec: 4 + - _StencilRefGBuffer: 10 + - _StencilRefMV: 40 + - _StencilWriteMask: 6 + - _StencilWriteMaskDepth: 8 + - _StencilWriteMaskDistortionVec: 4 + - _StencilWriteMaskGBuffer: 14 + - _StencilWriteMaskMV: 40 + - _SupportDecals: 1 + - _Surface: 0 + - _SurfaceType: 0 + - _TransparentBackfaceEnable: 0 + - _TransparentCullMode: 2 + - _TransparentDepthPostpassEnable: 0 + - _TransparentDepthPrepassEnable: 0 + - _TransparentSortPriority: 0 + - _TransparentWritingMotionVec: 0 + - _TransparentZWrite: 0 + - _UseShadowThreshold: 0 + - _WorkflowMode: 1 + - _ZTest: 4 + - _ZTestDepthEqualForOpaque: 3 + - _ZTestGBuffer: 3 + - _ZTestTransparent: 4 + - _ZWrite: 1 + - _ZWriteControl: 0 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveExposureWeight: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 0.89 + - transmissionFactor: 0 + m_Colors: + - _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0} + - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} + - baseColorFactor: {r: 0.30588236, g: 1, b: 0.3882353, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] +--- !u!114 &794918956778256769 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 11 +--- !u!114 &2774689119717281520 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 0 diff --git a/Tests/Resources/Export/Materials/HDRP/RoughnessTexture.mat.meta b/Tests/Resources/Export/Materials/HDRP/RoughnessTexture.mat.meta new file mode 100644 index 00000000..37ec0abf --- /dev/null +++ b/Tests/Resources/Export/Materials/HDRP/RoughnessTexture.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f0f7140270ed44d238bec0e4e29d38f1 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/Textures.meta b/Tests/Resources/Export/Materials/Textures.meta new file mode 100644 index 00000000..2ee5726f --- /dev/null +++ b/Tests/Resources/Export/Materials/Textures.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 88b0c34b1a4d54c48b7a00020521a5b1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/Textures/emissive.jpg b/Tests/Resources/Export/Materials/Textures/emissive.jpg new file mode 100644 index 00000000..24619f99 --- /dev/null +++ b/Tests/Resources/Export/Materials/Textures/emissive.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:981c4abc88aa154869ba0659aa2e5384b189264c6207685d94f26ac6752041ae +size 1380 diff --git a/Tests/Resources/Export/Materials/Textures/emissive.jpg.meta b/Tests/Resources/Export/Materials/Textures/emissive.jpg.meta new file mode 100644 index 00000000..68aacb88 --- /dev/null +++ b/Tests/Resources/Export/Materials/Textures/emissive.jpg.meta @@ -0,0 +1,157 @@ +fileFormatVersion: 2 +guid: f53f6abdff34c42bf8b9a9487f5fba4d +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: tvOS + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/Textures/metallic.jpg b/Tests/Resources/Export/Materials/Textures/metallic.jpg new file mode 100644 index 00000000..bca8fcdf --- /dev/null +++ b/Tests/Resources/Export/Materials/Textures/metallic.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5e272ac4bd7aa52aefa5f17e37a758e2b810f6c02e10b74798147e0c6d8ca920 +size 4771 diff --git a/Tests/Resources/Export/Materials/Textures/metallic.jpg.meta b/Tests/Resources/Export/Materials/Textures/metallic.jpg.meta new file mode 100644 index 00000000..d60dcf21 --- /dev/null +++ b/Tests/Resources/Export/Materials/Textures/metallic.jpg.meta @@ -0,0 +1,157 @@ +fileFormatVersion: 2 +guid: 8da4e4c98bfa44b25a9faa40105892f1 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: tvOS + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/Textures/normal.png b/Tests/Resources/Export/Materials/Textures/normal.png new file mode 100644 index 00000000..2a700dcb --- /dev/null +++ b/Tests/Resources/Export/Materials/Textures/normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dd0702b6b841c9d8d3487466a2c65e13871b5cc87c1022f2fb3d594083c6a82b +size 30059 diff --git a/Tests/Resources/Export/Materials/Textures/normal.png.meta b/Tests/Resources/Export/Materials/Textures/normal.png.meta new file mode 100644 index 00000000..49dbdb57 --- /dev/null +++ b/Tests/Resources/Export/Materials/Textures/normal.png.meta @@ -0,0 +1,157 @@ +fileFormatVersion: 2 +guid: e5fa3fd4c4ccd4b5c972e3746a01539d +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 1 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: tvOS + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/Textures/occlusion-roughness-metallness.jpg b/Tests/Resources/Export/Materials/Textures/occlusion-roughness-metallness.jpg new file mode 100644 index 00000000..cd83bb8c --- /dev/null +++ b/Tests/Resources/Export/Materials/Textures/occlusion-roughness-metallness.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:122e771dfd8afb7d5afaef9b26fae3491390a5c3847400fe379a77a29f0f79d6 +size 3055 diff --git a/Tests/Resources/Export/Materials/Textures/occlusion-roughness-metallness.jpg.meta b/Tests/Resources/Export/Materials/Textures/occlusion-roughness-metallness.jpg.meta new file mode 100644 index 00000000..e52b95d5 --- /dev/null +++ b/Tests/Resources/Export/Materials/Textures/occlusion-roughness-metallness.jpg.meta @@ -0,0 +1,157 @@ +fileFormatVersion: 2 +guid: e6a8dbc8ea6f7452db96210e86372550 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: tvOS + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/Textures/occlusion.jpg b/Tests/Resources/Export/Materials/Textures/occlusion.jpg new file mode 100644 index 00000000..d516cfd1 --- /dev/null +++ b/Tests/Resources/Export/Materials/Textures/occlusion.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d0848f5db6b5e721558f58ed655e402c126a36f1a88236724c41e3947e378071 +size 3238 diff --git a/Tests/Resources/Export/Materials/Textures/occlusion.jpg.meta b/Tests/Resources/Export/Materials/Textures/occlusion.jpg.meta new file mode 100644 index 00000000..fd41a74a --- /dev/null +++ b/Tests/Resources/Export/Materials/Textures/occlusion.jpg.meta @@ -0,0 +1,157 @@ +fileFormatVersion: 2 +guid: a0989fa75442a4f299d3e16bd238de3b +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: tvOS + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/Textures/roughness.jpg b/Tests/Resources/Export/Materials/Textures/roughness.jpg new file mode 100644 index 00000000..0c72c3f5 --- /dev/null +++ b/Tests/Resources/Export/Materials/Textures/roughness.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a2324cc2affa9d9593f4f1a7371ef5c89e932642eb909df89eacc5b1f7adc6b8 +size 681 diff --git a/Tests/Resources/Export/Materials/Textures/roughness.jpg.meta b/Tests/Resources/Export/Materials/Textures/roughness.jpg.meta new file mode 100644 index 00000000..925f116b --- /dev/null +++ b/Tests/Resources/Export/Materials/Textures/roughness.jpg.meta @@ -0,0 +1,157 @@ +fileFormatVersion: 2 +guid: 236ba889a0d5e48bf977cee24ffcb55f +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 0 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: iPhone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: tvOS + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/URP.meta b/Tests/Resources/Export/Materials/URP.meta new file mode 100644 index 00000000..6d127306 --- /dev/null +++ b/Tests/Resources/Export/Materials/URP.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 905df68a4a6c641e6a2dffddc2a8ddb5 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/URP/BaseColor.mat b/Tests/Resources/Export/Materials/URP/BaseColor.mat new file mode 100644 index 00000000..02dd89d3 --- /dev/null +++ b/Tests/Resources/Export/Materials/URP/BaseColor.mat @@ -0,0 +1,197 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-6868728779799944013 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 0 +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: BaseColor + m_Shader: {fileID: -6465566751694194690, guid: b9d29dfa1474148e792ac720cbd45122, type: 3} + m_ShaderKeywords: _ALPHATEST_ON _DISABLE_SSR_TRANSPARENT + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2475 + stringTagMap: + RenderType: TransparentCutout + disabledShaderPasses: + - MOTIONVECTORS + - TransparentDepthPrepass + - TransparentDepthPostpass + - TransparentBackface + - RayTracingPrepass + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - transmissionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaCutoffEnable: 1 + - _AlphaDstBlend: 0 + - _AlphaSrcBlend: 1 + - _AlphaToMask: 0 + - _AlphaToMaskInspectorValue: 0 + - _BUILTIN_AlphaClip: 0 + - _BUILTIN_Blend: 0 + - _BUILTIN_CullMode: 2 + - _BUILTIN_DstBlend: 0 + - _BUILTIN_QueueControl: -1 + - _BUILTIN_QueueOffset: 0 + - _BUILTIN_SrcBlend: 1 + - _BUILTIN_Surface: 0 + - _BUILTIN_ZTest: 4 + - _BUILTIN_ZWrite: 1 + - _BUILTIN_ZWriteControl: 0 + - _Blend: 0 + - _BlendMode: 0 + - _BlendModePreserveSpecular: 0 + - _CastShadows: 1 + - _Cull: 2 + - _CullMode: 2 + - _CullModeForward: 2 + - _DepthOffsetEnable: 0 + - _DoubleSidedEnable: 0 + - _DoubleSidedNormalMode: 2 + - _DstBlend: 0 + - _EnableBlendModePreserveSpecularLighting: 1 + - _EnableFogOnTransparent: 1 + - _Mode: 0 + - _OpaqueCullMode: 2 + - _QueueControl: 0 + - _QueueOffset: 0 + - _RayTracing: 0 + - _ReceiveShadows: 1 + - _ReceivesSSR: 1 + - _ReceivesSSRTransparent: 0 + - _RefractionModel: 0 + - _RenderQueueType: 1 + - _RequireSplitLighting: 0 + - _SrcBlend: 1 + - _StencilRef: 0 + - _StencilRefDepth: 8 + - _StencilRefDistortionVec: 4 + - _StencilRefGBuffer: 10 + - _StencilRefMV: 40 + - _StencilWriteMask: 6 + - _StencilWriteMaskDepth: 8 + - _StencilWriteMaskDistortionVec: 4 + - _StencilWriteMaskGBuffer: 14 + - _StencilWriteMaskMV: 40 + - _SupportDecals: 1 + - _Surface: 0 + - _SurfaceType: 0 + - _TransparentBackfaceEnable: 0 + - _TransparentCullMode: 2 + - _TransparentDepthPostpassEnable: 0 + - _TransparentDepthPrepassEnable: 0 + - _TransparentSortPriority: 0 + - _TransparentWritingMotionVec: 0 + - _TransparentZWrite: 0 + - _UseShadowThreshold: 0 + - _WorkflowMode: 1 + - _ZTest: 4 + - _ZTestDepthEqualForOpaque: 3 + - _ZTestGBuffer: 3 + - _ZTestTransparent: 4 + - _ZWrite: 1 + - _ZWriteControl: 0 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveExposureWeight: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 0.5 + - transmissionFactor: 0 + m_Colors: + - _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0} + - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} + - baseColorFactor: {r: 0.48452914, g: 0.7353569, b: 0.880825, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] +--- !u!114 &3748538558603016288 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 11 +--- !u!114 &8190096692948843879 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 diff --git a/Tests/Resources/Export/Materials/URP/BaseColor.mat.meta b/Tests/Resources/Export/Materials/URP/BaseColor.mat.meta new file mode 100644 index 00000000..d96d47da --- /dev/null +++ b/Tests/Resources/Export/Materials/URP/BaseColor.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a0fe4e32a5bee4221a50f06f60dbee97 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/URP/BaseColorTexture.mat b/Tests/Resources/Export/Materials/URP/BaseColorTexture.mat new file mode 100644 index 00000000..5cece5f7 --- /dev/null +++ b/Tests/Resources/Export/Materials/URP/BaseColorTexture.mat @@ -0,0 +1,197 @@ +%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: BaseColorTexture + m_Shader: {fileID: -6465566751694194690, guid: b9d29dfa1474148e792ac720cbd45122, type: 3} + m_ShaderKeywords: _ALPHATEST_ON _DISABLE_SSR_TRANSPARENT + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2475 + stringTagMap: + RenderType: TransparentCutout + disabledShaderPasses: + - MOTIONVECTORS + - TransparentDepthPrepass + - TransparentDepthPostpass + - TransparentBackface + - RayTracingPrepass + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 2800000, guid: 767b013dd53264d2a858edf8651b320d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - transmissionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaCutoffEnable: 1 + - _AlphaDstBlend: 0 + - _AlphaSrcBlend: 1 + - _AlphaToMask: 0 + - _AlphaToMaskInspectorValue: 0 + - _BUILTIN_AlphaClip: 0 + - _BUILTIN_Blend: 0 + - _BUILTIN_CullMode: 2 + - _BUILTIN_DstBlend: 0 + - _BUILTIN_QueueControl: -1 + - _BUILTIN_QueueOffset: 0 + - _BUILTIN_SrcBlend: 1 + - _BUILTIN_Surface: 0 + - _BUILTIN_ZTest: 4 + - _BUILTIN_ZWrite: 1 + - _BUILTIN_ZWriteControl: 0 + - _Blend: 0 + - _BlendMode: 0 + - _BlendModePreserveSpecular: 0 + - _CastShadows: 1 + - _Cull: 2 + - _CullMode: 2 + - _CullModeForward: 2 + - _DepthOffsetEnable: 0 + - _DoubleSidedEnable: 0 + - _DoubleSidedNormalMode: 2 + - _DstBlend: 0 + - _EnableBlendModePreserveSpecularLighting: 1 + - _EnableFogOnTransparent: 1 + - _Mode: 0 + - _OpaqueCullMode: 2 + - _QueueControl: 0 + - _QueueOffset: 0 + - _RayTracing: 0 + - _ReceiveShadows: 1 + - _ReceivesSSR: 1 + - _ReceivesSSRTransparent: 0 + - _RefractionModel: 0 + - _RenderQueueType: 1 + - _RequireSplitLighting: 0 + - _SrcBlend: 1 + - _StencilRef: 0 + - _StencilRefDepth: 8 + - _StencilRefDistortionVec: 4 + - _StencilRefGBuffer: 10 + - _StencilRefMV: 40 + - _StencilWriteMask: 6 + - _StencilWriteMaskDepth: 8 + - _StencilWriteMaskDistortionVec: 4 + - _StencilWriteMaskGBuffer: 14 + - _StencilWriteMaskMV: 40 + - _SupportDecals: 1 + - _Surface: 0 + - _SurfaceType: 0 + - _TransparentBackfaceEnable: 0 + - _TransparentCullMode: 2 + - _TransparentDepthPostpassEnable: 0 + - _TransparentDepthPrepassEnable: 0 + - _TransparentSortPriority: 0 + - _TransparentWritingMotionVec: 0 + - _TransparentZWrite: 0 + - _UseShadowThreshold: 0 + - _WorkflowMode: 1 + - _ZTest: 4 + - _ZTestDepthEqualForOpaque: 3 + - _ZTestGBuffer: 3 + - _ZTestTransparent: 4 + - _ZWrite: 1 + - _ZWriteControl: 0 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveExposureWeight: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 0.5 + - transmissionFactor: 0 + m_Colors: + - _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0} + - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} + - baseColorFactor: {r: 0.9, g: 0.8, b: 0.7, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] +--- !u!114 &3271681715824319525 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 0 +--- !u!114 &4242709241036237138 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 11 +--- !u!114 &8297463674298635704 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 diff --git a/Tests/Resources/Export/Materials/URP/BaseColorTexture.mat.meta b/Tests/Resources/Export/Materials/URP/BaseColorTexture.mat.meta new file mode 100644 index 00000000..0c8648a4 --- /dev/null +++ b/Tests/Resources/Export/Materials/URP/BaseColorTexture.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ca2d8882652fd41119239fb65fd3046f +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/URP/BaseColorTextureCutout.mat b/Tests/Resources/Export/Materials/URP/BaseColorTextureCutout.mat new file mode 100644 index 00000000..dfa0013e --- /dev/null +++ b/Tests/Resources/Export/Materials/URP/BaseColorTextureCutout.mat @@ -0,0 +1,135 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-6792439800286000282 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 0 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: BaseColorTextureCutout + m_Shader: {fileID: -6465566751694194690, guid: b9d29dfa1474148e792ac720cbd45122, + type: 3} + m_ValidKeywords: + - _ALPHATEST_ON + m_InvalidKeywords: [] + m_LightmapFlags: 2 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 1 + m_CustomRenderQueue: 2450 + stringTagMap: + RenderType: TransparentCutout + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 2800000, guid: 1e22bd6b46ceb4d0c99cfdb552ec8586, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - transmissionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AlphaClip: 1 + - _BUILTIN_AlphaClip: 0 + - _BUILTIN_Blend: 0 + - _BUILTIN_CullMode: 2 + - _BUILTIN_DstBlend: 0 + - _BUILTIN_QueueControl: 1 + - _BUILTIN_QueueOffset: 0 + - _BUILTIN_SrcBlend: 1 + - _BUILTIN_Surface: 0 + - _BUILTIN_ZTest: 4 + - _BUILTIN_ZWrite: 1 + - _BUILTIN_ZWriteControl: 0 + - _Blend: 0 + - _CastShadows: 1 + - _Cull: 2 + - _DstBlend: 0 + - _QueueControl: 1 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _SrcBlend: 1 + - _Surface: 0 + - _WorkflowMode: 1 + - _ZTest: 4 + - _ZWrite: 1 + - _ZWriteControl: 0 + - alphaCutoff: 0.6 + - baseColorTexture_texCoord: 0 + - emissiveExposureWeight: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 0 + - transmissionFactor: 0 + m_Colors: + - baseColorFactor: {r: 0.9, g: 0.8, b: 0.7, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] +--- !u!114 &1818509006005091842 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 5 diff --git a/Tests/Resources/Export/Materials/URP/BaseColorTextureCutout.mat.meta b/Tests/Resources/Export/Materials/URP/BaseColorTextureCutout.mat.meta new file mode 100644 index 00000000..9f9600f2 --- /dev/null +++ b/Tests/Resources/Export/Materials/URP/BaseColorTextureCutout.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 19e1f5c269ca5451fbdf4d44a6df151e +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/URP/BaseColorTextureRotated.mat b/Tests/Resources/Export/Materials/URP/BaseColorTextureRotated.mat new file mode 100644 index 00000000..1933f4c6 --- /dev/null +++ b/Tests/Resources/Export/Materials/URP/BaseColorTextureRotated.mat @@ -0,0 +1,198 @@ +%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: BaseColorTextureRotated + m_Shader: {fileID: -6465566751694194690, guid: b9d29dfa1474148e792ac720cbd45122, type: 3} + m_ShaderKeywords: _ALPHATEST_ON _DISABLE_SSR_TRANSPARENT _TEXTURE_TRANSFORM + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2475 + stringTagMap: + MotionVector: User + RenderType: TransparentCutout + disabledShaderPasses: + - MOTIONVECTORS + - TransparentDepthPrepass + - TransparentDepthPostpass + - TransparentBackface + - RayTracingPrepass + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 2800000, guid: 767b013dd53264d2a858edf8651b320d, type: 3} + m_Scale: {x: 0.70710677, y: 0.70710677} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - transmissionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaCutoffEnable: 1 + - _AlphaDstBlend: 0 + - _AlphaSrcBlend: 1 + - _AlphaToMask: 0 + - _AlphaToMaskInspectorValue: 0 + - _BUILTIN_AlphaClip: 0 + - _BUILTIN_Blend: 0 + - _BUILTIN_CullMode: 2 + - _BUILTIN_DstBlend: 0 + - _BUILTIN_QueueControl: -1 + - _BUILTIN_QueueOffset: 0 + - _BUILTIN_SrcBlend: 1 + - _BUILTIN_Surface: 0 + - _BUILTIN_ZTest: 4 + - _BUILTIN_ZWrite: 1 + - _BUILTIN_ZWriteControl: 0 + - _Blend: 0 + - _BlendMode: 0 + - _BlendModePreserveSpecular: 0 + - _CastShadows: 1 + - _Cull: 2 + - _CullMode: 2 + - _CullModeForward: 2 + - _DepthOffsetEnable: 0 + - _DoubleSidedEnable: 0 + - _DoubleSidedNormalMode: 2 + - _DstBlend: 0 + - _EnableBlendModePreserveSpecularLighting: 1 + - _EnableFogOnTransparent: 1 + - _Mode: 0 + - _OpaqueCullMode: 2 + - _QueueControl: 0 + - _QueueOffset: 0 + - _RayTracing: 0 + - _ReceiveShadows: 1 + - _ReceivesSSR: 1 + - _ReceivesSSRTransparent: 0 + - _RefractionModel: 0 + - _RenderQueueType: 1 + - _RequireSplitLighting: 0 + - _SrcBlend: 1 + - _StencilRef: 0 + - _StencilRefDepth: 8 + - _StencilRefDistortionVec: 4 + - _StencilRefGBuffer: 10 + - _StencilRefMV: 40 + - _StencilWriteMask: 6 + - _StencilWriteMaskDepth: 8 + - _StencilWriteMaskDistortionVec: 4 + - _StencilWriteMaskGBuffer: 14 + - _StencilWriteMaskMV: 40 + - _SupportDecals: 1 + - _Surface: 0 + - _SurfaceType: 0 + - _TransparentBackfaceEnable: 0 + - _TransparentCullMode: 2 + - _TransparentDepthPostpassEnable: 0 + - _TransparentDepthPrepassEnable: 0 + - _TransparentSortPriority: 0 + - _TransparentWritingMotionVec: 0 + - _TransparentZWrite: 0 + - _UseShadowThreshold: 0 + - _WorkflowMode: 1 + - _ZTest: 4 + - _ZTestDepthEqualForOpaque: 3 + - _ZTestGBuffer: 3 + - _ZTestTransparent: 4 + - _ZWrite: 1 + - _ZWriteControl: 0 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveExposureWeight: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 0.5 + - transmissionFactor: 0 + m_Colors: + - _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0} + - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} + - baseColorFactor: {r: 0.9, g: 0.8, b: 0.7, a: 1} + - baseColorTexture_Rotation: {r: 0.70710677, g: -0.70710677, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] +--- !u!114 &4496889970596464588 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 11 +--- !u!114 &5005384916937477244 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 +--- !u!114 &8468717510162963845 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 0 diff --git a/Tests/Resources/Export/Materials/URP/BaseColorTextureRotated.mat.meta b/Tests/Resources/Export/Materials/URP/BaseColorTextureRotated.mat.meta new file mode 100644 index 00000000..01abe2af --- /dev/null +++ b/Tests/Resources/Export/Materials/URP/BaseColorTextureRotated.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 151a90d42fdb548ee8ca99cf365dc601 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/URP/BaseColorTextureScaled.mat b/Tests/Resources/Export/Materials/URP/BaseColorTextureScaled.mat new file mode 100644 index 00000000..90b063c3 --- /dev/null +++ b/Tests/Resources/Export/Materials/URP/BaseColorTextureScaled.mat @@ -0,0 +1,198 @@ +%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: BaseColorTextureScaled + m_Shader: {fileID: -6465566751694194690, guid: b9d29dfa1474148e792ac720cbd45122, type: 3} + m_ShaderKeywords: _ALPHATEST_ON _DISABLE_SSR_TRANSPARENT _TEXTURE_TRANSFORM + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2475 + stringTagMap: + MotionVector: User + RenderType: TransparentCutout + disabledShaderPasses: + - MOTIONVECTORS + - TransparentDepthPrepass + - TransparentDepthPostpass + - TransparentBackface + - RayTracingPrepass + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 2800000, guid: 767b013dd53264d2a858edf8651b320d, type: 3} + m_Scale: {x: 1.2, y: 1.3} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - transmissionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaCutoffEnable: 1 + - _AlphaDstBlend: 0 + - _AlphaSrcBlend: 1 + - _AlphaToMask: 0 + - _AlphaToMaskInspectorValue: 0 + - _BUILTIN_AlphaClip: 0 + - _BUILTIN_Blend: 0 + - _BUILTIN_CullMode: 2 + - _BUILTIN_DstBlend: 0 + - _BUILTIN_QueueControl: -1 + - _BUILTIN_QueueOffset: 0 + - _BUILTIN_SrcBlend: 1 + - _BUILTIN_Surface: 0 + - _BUILTIN_ZTest: 4 + - _BUILTIN_ZWrite: 1 + - _BUILTIN_ZWriteControl: 0 + - _Blend: 0 + - _BlendMode: 0 + - _BlendModePreserveSpecular: 0 + - _CastShadows: 1 + - _Cull: 2 + - _CullMode: 2 + - _CullModeForward: 2 + - _DepthOffsetEnable: 0 + - _DoubleSidedEnable: 0 + - _DoubleSidedNormalMode: 2 + - _DstBlend: 0 + - _EnableBlendModePreserveSpecularLighting: 1 + - _EnableFogOnTransparent: 1 + - _Mode: 0 + - _OpaqueCullMode: 2 + - _QueueControl: 0 + - _QueueOffset: 0 + - _RayTracing: 0 + - _ReceiveShadows: 1 + - _ReceivesSSR: 1 + - _ReceivesSSRTransparent: 0 + - _RefractionModel: 0 + - _RenderQueueType: 1 + - _RequireSplitLighting: 0 + - _SrcBlend: 1 + - _StencilRef: 0 + - _StencilRefDepth: 8 + - _StencilRefDistortionVec: 4 + - _StencilRefGBuffer: 10 + - _StencilRefMV: 40 + - _StencilWriteMask: 6 + - _StencilWriteMaskDepth: 8 + - _StencilWriteMaskDistortionVec: 4 + - _StencilWriteMaskGBuffer: 14 + - _StencilWriteMaskMV: 40 + - _SupportDecals: 1 + - _Surface: 0 + - _SurfaceType: 0 + - _TransparentBackfaceEnable: 0 + - _TransparentCullMode: 2 + - _TransparentDepthPostpassEnable: 0 + - _TransparentDepthPrepassEnable: 0 + - _TransparentSortPriority: 0 + - _TransparentWritingMotionVec: 0 + - _TransparentZWrite: 0 + - _UseShadowThreshold: 0 + - _WorkflowMode: 1 + - _ZTest: 4 + - _ZTestDepthEqualForOpaque: 3 + - _ZTestGBuffer: 3 + - _ZTestTransparent: 4 + - _ZWrite: 1 + - _ZWriteControl: 0 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveExposureWeight: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 0.5 + - transmissionFactor: 0 + m_Colors: + - _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0} + - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} + - baseColorFactor: {r: 0.9, g: 0.8, b: 0.7, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] +--- !u!114 &327049786189296091 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 0 +--- !u!114 &5338241427485034969 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 11 +--- !u!114 &7754129217665426590 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 diff --git a/Tests/Resources/Export/Materials/URP/BaseColorTextureScaled.mat.meta b/Tests/Resources/Export/Materials/URP/BaseColorTextureScaled.mat.meta new file mode 100644 index 00000000..61bbfa58 --- /dev/null +++ b/Tests/Resources/Export/Materials/URP/BaseColorTextureScaled.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 99a2e11ea850a44dfa29737d5732fa73 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/URP/BaseColorTextureTranslated.mat b/Tests/Resources/Export/Materials/URP/BaseColorTextureTranslated.mat new file mode 100644 index 00000000..74d22503 --- /dev/null +++ b/Tests/Resources/Export/Materials/URP/BaseColorTextureTranslated.mat @@ -0,0 +1,198 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-6755628218167242280 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 +--- !u!114 &-6631252386267038805 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 11 +--- !u!114 &-3521330490493970405 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 0 +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: BaseColorTextureTranslated + m_Shader: {fileID: -6465566751694194690, guid: b9d29dfa1474148e792ac720cbd45122, type: 3} + m_ShaderKeywords: _ALPHATEST_ON _DISABLE_SSR_TRANSPARENT _TEXTURE_TRANSFORM + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2475 + stringTagMap: + MotionVector: User + RenderType: TransparentCutout + disabledShaderPasses: + - MOTIONVECTORS + - TransparentDepthPrepass + - TransparentDepthPostpass + - TransparentBackface + - RayTracingPrepass + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 2800000, guid: 767b013dd53264d2a858edf8651b320d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0.4, y: 0.6} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - transmissionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaCutoffEnable: 1 + - _AlphaDstBlend: 0 + - _AlphaSrcBlend: 1 + - _AlphaToMask: 0 + - _AlphaToMaskInspectorValue: 0 + - _BUILTIN_AlphaClip: 0 + - _BUILTIN_Blend: 0 + - _BUILTIN_CullMode: 2 + - _BUILTIN_DstBlend: 0 + - _BUILTIN_QueueControl: -1 + - _BUILTIN_QueueOffset: 0 + - _BUILTIN_SrcBlend: 1 + - _BUILTIN_Surface: 0 + - _BUILTIN_ZTest: 4 + - _BUILTIN_ZWrite: 1 + - _BUILTIN_ZWriteControl: 0 + - _Blend: 0 + - _BlendMode: 0 + - _BlendModePreserveSpecular: 0 + - _CastShadows: 1 + - _Cull: 2 + - _CullMode: 2 + - _CullModeForward: 2 + - _DepthOffsetEnable: 0 + - _DoubleSidedEnable: 0 + - _DoubleSidedNormalMode: 2 + - _DstBlend: 0 + - _EnableBlendModePreserveSpecularLighting: 1 + - _EnableFogOnTransparent: 1 + - _Mode: 0 + - _OpaqueCullMode: 2 + - _QueueControl: 0 + - _QueueOffset: 0 + - _RayTracing: 0 + - _ReceiveShadows: 1 + - _ReceivesSSR: 1 + - _ReceivesSSRTransparent: 0 + - _RefractionModel: 0 + - _RenderQueueType: 1 + - _RequireSplitLighting: 0 + - _SrcBlend: 1 + - _StencilRef: 0 + - _StencilRefDepth: 8 + - _StencilRefDistortionVec: 4 + - _StencilRefGBuffer: 10 + - _StencilRefMV: 40 + - _StencilWriteMask: 6 + - _StencilWriteMaskDepth: 8 + - _StencilWriteMaskDistortionVec: 4 + - _StencilWriteMaskGBuffer: 14 + - _StencilWriteMaskMV: 40 + - _SupportDecals: 1 + - _Surface: 0 + - _SurfaceType: 0 + - _TransparentBackfaceEnable: 0 + - _TransparentCullMode: 2 + - _TransparentDepthPostpassEnable: 0 + - _TransparentDepthPrepassEnable: 0 + - _TransparentSortPriority: 0 + - _TransparentWritingMotionVec: 0 + - _TransparentZWrite: 0 + - _UseShadowThreshold: 0 + - _WorkflowMode: 1 + - _ZTest: 4 + - _ZTestDepthEqualForOpaque: 3 + - _ZTestGBuffer: 3 + - _ZTestTransparent: 4 + - _ZWrite: 1 + - _ZWriteControl: 0 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveExposureWeight: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 0.5 + - transmissionFactor: 0 + m_Colors: + - _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0} + - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} + - baseColorFactor: {r: 0.9, g: 0.8, b: 0.7, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] diff --git a/Tests/Resources/Export/Materials/URP/BaseColorTextureTranslated.mat.meta b/Tests/Resources/Export/Materials/URP/BaseColorTextureTranslated.mat.meta new file mode 100644 index 00000000..e45f75e6 --- /dev/null +++ b/Tests/Resources/Export/Materials/URP/BaseColorTextureTranslated.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8937cffcf23754d418132d42c798271d +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/URP/BaseColorTextureTransparent.mat b/Tests/Resources/Export/Materials/URP/BaseColorTextureTransparent.mat new file mode 100644 index 00000000..9b48ab79 --- /dev/null +++ b/Tests/Resources/Export/Materials/URP/BaseColorTextureTransparent.mat @@ -0,0 +1,144 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: BaseColorTextureTransparent + m_Shader: {fileID: -6465566751694194690, guid: b9d29dfa1474148e792ac720cbd45122, + type: 3} + m_ValidKeywords: + - _SURFACE_TYPE_TRANSPARENT + m_InvalidKeywords: + - _DISABLE_SSR_TRANSPARENT + - _ENABLE_FOG_ON_TRANSPARENT + m_LightmapFlags: 2 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 1 + m_CustomRenderQueue: 3000 + stringTagMap: + MotionVector: User + RenderType: Transparent + disabledShaderPasses: + - MOTIONVECTORS + - TransparentDepthPrepass + - TransparentDepthPostpass + - TransparentBackface + - RayTracingPrepass + - DepthOnly + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 2800000, guid: 1e22bd6b46ceb4d0c99cfdb552ec8586, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - transmissionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AlphaClip: 0 + - _BUILTIN_AlphaClip: 0 + - _BUILTIN_Blend: 0 + - _BUILTIN_CullMode: 2 + - _BUILTIN_DstBlend: 0 + - _BUILTIN_QueueControl: 1 + - _BUILTIN_QueueOffset: 0 + - _BUILTIN_SrcBlend: 1 + - _BUILTIN_Surface: 0 + - _BUILTIN_ZTest: 4 + - _BUILTIN_ZWrite: 1 + - _BUILTIN_ZWriteControl: 0 + - _Blend: 0 + - _CastShadows: 1 + - _Cull: 2 + - _DstBlend: 10 + - _QueueControl: 1 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _SrcBlend: 5 + - _Surface: 1 + - _WorkflowMode: 1 + - _ZTest: 4 + - _ZWrite: 0 + - _ZWriteControl: 0 + - alphaCutoff: 0 + - baseColorTexture_texCoord: 0 + - emissiveExposureWeight: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 0 + - transmissionFactor: 0 + m_Colors: + - baseColorFactor: {r: 0.9, g: 0.8, b: 0.7, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] +--- !u!114 &902737734322235975 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 0 +--- !u!114 &7852760948264433013 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 5 diff --git a/Tests/Resources/Export/Materials/URP/BaseColorTextureTransparent.mat.meta b/Tests/Resources/Export/Materials/URP/BaseColorTextureTransparent.mat.meta new file mode 100644 index 00000000..d506110c --- /dev/null +++ b/Tests/Resources/Export/Materials/URP/BaseColorTextureTransparent.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a516aedc3074849e4b6684c554415737 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/URP/DoubleSided.mat b/Tests/Resources/Export/Materials/URP/DoubleSided.mat new file mode 100644 index 00000000..87445ed3 --- /dev/null +++ b/Tests/Resources/Export/Materials/URP/DoubleSided.mat @@ -0,0 +1,136 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-4405249971679355670 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 0 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: DoubleSided + m_Shader: {fileID: -6465566751694194690, guid: b9d29dfa1474148e792ac720cbd45122, + type: 3} + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 2 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 1 + m_CustomRenderQueue: 2000 + stringTagMap: + MotionVector: User + RenderType: Opaque + disabledShaderPasses: + - MOTIONVECTORS + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - transmissionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AlphaClip: 0 + - _BUILTIN_AlphaClip: 0 + - _BUILTIN_Blend: 0 + - _BUILTIN_CullMode: 2 + - _BUILTIN_DstBlend: 0 + - _BUILTIN_QueueControl: 1 + - _BUILTIN_QueueOffset: 0 + - _BUILTIN_SrcBlend: 1 + - _BUILTIN_Surface: 0 + - _BUILTIN_ZTest: 4 + - _BUILTIN_ZWrite: 1 + - _BUILTIN_ZWriteControl: 0 + - _Blend: 0 + - _CastShadows: 1 + - _Cull: 0 + - _DstBlend: 0 + - _QueueControl: 1 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _SrcBlend: 1 + - _Surface: 0 + - _WorkflowMode: 1 + - _ZTest: 4 + - _ZWrite: 1 + - _ZWriteControl: 0 + - alphaCutoff: 0 + - baseColorTexture_texCoord: 0 + - emissiveExposureWeight: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 0.7 + - transmissionFactor: 0 + m_Colors: + - baseColorFactor: {r: 0, g: 0.32675865, b: 1, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] +--- !u!114 &8639226854172091483 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 5 diff --git a/Tests/Resources/Export/Materials/URP/DoubleSided.mat.meta b/Tests/Resources/Export/Materials/URP/DoubleSided.mat.meta new file mode 100644 index 00000000..9c7b6915 --- /dev/null +++ b/Tests/Resources/Export/Materials/URP/DoubleSided.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3ef67473cb66b4011a44c824e027c059 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/URP/EmissiveFactor.mat b/Tests/Resources/Export/Materials/URP/EmissiveFactor.mat new file mode 100644 index 00000000..5f798fd7 --- /dev/null +++ b/Tests/Resources/Export/Materials/URP/EmissiveFactor.mat @@ -0,0 +1,198 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-1551366186088804395 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: EmissiveFactor + m_Shader: {fileID: -6465566751694194690, guid: b9d29dfa1474148e792ac720cbd45122, type: 3} + m_ShaderKeywords: _ALPHATEST_ON _DISABLE_SSR_TRANSPARENT _EMISSIVE + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2475 + stringTagMap: + MotionVector: User + RenderType: TransparentCutout + disabledShaderPasses: + - MOTIONVECTORS + - TransparentDepthPrepass + - TransparentDepthPostpass + - TransparentBackface + - RayTracingPrepass + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - transmissionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaCutoffEnable: 1 + - _AlphaDstBlend: 0 + - _AlphaSrcBlend: 1 + - _AlphaToMask: 0 + - _AlphaToMaskInspectorValue: 0 + - _BUILTIN_AlphaClip: 0 + - _BUILTIN_Blend: 0 + - _BUILTIN_CullMode: 2 + - _BUILTIN_DstBlend: 0 + - _BUILTIN_QueueControl: -1 + - _BUILTIN_QueueOffset: 0 + - _BUILTIN_SrcBlend: 1 + - _BUILTIN_Surface: 0 + - _BUILTIN_ZTest: 4 + - _BUILTIN_ZWrite: 1 + - _BUILTIN_ZWriteControl: 0 + - _Blend: 0 + - _BlendMode: 0 + - _BlendModePreserveSpecular: 0 + - _CastShadows: 1 + - _Cull: 2 + - _CullMode: 2 + - _CullModeForward: 2 + - _DepthOffsetEnable: 0 + - _DoubleSidedEnable: 0 + - _DoubleSidedNormalMode: 2 + - _DstBlend: 0 + - _EnableBlendModePreserveSpecularLighting: 1 + - _EnableFogOnTransparent: 1 + - _Mode: 0 + - _OpaqueCullMode: 2 + - _QueueControl: 0 + - _QueueOffset: 0 + - _RayTracing: 0 + - _ReceiveShadows: 1 + - _ReceivesSSR: 1 + - _ReceivesSSRTransparent: 0 + - _RefractionModel: 0 + - _RenderQueueType: 1 + - _RequireSplitLighting: 0 + - _SrcBlend: 1 + - _StencilRef: 0 + - _StencilRefDepth: 8 + - _StencilRefDistortionVec: 4 + - _StencilRefGBuffer: 10 + - _StencilRefMV: 40 + - _StencilWriteMask: 6 + - _StencilWriteMaskDepth: 8 + - _StencilWriteMaskDistortionVec: 4 + - _StencilWriteMaskGBuffer: 14 + - _StencilWriteMaskMV: 40 + - _SupportDecals: 1 + - _Surface: 0 + - _SurfaceType: 0 + - _TransparentBackfaceEnable: 0 + - _TransparentCullMode: 2 + - _TransparentDepthPostpassEnable: 0 + - _TransparentDepthPrepassEnable: 0 + - _TransparentSortPriority: 0 + - _TransparentWritingMotionVec: 0 + - _TransparentZWrite: 0 + - _UseShadowThreshold: 0 + - _WorkflowMode: 1 + - _ZTest: 4 + - _ZTestDepthEqualForOpaque: 3 + - _ZTestGBuffer: 3 + - _ZTestTransparent: 4 + - _ZWrite: 1 + - _ZWriteControl: 0 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveExposureWeight: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 1 + - transmissionFactor: 0 + m_Colors: + - _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0} + - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} + - baseColorFactor: {r: 0, g: 0, b: 0, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 1, g: 1, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] +--- !u!114 &752764914036390117 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 0 +--- !u!114 &4882466098009885765 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 11 diff --git a/Tests/Resources/Export/Materials/URP/EmissiveFactor.mat.meta b/Tests/Resources/Export/Materials/URP/EmissiveFactor.mat.meta new file mode 100644 index 00000000..3cd292d5 --- /dev/null +++ b/Tests/Resources/Export/Materials/URP/EmissiveFactor.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a2b265ca626394b87ae0aef9b4cb7912 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/URP/EmissiveTexture.mat b/Tests/Resources/Export/Materials/URP/EmissiveTexture.mat new file mode 100644 index 00000000..40aa15ef --- /dev/null +++ b/Tests/Resources/Export/Materials/URP/EmissiveTexture.mat @@ -0,0 +1,198 @@ +%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: EmissiveTexture + m_Shader: {fileID: -6465566751694194690, guid: b9d29dfa1474148e792ac720cbd45122, type: 3} + m_ShaderKeywords: _ALPHATEST_ON _DISABLE_SSR_TRANSPARENT _EMISSIVE + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2475 + stringTagMap: + MotionVector: User + RenderType: TransparentCutout + disabledShaderPasses: + - MOTIONVECTORS + - TransparentDepthPrepass + - TransparentDepthPostpass + - TransparentBackface + - RayTracingPrepass + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 2800000, guid: f53f6abdff34c42bf8b9a9487f5fba4d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - transmissionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaCutoffEnable: 1 + - _AlphaDstBlend: 0 + - _AlphaSrcBlend: 1 + - _AlphaToMask: 0 + - _AlphaToMaskInspectorValue: 0 + - _BUILTIN_AlphaClip: 0 + - _BUILTIN_Blend: 0 + - _BUILTIN_CullMode: 2 + - _BUILTIN_DstBlend: 0 + - _BUILTIN_QueueControl: -1 + - _BUILTIN_QueueOffset: 0 + - _BUILTIN_SrcBlend: 1 + - _BUILTIN_Surface: 0 + - _BUILTIN_ZTest: 4 + - _BUILTIN_ZWrite: 1 + - _BUILTIN_ZWriteControl: 0 + - _Blend: 0 + - _BlendMode: 0 + - _BlendModePreserveSpecular: 0 + - _CastShadows: 1 + - _Cull: 2 + - _CullMode: 2 + - _CullModeForward: 2 + - _DepthOffsetEnable: 0 + - _DoubleSidedEnable: 0 + - _DoubleSidedNormalMode: 2 + - _DstBlend: 0 + - _EnableBlendModePreserveSpecularLighting: 1 + - _EnableFogOnTransparent: 1 + - _Mode: 0 + - _OpaqueCullMode: 2 + - _QueueControl: 0 + - _QueueOffset: 0 + - _RayTracing: 0 + - _ReceiveShadows: 1 + - _ReceivesSSR: 1 + - _ReceivesSSRTransparent: 0 + - _RefractionModel: 0 + - _RenderQueueType: 1 + - _RequireSplitLighting: 0 + - _SrcBlend: 1 + - _StencilRef: 0 + - _StencilRefDepth: 8 + - _StencilRefDistortionVec: 4 + - _StencilRefGBuffer: 10 + - _StencilRefMV: 40 + - _StencilWriteMask: 6 + - _StencilWriteMaskDepth: 8 + - _StencilWriteMaskDistortionVec: 4 + - _StencilWriteMaskGBuffer: 14 + - _StencilWriteMaskMV: 40 + - _SupportDecals: 1 + - _Surface: 0 + - _SurfaceType: 0 + - _TransparentBackfaceEnable: 0 + - _TransparentCullMode: 2 + - _TransparentDepthPostpassEnable: 0 + - _TransparentDepthPrepassEnable: 0 + - _TransparentSortPriority: 0 + - _TransparentWritingMotionVec: 0 + - _TransparentZWrite: 0 + - _UseShadowThreshold: 0 + - _WorkflowMode: 1 + - _ZTest: 4 + - _ZTestDepthEqualForOpaque: 3 + - _ZTestGBuffer: 3 + - _ZTestTransparent: 4 + - _ZWrite: 1 + - _ZWriteControl: 0 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveExposureWeight: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 1 + - transmissionFactor: 0 + m_Colors: + - _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0} + - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} + - baseColorFactor: {r: 0, g: 0, b: 0, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 1, g: 1, b: 1, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] +--- !u!114 &2579796636048872692 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 11 +--- !u!114 &3024038785185664378 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 0 +--- !u!114 &6458052233830712772 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 diff --git a/Tests/Resources/Export/Materials/URP/EmissiveTexture.mat.meta b/Tests/Resources/Export/Materials/URP/EmissiveTexture.mat.meta new file mode 100644 index 00000000..bfd9b19d --- /dev/null +++ b/Tests/Resources/Export/Materials/URP/EmissiveTexture.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ee4808d20346b476292d072262dbf035 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/URP/EmissiveTextureFactor.mat b/Tests/Resources/Export/Materials/URP/EmissiveTextureFactor.mat new file mode 100644 index 00000000..75eca1b7 --- /dev/null +++ b/Tests/Resources/Export/Materials/URP/EmissiveTextureFactor.mat @@ -0,0 +1,198 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-8930221280936305980 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 0 +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: EmissiveTextureFactor + m_Shader: {fileID: -6465566751694194690, guid: b9d29dfa1474148e792ac720cbd45122, type: 3} + m_ShaderKeywords: _ALPHATEST_ON _DISABLE_SSR_TRANSPARENT _EMISSIVE _TEXTURE_TRANSFORM + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2475 + stringTagMap: + MotionVector: User + RenderType: TransparentCutout + disabledShaderPasses: + - MOTIONVECTORS + - TransparentDepthPrepass + - TransparentDepthPostpass + - TransparentBackface + - RayTracingPrepass + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 2800000, guid: f53f6abdff34c42bf8b9a9487f5fba4d, type: 3} + m_Scale: {x: 2, y: 3} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - transmissionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaCutoffEnable: 1 + - _AlphaDstBlend: 0 + - _AlphaSrcBlend: 1 + - _AlphaToMask: 0 + - _AlphaToMaskInspectorValue: 0 + - _BUILTIN_AlphaClip: 0 + - _BUILTIN_Blend: 0 + - _BUILTIN_CullMode: 2 + - _BUILTIN_DstBlend: 0 + - _BUILTIN_QueueControl: -1 + - _BUILTIN_QueueOffset: 0 + - _BUILTIN_SrcBlend: 1 + - _BUILTIN_Surface: 0 + - _BUILTIN_ZTest: 4 + - _BUILTIN_ZWrite: 1 + - _BUILTIN_ZWriteControl: 0 + - _Blend: 0 + - _BlendMode: 0 + - _BlendModePreserveSpecular: 0 + - _CastShadows: 1 + - _Cull: 2 + - _CullMode: 2 + - _CullModeForward: 2 + - _DepthOffsetEnable: 0 + - _DoubleSidedEnable: 0 + - _DoubleSidedNormalMode: 2 + - _DstBlend: 0 + - _EnableBlendModePreserveSpecularLighting: 1 + - _EnableFogOnTransparent: 1 + - _Mode: 0 + - _OpaqueCullMode: 2 + - _QueueControl: 0 + - _QueueOffset: 0 + - _RayTracing: 0 + - _ReceiveShadows: 1 + - _ReceivesSSR: 1 + - _ReceivesSSRTransparent: 0 + - _RefractionModel: 0 + - _RenderQueueType: 1 + - _RequireSplitLighting: 0 + - _SrcBlend: 1 + - _StencilRef: 0 + - _StencilRefDepth: 8 + - _StencilRefDistortionVec: 4 + - _StencilRefGBuffer: 10 + - _StencilRefMV: 40 + - _StencilWriteMask: 6 + - _StencilWriteMaskDepth: 8 + - _StencilWriteMaskDistortionVec: 4 + - _StencilWriteMaskGBuffer: 14 + - _StencilWriteMaskMV: 40 + - _SupportDecals: 1 + - _Surface: 0 + - _SurfaceType: 0 + - _TransparentBackfaceEnable: 0 + - _TransparentCullMode: 2 + - _TransparentDepthPostpassEnable: 0 + - _TransparentDepthPrepassEnable: 0 + - _TransparentSortPriority: 0 + - _TransparentWritingMotionVec: 0 + - _TransparentZWrite: 0 + - _UseShadowThreshold: 0 + - _WorkflowMode: 1 + - _ZTest: 4 + - _ZTestDepthEqualForOpaque: 3 + - _ZTestGBuffer: 3 + - _ZTestTransparent: 4 + - _ZWrite: 1 + - _ZWriteControl: 0 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveExposureWeight: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 1 + - transmissionFactor: 0 + m_Colors: + - _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0} + - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} + - baseColorFactor: {r: 0, g: 0, b: 0, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 1, g: 0.7353569, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] +--- !u!114 &2581781820884484437 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 +--- !u!114 &6741184414440526089 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 11 diff --git a/Tests/Resources/Export/Materials/URP/EmissiveTextureFactor.mat.meta b/Tests/Resources/Export/Materials/URP/EmissiveTextureFactor.mat.meta new file mode 100644 index 00000000..c7272616 --- /dev/null +++ b/Tests/Resources/Export/Materials/URP/EmissiveTextureFactor.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fa253ed646ac54efb828e3cfe79932e7 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/URP/Metallic.mat b/Tests/Resources/Export/Materials/URP/Metallic.mat new file mode 100644 index 00000000..1cf2e844 --- /dev/null +++ b/Tests/Resources/Export/Materials/URP/Metallic.mat @@ -0,0 +1,197 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-3607148911885502513 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 11 +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Metallic + m_Shader: {fileID: -6465566751694194690, guid: b9d29dfa1474148e792ac720cbd45122, type: 3} + m_ShaderKeywords: _ALPHATEST_ON _DISABLE_SSR_TRANSPARENT + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2475 + stringTagMap: + RenderType: TransparentCutout + disabledShaderPasses: + - MOTIONVECTORS + - TransparentDepthPrepass + - TransparentDepthPostpass + - TransparentBackface + - RayTracingPrepass + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - transmissionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaCutoffEnable: 1 + - _AlphaDstBlend: 0 + - _AlphaSrcBlend: 1 + - _AlphaToMask: 0 + - _AlphaToMaskInspectorValue: 0 + - _BUILTIN_AlphaClip: 0 + - _BUILTIN_Blend: 0 + - _BUILTIN_CullMode: 2 + - _BUILTIN_DstBlend: 0 + - _BUILTIN_QueueControl: -1 + - _BUILTIN_QueueOffset: 0 + - _BUILTIN_SrcBlend: 1 + - _BUILTIN_Surface: 0 + - _BUILTIN_ZTest: 4 + - _BUILTIN_ZWrite: 1 + - _BUILTIN_ZWriteControl: 0 + - _Blend: 0 + - _BlendMode: 0 + - _BlendModePreserveSpecular: 0 + - _CastShadows: 1 + - _Cull: 2 + - _CullMode: 2 + - _CullModeForward: 2 + - _DepthOffsetEnable: 0 + - _DoubleSidedEnable: 0 + - _DoubleSidedNormalMode: 2 + - _DstBlend: 0 + - _EnableBlendModePreserveSpecularLighting: 1 + - _EnableFogOnTransparent: 1 + - _Mode: 0 + - _OpaqueCullMode: 2 + - _QueueControl: 0 + - _QueueOffset: 0 + - _RayTracing: 0 + - _ReceiveShadows: 1 + - _ReceivesSSR: 1 + - _ReceivesSSRTransparent: 0 + - _RefractionModel: 0 + - _RenderQueueType: 1 + - _RequireSplitLighting: 0 + - _SrcBlend: 1 + - _StencilRef: 0 + - _StencilRefDepth: 8 + - _StencilRefDistortionVec: 4 + - _StencilRefGBuffer: 10 + - _StencilRefMV: 40 + - _StencilWriteMask: 6 + - _StencilWriteMaskDepth: 8 + - _StencilWriteMaskDistortionVec: 4 + - _StencilWriteMaskGBuffer: 14 + - _StencilWriteMaskMV: 40 + - _SupportDecals: 1 + - _Surface: 0 + - _SurfaceType: 0 + - _TransparentBackfaceEnable: 0 + - _TransparentCullMode: 2 + - _TransparentDepthPostpassEnable: 0 + - _TransparentDepthPrepassEnable: 0 + - _TransparentSortPriority: 0 + - _TransparentWritingMotionVec: 0 + - _TransparentZWrite: 0 + - _UseShadowThreshold: 0 + - _WorkflowMode: 1 + - _ZTest: 4 + - _ZTestDepthEqualForOpaque: 3 + - _ZTestGBuffer: 3 + - _ZTestTransparent: 4 + - _ZWrite: 1 + - _ZWriteControl: 0 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveExposureWeight: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0.89 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 0 + - transmissionFactor: 0 + m_Colors: + - _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0} + - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} + - baseColorFactor: {r: 1, g: 1, b: 1, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] +--- !u!114 &1203086932070529331 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 0 +--- !u!114 &7677109854519655275 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 diff --git a/Tests/Resources/Export/Materials/URP/Metallic.mat.meta b/Tests/Resources/Export/Materials/URP/Metallic.mat.meta new file mode 100644 index 00000000..f77c2050 --- /dev/null +++ b/Tests/Resources/Export/Materials/URP/Metallic.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 718bad838acdc48978498f745ddddec9 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/URP/MetallicRoughnessOcclusionTexture.mat b/Tests/Resources/Export/Materials/URP/MetallicRoughnessOcclusionTexture.mat new file mode 100644 index 00000000..27bdb587 --- /dev/null +++ b/Tests/Resources/Export/Materials/URP/MetallicRoughnessOcclusionTexture.mat @@ -0,0 +1,197 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-7393323642559032507 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 0 +--- !u!114 &-4181352363440409036 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 11 +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: MetallicRoughnessOcclusionTexture + m_Shader: {fileID: -6465566751694194690, guid: b9d29dfa1474148e792ac720cbd45122, type: 3} + m_ShaderKeywords: _ALPHATEST_ON _DISABLE_SSR_TRANSPARENT + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2475 + stringTagMap: + RenderType: TransparentCutout + disabledShaderPasses: + - MOTIONVECTORS + - TransparentDepthPrepass + - TransparentDepthPostpass + - TransparentBackface + - RayTracingPrepass + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 2800000, guid: e6a8dbc8ea6f7452db96210e86372550, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 2800000, guid: e6a8dbc8ea6f7452db96210e86372550, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - transmissionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaCutoffEnable: 1 + - _AlphaDstBlend: 0 + - _AlphaSrcBlend: 1 + - _AlphaToMask: 0 + - _AlphaToMaskInspectorValue: 0 + - _BUILTIN_AlphaClip: 0 + - _BUILTIN_Blend: 0 + - _BUILTIN_CullMode: 2 + - _BUILTIN_DstBlend: 0 + - _BUILTIN_QueueControl: -1 + - _BUILTIN_QueueOffset: 0 + - _BUILTIN_SrcBlend: 1 + - _BUILTIN_Surface: 0 + - _BUILTIN_ZTest: 4 + - _BUILTIN_ZWrite: 1 + - _BUILTIN_ZWriteControl: 0 + - _Blend: 0 + - _BlendMode: 0 + - _BlendModePreserveSpecular: 0 + - _CastShadows: 1 + - _Cull: 2 + - _CullMode: 2 + - _CullModeForward: 2 + - _DepthOffsetEnable: 0 + - _DoubleSidedEnable: 0 + - _DoubleSidedNormalMode: 2 + - _DstBlend: 0 + - _EnableBlendModePreserveSpecularLighting: 1 + - _EnableFogOnTransparent: 1 + - _Mode: 0 + - _OpaqueCullMode: 2 + - _QueueControl: 0 + - _QueueOffset: 0 + - _RayTracing: 0 + - _ReceiveShadows: 1 + - _ReceivesSSR: 1 + - _ReceivesSSRTransparent: 0 + - _RefractionModel: 0 + - _RenderQueueType: 1 + - _RequireSplitLighting: 0 + - _SrcBlend: 1 + - _StencilRef: 0 + - _StencilRefDepth: 8 + - _StencilRefDistortionVec: 4 + - _StencilRefGBuffer: 10 + - _StencilRefMV: 40 + - _StencilWriteMask: 6 + - _StencilWriteMaskDepth: 8 + - _StencilWriteMaskDistortionVec: 4 + - _StencilWriteMaskGBuffer: 14 + - _StencilWriteMaskMV: 40 + - _SupportDecals: 1 + - _Surface: 0 + - _SurfaceType: 0 + - _TransparentBackfaceEnable: 0 + - _TransparentCullMode: 2 + - _TransparentDepthPostpassEnable: 0 + - _TransparentDepthPrepassEnable: 0 + - _TransparentSortPriority: 0 + - _TransparentWritingMotionVec: 0 + - _TransparentZWrite: 0 + - _UseShadowThreshold: 0 + - _WorkflowMode: 1 + - _ZTest: 4 + - _ZTestDepthEqualForOpaque: 3 + - _ZTestGBuffer: 3 + - _ZTestTransparent: 4 + - _ZWrite: 1 + - _ZWriteControl: 0 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveExposureWeight: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 1 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 0.8 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 1 + - transmissionFactor: 0 + m_Colors: + - _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0} + - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} + - baseColorFactor: {r: 0.30588236, g: 0.94509804, b: 1, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] +--- !u!114 &8822211145023048442 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 diff --git a/Tests/Resources/Export/Materials/URP/MetallicRoughnessOcclusionTexture.mat.meta b/Tests/Resources/Export/Materials/URP/MetallicRoughnessOcclusionTexture.mat.meta new file mode 100644 index 00000000..ce039db0 --- /dev/null +++ b/Tests/Resources/Export/Materials/URP/MetallicRoughnessOcclusionTexture.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 84cdba12dca5147ff90e88fb79a084e0 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/URP/MetallicRoughnessTexture.mat b/Tests/Resources/Export/Materials/URP/MetallicRoughnessTexture.mat new file mode 100644 index 00000000..22fd1639 --- /dev/null +++ b/Tests/Resources/Export/Materials/URP/MetallicRoughnessTexture.mat @@ -0,0 +1,197 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-5749603472449940425 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: MetallicRoughnessTexture + m_Shader: {fileID: -6465566751694194690, guid: b9d29dfa1474148e792ac720cbd45122, type: 3} + m_ShaderKeywords: _ALPHATEST_ON _DISABLE_SSR_TRANSPARENT + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2475 + stringTagMap: + RenderType: TransparentCutout + disabledShaderPasses: + - MOTIONVECTORS + - TransparentDepthPrepass + - TransparentDepthPostpass + - TransparentBackface + - RayTracingPrepass + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 2800000, guid: e6a8dbc8ea6f7452db96210e86372550, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - transmissionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaCutoffEnable: 1 + - _AlphaDstBlend: 0 + - _AlphaSrcBlend: 1 + - _AlphaToMask: 0 + - _AlphaToMaskInspectorValue: 0 + - _BUILTIN_AlphaClip: 0 + - _BUILTIN_Blend: 0 + - _BUILTIN_CullMode: 2 + - _BUILTIN_DstBlend: 0 + - _BUILTIN_QueueControl: -1 + - _BUILTIN_QueueOffset: 0 + - _BUILTIN_SrcBlend: 1 + - _BUILTIN_Surface: 0 + - _BUILTIN_ZTest: 4 + - _BUILTIN_ZWrite: 1 + - _BUILTIN_ZWriteControl: 0 + - _Blend: 0 + - _BlendMode: 0 + - _BlendModePreserveSpecular: 0 + - _CastShadows: 1 + - _Cull: 2 + - _CullMode: 2 + - _CullModeForward: 2 + - _DepthOffsetEnable: 0 + - _DoubleSidedEnable: 0 + - _DoubleSidedNormalMode: 2 + - _DstBlend: 0 + - _EnableBlendModePreserveSpecularLighting: 1 + - _EnableFogOnTransparent: 1 + - _Mode: 0 + - _OpaqueCullMode: 2 + - _QueueControl: 0 + - _QueueOffset: 0 + - _RayTracing: 0 + - _ReceiveShadows: 1 + - _ReceivesSSR: 1 + - _ReceivesSSRTransparent: 0 + - _RefractionModel: 0 + - _RenderQueueType: 1 + - _RequireSplitLighting: 0 + - _SrcBlend: 1 + - _StencilRef: 0 + - _StencilRefDepth: 8 + - _StencilRefDistortionVec: 4 + - _StencilRefGBuffer: 10 + - _StencilRefMV: 40 + - _StencilWriteMask: 6 + - _StencilWriteMaskDepth: 8 + - _StencilWriteMaskDistortionVec: 4 + - _StencilWriteMaskGBuffer: 14 + - _StencilWriteMaskMV: 40 + - _SupportDecals: 1 + - _Surface: 0 + - _SurfaceType: 0 + - _TransparentBackfaceEnable: 0 + - _TransparentCullMode: 2 + - _TransparentDepthPostpassEnable: 0 + - _TransparentDepthPrepassEnable: 0 + - _TransparentSortPriority: 0 + - _TransparentWritingMotionVec: 0 + - _TransparentZWrite: 0 + - _UseShadowThreshold: 0 + - _WorkflowMode: 1 + - _ZTest: 4 + - _ZTestDepthEqualForOpaque: 3 + - _ZTestGBuffer: 3 + - _ZTestTransparent: 4 + - _ZWrite: 1 + - _ZWriteControl: 0 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveExposureWeight: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 1 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 1 + - transmissionFactor: 0 + m_Colors: + - _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0} + - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} + - baseColorFactor: {r: 0.30588236, g: 1, b: 0.3882353, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] +--- !u!114 &5792399793874184331 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 0 +--- !u!114 &6252396589539094185 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 11 diff --git a/Tests/Resources/Export/Materials/URP/MetallicRoughnessTexture.mat.meta b/Tests/Resources/Export/Materials/URP/MetallicRoughnessTexture.mat.meta new file mode 100644 index 00000000..4bf743d0 --- /dev/null +++ b/Tests/Resources/Export/Materials/URP/MetallicRoughnessTexture.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b9e8742b2fe80447d9c88ad48254b74a +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/URP/MetallicTexture.mat b/Tests/Resources/Export/Materials/URP/MetallicTexture.mat new file mode 100644 index 00000000..67eba7fc --- /dev/null +++ b/Tests/Resources/Export/Materials/URP/MetallicTexture.mat @@ -0,0 +1,197 @@ +%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: MetallicTexture + m_Shader: {fileID: -6465566751694194690, guid: b9d29dfa1474148e792ac720cbd45122, type: 3} + m_ShaderKeywords: _ALPHATEST_ON _DISABLE_SSR_TRANSPARENT _TEXTURE_TRANSFORM + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2475 + stringTagMap: + RenderType: TransparentCutout + disabledShaderPasses: + - MOTIONVECTORS + - TransparentDepthPrepass + - TransparentDepthPostpass + - TransparentBackface + - RayTracingPrepass + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 2800000, guid: 8da4e4c98bfa44b25a9faa40105892f1, type: 3} + m_Scale: {x: 2, y: 2} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - transmissionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaCutoffEnable: 1 + - _AlphaDstBlend: 0 + - _AlphaSrcBlend: 1 + - _AlphaToMask: 0 + - _AlphaToMaskInspectorValue: 0 + - _BUILTIN_AlphaClip: 0 + - _BUILTIN_Blend: 0 + - _BUILTIN_CullMode: 2 + - _BUILTIN_DstBlend: 0 + - _BUILTIN_QueueControl: -1 + - _BUILTIN_QueueOffset: 0 + - _BUILTIN_SrcBlend: 1 + - _BUILTIN_Surface: 0 + - _BUILTIN_ZTest: 4 + - _BUILTIN_ZWrite: 1 + - _BUILTIN_ZWriteControl: 0 + - _Blend: 0 + - _BlendMode: 0 + - _BlendModePreserveSpecular: 0 + - _CastShadows: 1 + - _Cull: 2 + - _CullMode: 2 + - _CullModeForward: 2 + - _DepthOffsetEnable: 0 + - _DoubleSidedEnable: 0 + - _DoubleSidedNormalMode: 2 + - _DstBlend: 0 + - _EnableBlendModePreserveSpecularLighting: 1 + - _EnableFogOnTransparent: 1 + - _Mode: 0 + - _OpaqueCullMode: 2 + - _QueueControl: 0 + - _QueueOffset: 0 + - _RayTracing: 0 + - _ReceiveShadows: 1 + - _ReceivesSSR: 1 + - _ReceivesSSRTransparent: 0 + - _RefractionModel: 0 + - _RenderQueueType: 1 + - _RequireSplitLighting: 0 + - _SrcBlend: 1 + - _StencilRef: 0 + - _StencilRefDepth: 8 + - _StencilRefDistortionVec: 4 + - _StencilRefGBuffer: 10 + - _StencilRefMV: 40 + - _StencilWriteMask: 6 + - _StencilWriteMaskDepth: 8 + - _StencilWriteMaskDistortionVec: 4 + - _StencilWriteMaskGBuffer: 14 + - _StencilWriteMaskMV: 40 + - _SupportDecals: 1 + - _Surface: 0 + - _SurfaceType: 0 + - _TransparentBackfaceEnable: 0 + - _TransparentCullMode: 2 + - _TransparentDepthPostpassEnable: 0 + - _TransparentDepthPrepassEnable: 0 + - _TransparentSortPriority: 0 + - _TransparentWritingMotionVec: 0 + - _TransparentZWrite: 0 + - _UseShadowThreshold: 0 + - _WorkflowMode: 1 + - _ZTest: 4 + - _ZTestDepthEqualForOpaque: 3 + - _ZTestGBuffer: 3 + - _ZTestTransparent: 4 + - _ZWrite: 1 + - _ZWriteControl: 0 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveExposureWeight: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 1 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 1 + - transmissionFactor: 0 + m_Colors: + - _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0} + - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} + - baseColorFactor: {r: 0.30588236, g: 1, b: 0.3882353, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] +--- !u!114 &6329480415554470436 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 +--- !u!114 &6688152443506402959 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 0 +--- !u!114 &7887590303826644738 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 11 diff --git a/Tests/Resources/Export/Materials/URP/MetallicTexture.mat.meta b/Tests/Resources/Export/Materials/URP/MetallicTexture.mat.meta new file mode 100644 index 00000000..a61a160c --- /dev/null +++ b/Tests/Resources/Export/Materials/URP/MetallicTexture.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 50af7dbbd08744c08a4020159f74ff65 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/URP/NormalTexture.mat b/Tests/Resources/Export/Materials/URP/NormalTexture.mat new file mode 100644 index 00000000..c47e6867 --- /dev/null +++ b/Tests/Resources/Export/Materials/URP/NormalTexture.mat @@ -0,0 +1,198 @@ +%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: NormalTexture + m_Shader: {fileID: -6465566751694194690, guid: b9d29dfa1474148e792ac720cbd45122, type: 3} + m_ShaderKeywords: _ALPHATEST_ON _DISABLE_SSR_TRANSPARENT _TEXTURE_TRANSFORM + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2475 + stringTagMap: + MotionVector: User + RenderType: TransparentCutout + disabledShaderPasses: + - MOTIONVECTORS + - TransparentDepthPrepass + - TransparentDepthPostpass + - TransparentBackface + - RayTracingPrepass + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 2800000, guid: e5fa3fd4c4ccd4b5c972e3746a01539d, type: 3} + m_Scale: {x: 1.5, y: 1.2} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - transmissionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaCutoffEnable: 1 + - _AlphaDstBlend: 0 + - _AlphaSrcBlend: 1 + - _AlphaToMask: 0 + - _AlphaToMaskInspectorValue: 0 + - _BUILTIN_AlphaClip: 0 + - _BUILTIN_Blend: 0 + - _BUILTIN_CullMode: 2 + - _BUILTIN_DstBlend: 0 + - _BUILTIN_QueueControl: -1 + - _BUILTIN_QueueOffset: 0 + - _BUILTIN_SrcBlend: 1 + - _BUILTIN_Surface: 0 + - _BUILTIN_ZTest: 4 + - _BUILTIN_ZWrite: 1 + - _BUILTIN_ZWriteControl: 0 + - _Blend: 0 + - _BlendMode: 0 + - _BlendModePreserveSpecular: 0 + - _CastShadows: 1 + - _Cull: 2 + - _CullMode: 2 + - _CullModeForward: 2 + - _DepthOffsetEnable: 0 + - _DoubleSidedEnable: 0 + - _DoubleSidedNormalMode: 2 + - _DstBlend: 0 + - _EnableBlendModePreserveSpecularLighting: 1 + - _EnableFogOnTransparent: 1 + - _Mode: 0 + - _OpaqueCullMode: 2 + - _QueueControl: 0 + - _QueueOffset: 0 + - _RayTracing: 0 + - _ReceiveShadows: 1 + - _ReceivesSSR: 1 + - _ReceivesSSRTransparent: 0 + - _RefractionModel: 0 + - _RenderQueueType: 1 + - _RequireSplitLighting: 0 + - _SrcBlend: 1 + - _StencilRef: 0 + - _StencilRefDepth: 8 + - _StencilRefDistortionVec: 4 + - _StencilRefGBuffer: 10 + - _StencilRefMV: 40 + - _StencilWriteMask: 6 + - _StencilWriteMaskDepth: 8 + - _StencilWriteMaskDistortionVec: 4 + - _StencilWriteMaskGBuffer: 14 + - _StencilWriteMaskMV: 40 + - _SupportDecals: 1 + - _Surface: 0 + - _SurfaceType: 0 + - _TransparentBackfaceEnable: 0 + - _TransparentCullMode: 2 + - _TransparentDepthPostpassEnable: 0 + - _TransparentDepthPrepassEnable: 0 + - _TransparentSortPriority: 0 + - _TransparentWritingMotionVec: 0 + - _TransparentZWrite: 0 + - _UseShadowThreshold: 0 + - _WorkflowMode: 1 + - _ZTest: 4 + - _ZTestDepthEqualForOpaque: 3 + - _ZTestGBuffer: 3 + - _ZTestTransparent: 4 + - _ZWrite: 1 + - _ZWriteControl: 0 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveExposureWeight: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1.1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 0.5 + - transmissionFactor: 0 + m_Colors: + - _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0} + - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} + - baseColorFactor: {r: 1, g: 1, b: 1, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] +--- !u!114 &1138547567241307365 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 0 +--- !u!114 &3626248866102231885 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 +--- !u!114 &5196027134451525230 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 11 diff --git a/Tests/Resources/Export/Materials/URP/NormalTexture.mat.meta b/Tests/Resources/Export/Materials/URP/NormalTexture.mat.meta new file mode 100644 index 00000000..382d1b0f --- /dev/null +++ b/Tests/Resources/Export/Materials/URP/NormalTexture.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 87e1e49d43e9742d29e7b6e9fa5214c6 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/URP/NotGltf.mat b/Tests/Resources/Export/Materials/URP/NotGltf.mat new file mode 100644 index 00000000..7e49eb73 --- /dev/null +++ b/Tests/Resources/Export/Materials/URP/NotGltf.mat @@ -0,0 +1,209 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-3162871190671430744 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 +--- !u!114 &-2485062674677238067 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 0 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: NotGltf + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - baseColorTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - transmissionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _BUILTIN_AlphaClip: 0 + - _BUILTIN_Blend: 0 + - _BUILTIN_CullMode: 2 + - _BUILTIN_DstBlend: 0 + - _BUILTIN_QueueControl: -1 + - _BUILTIN_QueueOffset: 0 + - _BUILTIN_SrcBlend: 1 + - _BUILTIN_Surface: 0 + - _BUILTIN_ZTest: 4 + - _BUILTIN_ZWrite: 1 + - _BUILTIN_ZWriteControl: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 0 + - _BumpScale: 1 + - _CastShadows: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _QueueControl: 0 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0.5 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _UVSec: 0 + - _WorkflowMode: 1 + - _ZTest: 4 + - _ZWrite: 1 + - _ZWriteControl: 0 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveExposureWeight: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 1 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 1 + - transmissionFactor: 0 + m_Colors: + - _BaseColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + - baseColorFactor: {r: 1, g: 1, b: 1, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] + m_AllowLocking: 1 diff --git a/Tests/Resources/Export/Materials/URP/NotGltf.mat.meta b/Tests/Resources/Export/Materials/URP/NotGltf.mat.meta new file mode 100644 index 00000000..3419c661 --- /dev/null +++ b/Tests/Resources/Export/Materials/URP/NotGltf.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 95732382e073f4812b50cc3384b97646 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/URP/OcclusionTexture.mat b/Tests/Resources/Export/Materials/URP/OcclusionTexture.mat new file mode 100644 index 00000000..c1c2381c --- /dev/null +++ b/Tests/Resources/Export/Materials/URP/OcclusionTexture.mat @@ -0,0 +1,197 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-6563399278336437715 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: OcclusionTexture + m_Shader: {fileID: -6465566751694194690, guid: b9d29dfa1474148e792ac720cbd45122, type: 3} + m_ShaderKeywords: _ALPHATEST_ON _DISABLE_SSR_TRANSPARENT _TEXTURE_TRANSFORM + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2475 + stringTagMap: + RenderType: TransparentCutout + disabledShaderPasses: + - MOTIONVECTORS + - TransparentDepthPrepass + - TransparentDepthPostpass + - TransparentBackface + - RayTracingPrepass + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 2800000, guid: a0989fa75442a4f299d3e16bd238de3b, type: 3} + m_Scale: {x: 2, y: 2} + m_Offset: {x: 0, y: 0} + - transmissionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaCutoffEnable: 1 + - _AlphaDstBlend: 0 + - _AlphaSrcBlend: 1 + - _AlphaToMask: 0 + - _AlphaToMaskInspectorValue: 0 + - _BUILTIN_AlphaClip: 0 + - _BUILTIN_Blend: 0 + - _BUILTIN_CullMode: 2 + - _BUILTIN_DstBlend: 0 + - _BUILTIN_QueueControl: -1 + - _BUILTIN_QueueOffset: 0 + - _BUILTIN_SrcBlend: 1 + - _BUILTIN_Surface: 0 + - _BUILTIN_ZTest: 4 + - _BUILTIN_ZWrite: 1 + - _BUILTIN_ZWriteControl: 0 + - _Blend: 0 + - _BlendMode: 0 + - _BlendModePreserveSpecular: 0 + - _CastShadows: 1 + - _Cull: 2 + - _CullMode: 2 + - _CullModeForward: 2 + - _DepthOffsetEnable: 0 + - _DoubleSidedEnable: 0 + - _DoubleSidedNormalMode: 2 + - _DstBlend: 0 + - _EnableBlendModePreserveSpecularLighting: 1 + - _EnableFogOnTransparent: 1 + - _Mode: 0 + - _OpaqueCullMode: 2 + - _QueueControl: 0 + - _QueueOffset: 0 + - _RayTracing: 0 + - _ReceiveShadows: 1 + - _ReceivesSSR: 1 + - _ReceivesSSRTransparent: 0 + - _RefractionModel: 0 + - _RenderQueueType: 1 + - _RequireSplitLighting: 0 + - _SrcBlend: 1 + - _StencilRef: 0 + - _StencilRefDepth: 8 + - _StencilRefDistortionVec: 4 + - _StencilRefGBuffer: 10 + - _StencilRefMV: 40 + - _StencilWriteMask: 6 + - _StencilWriteMaskDepth: 8 + - _StencilWriteMaskDistortionVec: 4 + - _StencilWriteMaskGBuffer: 14 + - _StencilWriteMaskMV: 40 + - _SupportDecals: 1 + - _Surface: 0 + - _SurfaceType: 0 + - _TransparentBackfaceEnable: 0 + - _TransparentCullMode: 2 + - _TransparentDepthPostpassEnable: 0 + - _TransparentDepthPrepassEnable: 0 + - _TransparentSortPriority: 0 + - _TransparentWritingMotionVec: 0 + - _TransparentZWrite: 0 + - _UseShadowThreshold: 0 + - _WorkflowMode: 1 + - _ZTest: 4 + - _ZTestDepthEqualForOpaque: 3 + - _ZTestGBuffer: 3 + - _ZTestTransparent: 4 + - _ZWrite: 1 + - _ZWriteControl: 0 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveExposureWeight: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 0.8 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 0.7 + - transmissionFactor: 0 + m_Colors: + - _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0} + - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} + - baseColorFactor: {r: 1, g: 0.85672647, b: 0.58965355, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] +--- !u!114 &4661383101410321536 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 0 +--- !u!114 &6970435888722911132 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 11 diff --git a/Tests/Resources/Export/Materials/URP/OcclusionTexture.mat.meta b/Tests/Resources/Export/Materials/URP/OcclusionTexture.mat.meta new file mode 100644 index 00000000..6c4bb6e2 --- /dev/null +++ b/Tests/Resources/Export/Materials/URP/OcclusionTexture.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 38c54f3f649644401a9d0cc94f03e000 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/URP/Omni.mat b/Tests/Resources/Export/Materials/URP/Omni.mat new file mode 100644 index 00000000..bcf184dd --- /dev/null +++ b/Tests/Resources/Export/Materials/URP/Omni.mat @@ -0,0 +1,199 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-7342136019923642577 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 11 +--- !u!114 &-937208297705619245 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Omni + m_Shader: {fileID: -6465566751694194690, guid: b9d29dfa1474148e792ac720cbd45122, type: 3} + m_ShaderKeywords: _ALPHATEST_ON _DISABLE_SSR_TRANSPARENT _TEXTURE_TRANSFORM _EMISSIVE + _OCCLUSION + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2475 + stringTagMap: + MotionVector: User + RenderType: TransparentCutout + disabledShaderPasses: + - MOTIONVECTORS + - TransparentDepthPrepass + - TransparentDepthPostpass + - TransparentBackface + - RayTracingPrepass + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 2800000, guid: 767b013dd53264d2a858edf8651b320d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0.4, y: 0.6} + - emissiveTexture: + m_Texture: {fileID: 2800000, guid: f53f6abdff34c42bf8b9a9487f5fba4d, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0.1, y: 0.2} + - metallicRoughnessTexture: + m_Texture: {fileID: 2800000, guid: e6a8dbc8ea6f7452db96210e86372550, type: 3} + m_Scale: {x: 1.11, y: 1.21} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 2800000, guid: e5fa3fd4c4ccd4b5c972e3746a01539d, type: 3} + m_Scale: {x: 1.5, y: 1.2} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 2800000, guid: e6a8dbc8ea6f7452db96210e86372550, type: 3} + m_Scale: {x: 1.1, y: 1.2} + m_Offset: {x: 0, y: 0} + - transmissionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaCutoffEnable: 1 + - _AlphaDstBlend: 0 + - _AlphaSrcBlend: 1 + - _AlphaToMask: 0 + - _AlphaToMaskInspectorValue: 0 + - _BUILTIN_AlphaClip: 0 + - _BUILTIN_Blend: 0 + - _BUILTIN_CullMode: 2 + - _BUILTIN_DstBlend: 0 + - _BUILTIN_QueueControl: -1 + - _BUILTIN_QueueOffset: 0 + - _BUILTIN_SrcBlend: 1 + - _BUILTIN_Surface: 0 + - _BUILTIN_ZTest: 4 + - _BUILTIN_ZWrite: 1 + - _BUILTIN_ZWriteControl: 0 + - _Blend: 0 + - _BlendMode: 0 + - _BlendModePreserveSpecular: 0 + - _CastShadows: 1 + - _Cull: 2 + - _CullMode: 2 + - _CullModeForward: 2 + - _DepthOffsetEnable: 0 + - _DoubleSidedEnable: 0 + - _DoubleSidedNormalMode: 2 + - _DstBlend: 0 + - _EnableBlendModePreserveSpecularLighting: 1 + - _EnableFogOnTransparent: 1 + - _Mode: 0 + - _OpaqueCullMode: 2 + - _QueueControl: 0 + - _QueueOffset: 0 + - _RayTracing: 0 + - _ReceiveShadows: 1 + - _ReceivesSSR: 1 + - _ReceivesSSRTransparent: 0 + - _RefractionModel: 0 + - _RenderQueueType: 1 + - _RequireSplitLighting: 0 + - _SrcBlend: 1 + - _StencilRef: 0 + - _StencilRefDepth: 8 + - _StencilRefDistortionVec: 4 + - _StencilRefGBuffer: 10 + - _StencilRefMV: 40 + - _StencilWriteMask: 6 + - _StencilWriteMaskDepth: 8 + - _StencilWriteMaskDistortionVec: 4 + - _StencilWriteMaskGBuffer: 14 + - _StencilWriteMaskMV: 40 + - _SupportDecals: 1 + - _Surface: 0 + - _SurfaceType: 0 + - _TransparentBackfaceEnable: 0 + - _TransparentCullMode: 2 + - _TransparentDepthPostpassEnable: 0 + - _TransparentDepthPrepassEnable: 0 + - _TransparentSortPriority: 0 + - _TransparentWritingMotionVec: 0 + - _TransparentZWrite: 0 + - _UseShadowThreshold: 0 + - _WorkflowMode: 1 + - _ZTest: 4 + - _ZTestDepthEqualForOpaque: 3 + - _ZTestGBuffer: 3 + - _ZTestTransparent: 4 + - _ZWrite: 1 + - _ZWriteControl: 0 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveExposureWeight: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0.95 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 0.42 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 0.58 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 0.93 + - transmissionFactor: 0 + m_Colors: + - _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0} + - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} + - baseColorFactor: {r: 0.9, g: 0.8, b: 0.7, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 1, g: 1, b: 1, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] +--- !u!114 &4475698861775716853 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 0 diff --git a/Tests/Resources/Export/Materials/URP/Omni.mat.meta b/Tests/Resources/Export/Materials/URP/Omni.mat.meta new file mode 100644 index 00000000..eaac91ff --- /dev/null +++ b/Tests/Resources/Export/Materials/URP/Omni.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a2fd03763cca04598a20777394faf252 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Resources/Export/Materials/URP/RoughnessTexture.mat b/Tests/Resources/Export/Materials/URP/RoughnessTexture.mat new file mode 100644 index 00000000..8265ea50 --- /dev/null +++ b/Tests/Resources/Export/Materials/URP/RoughnessTexture.mat @@ -0,0 +1,197 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-7184335634477803850 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: RoughnessTexture + m_Shader: {fileID: -6465566751694194690, guid: b9d29dfa1474148e792ac720cbd45122, type: 3} + m_ShaderKeywords: _ALPHATEST_ON _DISABLE_SSR_TRANSPARENT + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2475 + stringTagMap: + RenderType: TransparentCutout + disabledShaderPasses: + - MOTIONVECTORS + - TransparentDepthPrepass + - TransparentDepthPostpass + - TransparentBackface + - RayTracingPrepass + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - baseColorTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - emissiveTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - metallicRoughnessTexture: + m_Texture: {fileID: 2800000, guid: 236ba889a0d5e48bf977cee24ffcb55f, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - normalTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - occlusionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - transmissionTexture: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaCutoffEnable: 1 + - _AlphaDstBlend: 0 + - _AlphaSrcBlend: 1 + - _AlphaToMask: 0 + - _AlphaToMaskInspectorValue: 0 + - _BUILTIN_AlphaClip: 0 + - _BUILTIN_Blend: 0 + - _BUILTIN_CullMode: 2 + - _BUILTIN_DstBlend: 0 + - _BUILTIN_QueueControl: -1 + - _BUILTIN_QueueOffset: 0 + - _BUILTIN_SrcBlend: 1 + - _BUILTIN_Surface: 0 + - _BUILTIN_ZTest: 4 + - _BUILTIN_ZWrite: 1 + - _BUILTIN_ZWriteControl: 0 + - _Blend: 0 + - _BlendMode: 0 + - _BlendModePreserveSpecular: 0 + - _CastShadows: 1 + - _Cull: 2 + - _CullMode: 2 + - _CullModeForward: 2 + - _DepthOffsetEnable: 0 + - _DoubleSidedEnable: 0 + - _DoubleSidedNormalMode: 2 + - _DstBlend: 0 + - _EnableBlendModePreserveSpecularLighting: 1 + - _EnableFogOnTransparent: 1 + - _Mode: 0 + - _OpaqueCullMode: 2 + - _QueueControl: 0 + - _QueueOffset: 0 + - _RayTracing: 0 + - _ReceiveShadows: 1 + - _ReceivesSSR: 1 + - _ReceivesSSRTransparent: 0 + - _RefractionModel: 0 + - _RenderQueueType: 1 + - _RequireSplitLighting: 0 + - _SrcBlend: 1 + - _StencilRef: 0 + - _StencilRefDepth: 8 + - _StencilRefDistortionVec: 4 + - _StencilRefGBuffer: 10 + - _StencilRefMV: 40 + - _StencilWriteMask: 6 + - _StencilWriteMaskDepth: 8 + - _StencilWriteMaskDistortionVec: 4 + - _StencilWriteMaskGBuffer: 14 + - _StencilWriteMaskMV: 40 + - _SupportDecals: 1 + - _Surface: 0 + - _SurfaceType: 0 + - _TransparentBackfaceEnable: 0 + - _TransparentCullMode: 2 + - _TransparentDepthPostpassEnable: 0 + - _TransparentDepthPrepassEnable: 0 + - _TransparentSortPriority: 0 + - _TransparentWritingMotionVec: 0 + - _TransparentZWrite: 0 + - _UseShadowThreshold: 0 + - _WorkflowMode: 1 + - _ZTest: 4 + - _ZTestDepthEqualForOpaque: 3 + - _ZTestGBuffer: 3 + - _ZTestTransparent: 4 + - _ZWrite: 1 + - _ZWriteControl: 0 + - alphaCutoff: 0.5 + - baseColorTexture_texCoord: 0 + - emissiveExposureWeight: 0 + - emissiveTexture_texCoord: 0 + - metallicFactor: 0 + - metallicRoughnessTexture_texCoord: 0 + - normalTexture_scale: 1 + - normalTexture_texCoord: 0 + - occlusionTexture_strength: 1 + - occlusionTexture_texCoord: 0 + - roughnessFactor: 0.89 + - transmissionFactor: 0 + m_Colors: + - _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0} + - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} + - baseColorFactor: {r: 0.30588236, g: 1, b: 0.3882353, a: 1} + - baseColorTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - emissiveFactor: {r: 0, g: 0, b: 0, a: 1} + - emissiveTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - metallicRoughnessTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - normalTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + - occlusionTexture_Rotation: {r: 0, g: 0, b: 0, a: 0} + m_BuildTextureStacks: [] +--- !u!114 &794918956778256769 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 11 +--- !u!114 &2774689119717281520 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 0 diff --git a/Tests/Resources/Export/Materials/URP/RoughnessTexture.mat.meta b/Tests/Resources/Export/Materials/URP/RoughnessTexture.mat.meta new file mode 100644 index 00000000..caa629c6 --- /dev/null +++ b/Tests/Resources/Export/Materials/URP/RoughnessTexture.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7831ec4c2227d401c80e0f76a16b61c1 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Runtime/Scripts/Export/GltfBuiltInShaderMaterialExporterTests.cs b/Tests/Runtime/Scripts/Export/GltfBuiltInShaderMaterialExporterTests.cs new file mode 100644 index 00000000..72795603 --- /dev/null +++ b/Tests/Runtime/Scripts/Export/GltfBuiltInShaderMaterialExporterTests.cs @@ -0,0 +1,145 @@ +// SPDX-FileCopyrightText: 2024 Unity Technologies and the glTFast authors +// SPDX-License-Identifier: Apache-2.0 + +using System; +using GLTFast.Export; +using NUnit.Framework; +using UnityEngine; + +namespace GLTFast.Tests.Export +{ + [TestFixture, Category("Export")] + class GltfBuiltInShaderMaterialExporterTests : MaterialExportTests + { + [Test] + public void BaseColorTextureCutout() + { + BaseColorTextureCutoutTest(RenderPipeline.BuiltIn); + } + + [Test] + public void BaseColorTextureTransparent() + { + BaseColorTextureTransparentTest(RenderPipeline.BuiltIn); + } + + [Test] + public void BaseColor() + { + BaseColorTest(RenderPipeline.BuiltIn); + } + + [Test] + public void BaseColorTexture() + { + BaseColorTextureTest(RenderPipeline.BuiltIn); + } + + [Test] + public void BaseColorTextureTranslated() + { + BaseColorTextureTranslatedTest(RenderPipeline.BuiltIn); + } + + [Test] + public void BaseColorTextureScaled() + { + BaseColorTextureScaledTest(RenderPipeline.BuiltIn); + } + + [Test] + public void BaseColorTextureRotated() + { + BaseColorTextureRotatedTest(RenderPipeline.BuiltIn); + } + + [Test] + public void RoughnessTexture() + { + RoughnessTextureTest(RenderPipeline.BuiltIn); + } + + [Test] + public void Metallic() + { + MetallicTest(RenderPipeline.BuiltIn); + } + + [Test] + public void MetallicTexture() + { + MetallicTextureTest(RenderPipeline.BuiltIn); + } + + [Test] + public void MetallicRoughnessTexture() + { + MetallicRoughnessTextureTest(RenderPipeline.BuiltIn); + } + + [Test] + public void MetallicRoughnessOcclusionTexture() + { + MetallicRoughnessOcclusionTextureTest(RenderPipeline.BuiltIn); + } + + [Test] + public void OcclusionTexture() + { + OcclusionTextureTest(RenderPipeline.BuiltIn); + } + + [Test] + public void EmissiveFactor() + { + EmissiveFactorTest(RenderPipeline.BuiltIn); + } + + [Test] + public void EmissiveTexture() + { + EmissiveTextureTest(RenderPipeline.BuiltIn); + } + + [Test] + public void EmissiveTextureFactor() + { + EmissiveTextureFactorTest(RenderPipeline.BuiltIn); + } + + [Test] + public void NormalTexture() + { + NormalTextureTest(RenderPipeline.BuiltIn); + } + + [Test] + public void NotGltf() + { + NotGltfTest(RenderPipeline.BuiltIn); + } + + [Test] + public void Omni() + { + OmniTest(RenderPipeline.BuiltIn); + } + + [Test] + public void AddImageFail() + { + AddImageFailTest(RenderPipeline.BuiltIn); + } + + [Test] + public void DoubleSided() + { + DoubleSidedTest(RenderPipeline.BuiltIn); + } + + protected override void SetUpExporter() + { + m_Exporter = new GltfBuiltInShaderMaterialExporter(); + } + } +} diff --git a/Tests/Runtime/Scripts/Export/GltfBuiltInShaderMaterialExporterTests.cs.meta b/Tests/Runtime/Scripts/Export/GltfBuiltInShaderMaterialExporterTests.cs.meta new file mode 100644 index 00000000..edb8e0ed --- /dev/null +++ b/Tests/Runtime/Scripts/Export/GltfBuiltInShaderMaterialExporterTests.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 800184f52bcf3473a87e70375d12a9f2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Runtime/Scripts/Export/GltfHdrpMaterialExporterTests.cs b/Tests/Runtime/Scripts/Export/GltfHdrpMaterialExporterTests.cs new file mode 100644 index 00000000..b6cd05a5 --- /dev/null +++ b/Tests/Runtime/Scripts/Export/GltfHdrpMaterialExporterTests.cs @@ -0,0 +1,191 @@ +// SPDX-FileCopyrightText: 2024 Unity Technologies and the glTFast authors +// SPDX-License-Identifier: Apache-2.0 + +using System; +using GLTFast.Export; +using NUnit.Framework; +using UnityEngine; + +namespace GLTFast.Tests.Export +{ + [TestFixture, Category("Export")] + class GltfHdrpMaterialExporterTests : MaterialExportTests + { + [Test] + public void BaseColor() + { + CertifyRequirements(); + BaseColorTest(RenderPipeline.HighDefinition); + } + + [Test] + public void BaseColorTexture() + { + CertifyRequirements(); + BaseColorTextureTest(RenderPipeline.HighDefinition); + } + + [Test] + public void BaseColorTextureTranslated() + { + CertifyRequirements(); + BaseColorTextureTranslatedTest(RenderPipeline.HighDefinition); + } + + [Test] + public void BaseColorTextureScaled() + { + CertifyRequirements(); + BaseColorTextureScaledTest(RenderPipeline.HighDefinition); + } + + [Test] + public void BaseColorTextureRotated() + { + CertifyRequirements(); + BaseColorTextureRotatedTest(RenderPipeline.HighDefinition); + } + + [Test] + public void BaseColorTextureCutout() + { + CertifyRequirements(); +#if !USING_URP || USING_URP_12_OR_NEWER + BaseColorTextureCutoutTest(RenderPipeline.HighDefinition); +#else + Assert.Ignore("Not testing legacy URP version older than 12.x."); +#endif + } + + [Test] + public void BaseColorTextureTransparent() + { + CertifyRequirements(); +#if !USING_URP || USING_URP_12_OR_NEWER + BaseColorTextureTransparentTest(RenderPipeline.HighDefinition); +#else + Assert.Ignore("Not testing legacy URP version older than 12.x."); +#endif + } + + [Test] + public void RoughnessTexture() + { + CertifyRequirements(); + RoughnessTextureTest(RenderPipeline.HighDefinition); + } + + [Test] + public void Metallic() + { + CertifyRequirements(); + MetallicTest(RenderPipeline.HighDefinition); + } + + [Test] + public void MetallicTexture() + { + CertifyRequirements(); + MetallicTextureTest(RenderPipeline.HighDefinition); + } + + [Test] + public void MetallicRoughnessTexture() + { + CertifyRequirements(); + MetallicRoughnessTextureTest(RenderPipeline.HighDefinition); + } + + [Test] + public void MetallicRoughnessOcclusionTexture() + { + CertifyRequirements(); + MetallicRoughnessOcclusionTextureTest(RenderPipeline.HighDefinition); + } + + [Test] + public void OcclusionTexture() + { + CertifyRequirements(); + OcclusionTextureTest(RenderPipeline.HighDefinition); + } + + [Test] + public void EmissiveFactor() + { + CertifyRequirements(); + EmissiveFactorTest(RenderPipeline.HighDefinition); + } + + [Test] + public void EmissiveTexture() + { + CertifyRequirements(); + EmissiveTextureTest(RenderPipeline.HighDefinition); + } + + [Test] + public void EmissiveTextureFactor() + { + CertifyRequirements(); + EmissiveTextureFactorTest(RenderPipeline.HighDefinition); + } + + [Test] + public void NormalTexture() + { + CertifyRequirements(); + NormalTextureTest(RenderPipeline.HighDefinition); + } + + [Test] + public void NotGltf() + { + CertifyRequirements(); + NotGltfTest(RenderPipeline.HighDefinition); + } + + [Test] + public void Omni() + { + CertifyRequirements(); + OmniTest(RenderPipeline.HighDefinition); + } + + [Test] + public void AddImageFail() + { + CertifyRequirements(); + AddImageFailTest(RenderPipeline.HighDefinition); + } + + [Test] + public void DoubleSided() + { + CertifyRequirements(); +#if !USING_URP || USING_URP_12_OR_NEWER + DoubleSidedTest(RenderPipeline.HighDefinition); +#else + Assert.Ignore("Not testing legacy URP version older than 12.x."); +#endif + } + + static void CertifyRequirements() + { +#if !UNITY_SHADER_GRAPH + Assert.Ignore("Shader Graph package is missing...ignoring tests on Shader Graph based materials."); +#endif + if (RenderPipeline.HighDefinition != RenderPipelineUtils.RenderPipeline) + { + Assert.Ignore("Test requires Universal Render Pipeline."); + } + } + + protected override void SetUpExporter() + { +#if USING_HDRP + m_Exporter = new GltfHdrpMaterialExporter(); +#endif + } + } +} diff --git a/Tests/Runtime/Scripts/Export/GltfHdrpMaterialExporterTests.cs.meta b/Tests/Runtime/Scripts/Export/GltfHdrpMaterialExporterTests.cs.meta new file mode 100644 index 00000000..f1da7181 --- /dev/null +++ b/Tests/Runtime/Scripts/Export/GltfHdrpMaterialExporterTests.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 209dcb793be874b418bbb6758f800a0f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Runtime/Scripts/Export/GltfShaderGraphMaterialExporterTests.cs b/Tests/Runtime/Scripts/Export/GltfShaderGraphMaterialExporterTests.cs new file mode 100644 index 00000000..81044dea --- /dev/null +++ b/Tests/Runtime/Scripts/Export/GltfShaderGraphMaterialExporterTests.cs @@ -0,0 +1,191 @@ +// SPDX-FileCopyrightText: 2024 Unity Technologies and the glTFast authors +// SPDX-License-Identifier: Apache-2.0 + +using System; +using GLTFast.Export; +using NUnit.Framework; +using UnityEngine; + +namespace GLTFast.Tests.Export +{ + [TestFixture, Category("Export")] + class GltfShaderGraphMaterialExporterTests : MaterialExportTests + { + [Test] + public void BaseColor() + { + CertifyRequirements(); + BaseColorTest(RenderPipeline.Universal); + } + + [Test] + public void BaseColorTexture() + { + CertifyRequirements(); + BaseColorTextureTest(RenderPipeline.Universal); + } + + [Test] + public void BaseColorTextureTranslated() + { + CertifyRequirements(); + BaseColorTextureTranslatedTest(RenderPipeline.Universal); + } + + [Test] + public void BaseColorTextureScaled() + { + CertifyRequirements(); + BaseColorTextureScaledTest(RenderPipeline.Universal); + } + + [Test] + public void BaseColorTextureRotated() + { + CertifyRequirements(); + BaseColorTextureRotatedTest(RenderPipeline.Universal); + } + + [Test] + public void BaseColorTextureCutout() + { + CertifyRequirements(); +#if !USING_URP || USING_URP_12_OR_NEWER + BaseColorTextureCutoutTest(RenderPipeline.Universal); +#else + Assert.Ignore("Not testing legacy URP version older than 12.x."); +#endif + } + + [Test] + public void BaseColorTextureTransparent() + { + CertifyRequirements(); +#if !USING_URP || USING_URP_12_OR_NEWER + BaseColorTextureTransparentTest(RenderPipeline.Universal); +#else + Assert.Ignore("Not testing legacy URP version older than 12.x."); +#endif + } + + [Test] + public void RoughnessTexture() + { + CertifyRequirements(); + RoughnessTextureTest(RenderPipeline.Universal); + } + + [Test] + public void Metallic() + { + CertifyRequirements(); + MetallicTest(RenderPipeline.Universal); + } + + [Test] + public void MetallicTexture() + { + CertifyRequirements(); + MetallicTextureTest(RenderPipeline.Universal); + } + + [Test] + public void MetallicRoughnessTexture() + { + CertifyRequirements(); + MetallicRoughnessTextureTest(RenderPipeline.Universal); + } + + [Test] + public void MetallicRoughnessOcclusionTexture() + { + CertifyRequirements(); + MetallicRoughnessOcclusionTextureTest(RenderPipeline.Universal); + } + + [Test] + public void OcclusionTexture() + { + CertifyRequirements(); + OcclusionTextureTest(RenderPipeline.Universal); + } + + [Test] + public void EmissiveFactor() + { + CertifyRequirements(); + EmissiveFactorTest(RenderPipeline.Universal); + } + + [Test] + public void EmissiveTexture() + { + CertifyRequirements(); + EmissiveTextureTest(RenderPipeline.Universal); + } + + [Test] + public void EmissiveTextureFactor() + { + CertifyRequirements(); + EmissiveTextureFactorTest(RenderPipeline.Universal); + } + + [Test] + public void NormalTexture() + { + CertifyRequirements(); + NormalTextureTest(RenderPipeline.Universal); + } + + [Test] + public void NotGltf() + { + CertifyRequirements(); + NotGltfTest(RenderPipeline.Universal); + } + + [Test] + public void Omni() + { + CertifyRequirements(); + OmniTest(RenderPipeline.Universal); + } + + [Test] + public void AddImageFail() + { + CertifyRequirements(); + AddImageFailTest(RenderPipeline.Universal); + } + + [Test] + public void DoubleSided() + { + CertifyRequirements(); +#if !USING_URP || USING_URP_12_OR_NEWER + DoubleSidedTest(RenderPipeline.Universal); +#else + Assert.Ignore("Not testing legacy URP version older than 12.x."); +#endif + } + + static void CertifyRequirements() + { +#if !UNITY_SHADER_GRAPH + Assert.Ignore("Shader Graph package is missing...ignoring tests on Shader Graph based materials."); +#endif + if (RenderPipeline.Universal != RenderPipelineUtils.RenderPipeline) + { + Assert.Ignore("Test requires Universal Render Pipeline."); + } + } + + protected override void SetUpExporter() + { +#if UNITY_SHADER_GRAPH + m_Exporter = new GltfShaderGraphMaterialExporter(); +#endif + } + } +} diff --git a/Tests/Runtime/Scripts/Export/GltfShaderGraphMaterialExporterTests.cs.meta b/Tests/Runtime/Scripts/Export/GltfShaderGraphMaterialExporterTests.cs.meta new file mode 100644 index 00000000..3a49845b --- /dev/null +++ b/Tests/Runtime/Scripts/Export/GltfShaderGraphMaterialExporterTests.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9505a2f8c0b7e4f82afbb86f66e556b5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Runtime/Scripts/Export/GltfWritableMock.cs b/Tests/Runtime/Scripts/Export/GltfWritableMock.cs new file mode 100644 index 00000000..0816b8c6 --- /dev/null +++ b/Tests/Runtime/Scripts/Export/GltfWritableMock.cs @@ -0,0 +1,154 @@ +// SPDX-FileCopyrightText: 2024 Unity Technologies and the glTFast authors +// SPDX-License-Identifier: Apache-2.0 + +using System; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using GLTFast.Export; +using GLTFast.Schema; +using Unity.Mathematics; +using UnityEngine; +using Camera = UnityEngine.Camera; +using Material = UnityEngine.Material; +using Mesh = UnityEngine.Mesh; +using Texture = GLTFast.Schema.Texture; + +namespace GLTFast.Tests.Export +{ + class GltfWritableMock : IGltfWritable + { + public List imageExports = new List(); + public List samplers = new List(); + public List textures = new List(); + + public Dictionary extensions = new Dictionary(); + + List m_SamplerKeys; + + bool m_ImageConversion; + + public GltfWritableMock(bool imageConversion = true) + { + m_ImageConversion = imageConversion; + } + + public uint AddNode(float3? translation = null, quaternion? rotation = null, float3? scale = null, uint[] children = null, string name = null) + { + throw new NotImplementedException(); + } + + public void AddMeshToNode(int nodeId, Mesh uMesh, int[] materialIds) + { + throw new NotImplementedException(); + } + + public void AddCameraToNode(int nodeId, int cameraId) + { + throw new NotImplementedException(); + } + + public void AddLightToNode(int nodeId, int lightId) + { + throw new NotImplementedException(); + } + + public bool AddMaterial(Material uMaterial, out int materialId, IMaterialExport materialExport) + { + throw new NotImplementedException(); + } + + public int AddImage(ImageExportBase imageExport) + { + if (!m_ImageConversion) return -1; + + var imageId = imageExports.IndexOf(imageExport); + if (imageId >= 0) + { + return imageId; + } + + imageId = imageExports.Count; + imageExports.Add(imageExport); + return imageId; + } + + public int AddTexture(int imageId, int samplerId) + { + if (!m_ImageConversion) return -1; + + textures ??= new List(); + + var texture = new Texture + { + source = imageId, + sampler = samplerId + }; + + var index = textures.IndexOf(texture); + if (index >= 0) + { + return index; + } + + textures.Add(texture); + return textures.Count - 1; + } + + public int AddSampler(FilterMode filterMode, TextureWrapMode wrapModeU, TextureWrapMode wrapModeV) + { + if (filterMode == FilterMode.Bilinear && wrapModeU == TextureWrapMode.Repeat && wrapModeV == TextureWrapMode.Repeat) + { + // This is the default, so no sampler needed + return -1; + } + samplers ??= new List(); + m_SamplerKeys ??= new List(); + + var samplerKey = new SamplerKey(filterMode, wrapModeU, wrapModeV); + + var index = m_SamplerKeys.IndexOf(samplerKey); + if (index >= 0) + { + return index; + } + + samplers.Add(new Sampler(filterMode, wrapModeU, wrapModeV)); + m_SamplerKeys.Add(samplerKey); + return samplers.Count - 1; + } + + public bool AddCamera(Camera uCamera, out int cameraId) + { + throw new NotImplementedException(); + } + + public bool AddLight(Light uLight, out int lightId) + { + throw new NotImplementedException(); + } + + public uint AddScene(uint[] nodes, string name = null) + { + throw new NotImplementedException(); + } + + public void RegisterExtensionUsage(Extension extension, bool required = true) + { + if (required || (extensions.TryGetValue(extension, out var oldRequired) && !oldRequired)) + { + extensions[extension] = required; + } + } + + public Task SaveToFileAndDispose(string path) + { + throw new NotImplementedException(); + } + + public Task SaveToStreamAndDispose(Stream stream) + { + throw new NotImplementedException(); + } + } +} diff --git a/Tests/Runtime/Scripts/Export/GltfWritableMock.cs.meta b/Tests/Runtime/Scripts/Export/GltfWritableMock.cs.meta new file mode 100644 index 00000000..729bd259 --- /dev/null +++ b/Tests/Runtime/Scripts/Export/GltfWritableMock.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 15b83cbd326842f198379fbaba15866b +timeCreated: 1713862183 \ No newline at end of file diff --git a/Tests/Runtime/Scripts/Export/MaterialExportTests.cs b/Tests/Runtime/Scripts/Export/MaterialExportTests.cs new file mode 100644 index 00000000..b598ae08 --- /dev/null +++ b/Tests/Runtime/Scripts/Export/MaterialExportTests.cs @@ -0,0 +1,470 @@ +// SPDX-FileCopyrightText: 2024 Unity Technologies and the glTFast authors +// SPDX-License-Identifier: Apache-2.0 + +using System; +using GLTFast.Export; +using GLTFast.Logging; +using GLTFast.Schema; +using NUnit.Framework; +using UnityEngine; +using UnityEngine.TestTools.Utils; +using Material = UnityEngine.Material; + +namespace GLTFast.Tests.Export +{ + abstract class MaterialExportTests + { + const string k_ResourcePath = "Export/Materials/"; + + protected IMaterialExport m_Exporter; + + protected void BaseColorTest(RenderPipeline renderPipeline) + { + var material = ConvertMaterial("BaseColor", out _, renderPipeline); + + Assert.IsNotNull(material.pbrMetallicRoughness); + Assert.AreEqual(new[] { .484529138f, .7353569f, .880825f, 1 }, material.pbrMetallicRoughness.baseColorFactor); + } + + protected void BaseColorTextureTest(RenderPipeline renderPipeline) + { +#if UNITY_IMAGECONVERSION + var texture = BaseColorTextureTest( + "BaseColorTexture", + out var gltfWriter, + renderPipeline, + out _); + Assert.IsNull(texture.extensions); + Assert.AreEqual(0, gltfWriter.extensions.Count); +#else + Assert.Ignore("Texture export is disabled! " + LogMessages.GetFullMessage(LogCode.ImageConversionNotEnabled)); +#endif + } + + protected void BaseColorTextureTranslatedTest(RenderPipeline renderPipeline) + { +#if UNITY_IMAGECONVERSION + var texture = BaseColorTextureTest( + "BaseColorTextureTranslated", + out var gltfWriter, + renderPipeline, + out _); + Assert.IsTrue(gltfWriter.extensions[Extension.TextureTransform]); + var transform = texture.extensions?.KHR_texture_transform; + Assert.IsNotNull(transform); + Assert.AreEqual(new[] { 0.4f, 0.6f }, transform.offset); + Assert.AreEqual(new[] { 1f, 1f }, transform.scale); + Assert.AreEqual(0, transform.rotation); +#else + Assert.Ignore("Texture export is disabled! " + LogMessages.GetFullMessage(LogCode.ImageConversionNotEnabled)); +#endif + } + + + protected void BaseColorTextureScaledTest(RenderPipeline renderPipeline) + { +#if UNITY_IMAGECONVERSION + var texture = BaseColorTextureTest( + "BaseColorTextureScaled", + out var gltfWriter, + renderPipeline, + out _); + Assert.IsTrue(gltfWriter.extensions[Extension.TextureTransform]); + var transform = texture.extensions?.KHR_texture_transform; + Assert.IsNotNull(transform); + Assert.AreEqual(new[] { 1.2f, 1.3f }, transform.scale); + Assert.AreEqual(new[] { 0f, 0f }, transform.offset); + Assert.AreEqual(0, transform.rotation); +#else + Assert.Ignore("Texture export is disabled! " + LogMessages.GetFullMessage(LogCode.ImageConversionNotEnabled)); +#endif + } + + protected void BaseColorTextureCutoutTest(RenderPipeline renderPipeline) + { +#if UNITY_IMAGECONVERSION + BaseColorTextureTest( + "BaseColorTextureCutout", + out _, + renderPipeline, + out var material); + Assert.AreEqual(MaterialBase.AlphaMode.Mask, material.GetAlphaMode()); + Assert.AreEqual(.6f, material.alphaCutoff); +#else + Assert.Ignore("Texture export is disabled! " + LogMessages.GetFullMessage(LogCode.ImageConversionNotEnabled)); +#endif + } + + protected void BaseColorTextureTransparentTest(RenderPipeline renderPipeline) + { +#if UNITY_IMAGECONVERSION + BaseColorTextureTest( + "BaseColorTextureTransparent", + out _, + renderPipeline, + out var material); + Assert.AreEqual(MaterialBase.AlphaMode.Blend, material.GetAlphaMode()); +#else + Assert.Ignore("Texture export is disabled! " + LogMessages.GetFullMessage(LogCode.ImageConversionNotEnabled)); +#endif + } + + protected void BaseColorTextureRotatedTest(RenderPipeline renderPipeline) + { +#if UNITY_IMAGECONVERSION + var texture = BaseColorTextureTest( + "BaseColorTextureRotated", + out var gltfWriter, + renderPipeline, + out _); + Assert.IsTrue(gltfWriter.extensions[Extension.TextureTransform]); + var transform = texture.extensions?.KHR_texture_transform; + Assert.IsNotNull(transform); + Assert.AreEqual(45, transform.rotation); + Assert.AreEqual(new[] { 0f, 0f }, transform.offset); + var comparer = new FloatEqualityComparer(10e-8f); + Assert.That(transform.scale, Is.EquivalentTo(new[] { 1f, 1f }).Using(comparer)); +#else + Assert.Ignore("Texture export is disabled! " + LogMessages.GetFullMessage(LogCode.ImageConversionNotEnabled)); +#endif + } + + protected void RoughnessTextureTest(RenderPipeline renderPipeline) + { +#if UNITY_IMAGECONVERSION + var material = ConvertMaterial("RoughnessTexture", out var gltfWriter, renderPipeline); + + Assert.AreEqual(1, gltfWriter.imageExports.Count); + Assert.AreEqual(1, gltfWriter.samplers.Count); + Assert.AreEqual(1, gltfWriter.textures.Count); + Assert.IsInstanceOf(gltfWriter.imageExports[0]); + + var mrTexture = material.pbrMetallicRoughness?.metallicRoughnessTexture; + Assert.IsNotNull(mrTexture); + Assert.IsNull(mrTexture.extensions); + + Assert.AreEqual(.89f, material.pbrMetallicRoughness.roughnessFactor); + Assert.AreEqual(0f, material.pbrMetallicRoughness.metallicFactor); +#else + Assert.Ignore("Texture export is disabled! " + LogMessages.GetFullMessage(LogCode.ImageConversionNotEnabled)); +#endif + } + + protected void MetallicTest(RenderPipeline renderPipeline) + { + var material = ConvertMaterial("Metallic", out _, renderPipeline); + Assert.IsNotNull(material.pbrMetallicRoughness); + Assert.AreEqual(.89f, material.pbrMetallicRoughness.metallicFactor); + } + + protected void MetallicTextureTest(RenderPipeline renderPipeline) + { +#if UNITY_IMAGECONVERSION + var material = ConvertMaterial("MetallicTexture", out var gltfWriter, renderPipeline); + + Assert.AreEqual(1, gltfWriter.imageExports.Count); + Assert.AreEqual(0, gltfWriter.samplers.Count); + Assert.AreEqual(1, gltfWriter.textures.Count); + Assert.IsInstanceOf(gltfWriter.imageExports[0]); + + Assert.IsNotNull(material.pbrMetallicRoughness); + Assert.AreEqual(1f, material.pbrMetallicRoughness.metallicFactor); + + var mrTexture = material.pbrMetallicRoughness?.metallicRoughnessTexture; + Assert.NotNull(mrTexture); + + var transform = mrTexture.extensions?.KHR_texture_transform; + Assert.IsNotNull(transform); + Assert.AreEqual(new[] { 2f, 2f }, transform.scale); +#else + Assert.Ignore("Texture export is disabled! " + LogMessages.GetFullMessage(LogCode.ImageConversionNotEnabled)); +#endif + } + + protected void MetallicRoughnessTextureTest(RenderPipeline renderPipeline) + { +#if UNITY_IMAGECONVERSION + var material = ConvertMaterial("MetallicRoughnessTexture", out var gltfWriter, renderPipeline); + + Assert.AreEqual(1, gltfWriter.imageExports.Count); + Assert.AreEqual(0, gltfWriter.samplers.Count); + Assert.AreEqual(1, gltfWriter.textures.Count); + Assert.IsInstanceOf(gltfWriter.imageExports[0]); + + Assert.IsNotNull(material.pbrMetallicRoughness); + Assert.AreEqual(1f, material.pbrMetallicRoughness.metallicFactor); + Assert.AreEqual(1f, material.pbrMetallicRoughness.roughnessFactor); + + var mrTexture = material.pbrMetallicRoughness?.metallicRoughnessTexture; + Assert.NotNull(mrTexture); +#else + Assert.Ignore("Texture export is disabled! " + LogMessages.GetFullMessage(LogCode.ImageConversionNotEnabled)); +#endif + } + + protected void MetallicRoughnessOcclusionTextureTest(RenderPipeline renderPipeline) + { +#if UNITY_IMAGECONVERSION + var material = ConvertMaterial("MetallicRoughnessOcclusionTexture", out var gltfWriter, renderPipeline); + + Assert.AreEqual(1, gltfWriter.imageExports.Count); + Assert.AreEqual(0, gltfWriter.samplers.Count); + Assert.AreEqual(1, gltfWriter.textures.Count); + Assert.IsInstanceOf(gltfWriter.imageExports[0]); + + var mrTexture = material.pbrMetallicRoughness?.metallicRoughnessTexture; + Assert.NotNull(mrTexture); + + var oTexture = material.occlusionTexture; + Assert.NotNull(oTexture); + Assert.AreEqual(.8f, oTexture.strength); +#else + Assert.Ignore("Texture export is disabled! " + LogMessages.GetFullMessage(LogCode.ImageConversionNotEnabled)); +#endif + } + + protected void OcclusionTextureTest(RenderPipeline renderPipeline) + { +#if UNITY_IMAGECONVERSION + var material = ConvertMaterial("OcclusionTexture", out var gltfWriter, renderPipeline); + + Assert.AreEqual(1, gltfWriter.imageExports.Count); + Assert.AreEqual(0, gltfWriter.samplers.Count); + Assert.AreEqual(1, gltfWriter.textures.Count); + Assert.IsInstanceOf(gltfWriter.imageExports[0]); + + Assert.IsNotNull(material.pbrMetallicRoughness); + Assert.AreEqual(0f, material.pbrMetallicRoughness.metallicFactor); + + var oTexture = material.occlusionTexture; + Assert.NotNull(oTexture); + Assert.AreEqual(.8f, oTexture.strength); + + var transform = oTexture.extensions?.KHR_texture_transform; + Assert.IsNotNull(transform); + Assert.AreEqual(new[] { 2f, 2f }, transform.scale); +#else + Assert.Ignore("Texture export is disabled! " + LogMessages.GetFullMessage(LogCode.ImageConversionNotEnabled)); +#endif + } + + protected void EmissiveFactorTest(RenderPipeline renderPipeline) + { + var material = ConvertMaterial("EmissiveFactor", out _, renderPipeline); + + Assert.AreEqual(new Color(1, 1, 0), material.Emissive); + Assert.IsNull(material.emissiveTexture); + } + + protected void EmissiveTextureTest(RenderPipeline renderPipeline) + { +#if UNITY_IMAGECONVERSION + var material = ConvertMaterial("EmissiveTexture", out var gltfWriter, renderPipeline); + + Assert.AreEqual(1, gltfWriter.imageExports.Count); + Assert.AreEqual(0, gltfWriter.samplers.Count); + Assert.AreEqual(1, gltfWriter.textures.Count); + Assert.IsInstanceOf(gltfWriter.imageExports[0]); + + Assert.AreEqual(Color.white, material.Emissive); + + var texture = material.emissiveTexture; + Assert.NotNull(texture); + + Assert.IsNull(texture.extensions?.KHR_texture_transform); +#else + Assert.Ignore("Texture export is disabled! " + LogMessages.GetFullMessage(LogCode.ImageConversionNotEnabled)); +#endif + } + + protected void EmissiveTextureFactorTest(RenderPipeline renderPipeline) + { +#if UNITY_IMAGECONVERSION + var material = ConvertMaterial("EmissiveTextureFactor", out var gltfWriter, renderPipeline); + + Assert.AreEqual(1, gltfWriter.imageExports.Count); + Assert.AreEqual(0, gltfWriter.samplers.Count); + Assert.AreEqual(1, gltfWriter.textures.Count); + Assert.IsInstanceOf(gltfWriter.imageExports[0]); + + Assert.AreEqual(new Color(1, .7353569f, 0), material.Emissive); + + var texture = material.emissiveTexture; + Assert.NotNull(texture); + + var transform = texture.extensions?.KHR_texture_transform; + Assert.IsNotNull(transform); + Assert.AreEqual(new[] { 2f, 3f }, transform.scale); +#else + Assert.Ignore("Texture export is disabled! " + LogMessages.GetFullMessage(LogCode.ImageConversionNotEnabled)); +#endif + } + + protected void NormalTextureTest(RenderPipeline renderPipeline) + { +#if UNITY_IMAGECONVERSION + var material = ConvertMaterial("NormalTexture", out var gltfWriter, renderPipeline); + + Assert.AreEqual(1, gltfWriter.imageExports.Count); + Assert.AreEqual(0, gltfWriter.samplers.Count); + Assert.AreEqual(1, gltfWriter.textures.Count); + Assert.IsInstanceOf(gltfWriter.imageExports[0]); + + Assert.IsNotNull(material.pbrMetallicRoughness); + + var texture = material.normalTexture; + Assert.NotNull(texture); + Assert.AreEqual(1.1f, texture.scale); + + var transform = texture.extensions?.KHR_texture_transform; + Assert.IsNotNull(transform); + Assert.AreEqual(new[] { 1.5f, 1.2f }, transform.scale); + Assert.AreEqual(new[] { 0f, 0f }, transform.offset); + Assert.AreEqual(0, transform.rotation); +#else + Assert.Ignore("Texture export is disabled! " + LogMessages.GetFullMessage(LogCode.ImageConversionNotEnabled)); +#endif + } + + protected void NotGltfTest(RenderPipeline renderPipeline) + { + var material = ConvertMaterial("NotGltf", out _, renderPipeline); + Assert.IsNotNull(material); + } + + protected void OmniTest(RenderPipeline renderPipeline) + { +#if UNITY_IMAGECONVERSION + var material = ConvertMaterial("Omni", out var gltfWriter, renderPipeline); + + Assert.AreEqual(4, gltfWriter.imageExports.Count); + Assert.AreEqual(0, gltfWriter.samplers.Count); + Assert.AreEqual(4, gltfWriter.textures.Count); + Assert.IsInstanceOf(gltfWriter.imageExports[0]); + + Assert.IsNotNull(material.pbrMetallicRoughness); + Assert.AreEqual(new[] { .9f, .8f, .7f, 1 }, material.pbrMetallicRoughness.baseColorFactor); + var baseColorTexture = material.pbrMetallicRoughness.baseColorTexture; + Assert.IsNotNull(baseColorTexture); + Assert.AreEqual(0, baseColorTexture.index); + Assert.AreEqual(0, baseColorTexture.texCoord); + + Assert.AreEqual(1, gltfWriter.extensions.Count); + + var baseColorTransform = baseColorTexture.extensions?.KHR_texture_transform; + Assert.IsNotNull(baseColorTransform); + Assert.AreEqual(new[] { 0.4f, 0.6f }, baseColorTransform.offset); + Assert.AreEqual(new[] { 1f, 1f }, baseColorTransform.scale); + Assert.AreEqual(0, baseColorTransform.rotation); + + var mrTexture = material.pbrMetallicRoughness?.metallicRoughnessTexture; + Assert.NotNull(mrTexture); + + var mrTransform = mrTexture.extensions?.KHR_texture_transform; + Assert.IsNotNull(mrTransform); + Assert.AreEqual(new[] { 1.11f, 1.21f }, mrTransform.scale); + + var normalTexture = material.normalTexture; + Assert.NotNull(normalTexture); + Assert.AreEqual(0.42f, normalTexture.scale); + + var normalTransform = normalTexture.extensions?.KHR_texture_transform; + Assert.IsNotNull(normalTransform); + Assert.AreEqual(new[] { 1.5f, 1.2f }, normalTransform.scale); + Assert.AreEqual(new[] { 0f, 0f }, normalTransform.offset); + Assert.AreEqual(0, normalTransform.rotation); + + var oTexture = material.occlusionTexture; + Assert.NotNull(oTexture); + Assert.AreEqual(.58f, oTexture.strength); + + var oTransform = oTexture.extensions?.KHR_texture_transform; + Assert.IsNotNull(oTransform); + Assert.AreEqual(new[] { 1.1f, 1.2f }, oTransform.scale); +#else + Assert.Ignore("Texture export is disabled! " + LogMessages.GetFullMessage(LogCode.ImageConversionNotEnabled)); +#endif + } + + protected void AddImageFailTest(RenderPipeline renderPipeline) + { + const string name = "Omni"; + var gltfWriter = new GltfWritableMock(false); + var uMaterial = Resources.Load($"{GetResourcePath(renderPipeline)}{name}"); + Assert.IsNotNull(uMaterial); + var logger = new CollectingLogger(); + m_Exporter.ConvertMaterial(uMaterial, out var material, gltfWriter, logger); + Assert.IsNotNull(material); + LoggerTest.AssertLogger(logger); + } + + protected void DoubleSidedTest(RenderPipeline renderPipeline) + { + var material = ConvertMaterial("DoubleSided", out _, renderPipeline); + Assert.AreEqual(true, material.doubleSided); + } + + TextureInfo BaseColorTextureTest( + string name, + out GltfWritableMock gltfWriter, + RenderPipeline renderPipeline, + out Schema.Material material + ) + { + material = ConvertMaterial(name, out gltfWriter, renderPipeline); + + Assert.AreEqual(1, gltfWriter.imageExports.Count); + Assert.AreEqual(0, gltfWriter.samplers.Count); + Assert.AreEqual(1, gltfWriter.textures.Count); + Assert.IsInstanceOf(gltfWriter.imageExports[0]); + + Assert.IsNotNull(material.pbrMetallicRoughness); + Assert.AreEqual(new[] { .9f, .8f, .7f, 1 }, material.pbrMetallicRoughness.baseColorFactor); + var texture = material.pbrMetallicRoughness.baseColorTexture; + Assert.IsNotNull(texture); + Assert.AreEqual(0, texture.index); + Assert.AreEqual(0, texture.texCoord); + return texture; + } + + [OneTimeSetUp] + public void SetUp() + { + SetUpExporter(); + } + + protected abstract void SetUpExporter(); + + Schema.Material ConvertMaterial( + string name, + out GltfWritableMock gltfWriter, + RenderPipeline renderPipeline + ) + { + gltfWriter = new GltfWritableMock(); + var uMaterial = Resources.Load($"{GetResourcePath(renderPipeline)}{name}"); + Assert.IsNotNull(uMaterial); + var logger = new CollectingLogger(); + m_Exporter.ConvertMaterial(uMaterial, out var material, gltfWriter, logger); + Assert.IsNotNull(material); + LoggerTest.AssertLogger(logger); + return material; + } + + static string GetResourcePath(RenderPipeline renderPipeline) + { + switch (renderPipeline) + { + case RenderPipeline.BuiltIn: + return $"{k_ResourcePath}Built-In/"; + case RenderPipeline.Universal: + return $"{k_ResourcePath}URP/"; + case RenderPipeline.HighDefinition: + return $"{k_ResourcePath}HDRP/"; + case RenderPipeline.Unknown: + default: + throw new ArgumentOutOfRangeException(nameof(renderPipeline), renderPipeline, null); + } + } + } +} diff --git a/Tests/Runtime/Scripts/Export/MaterialExportTests.cs.meta b/Tests/Runtime/Scripts/Export/MaterialExportTests.cs.meta new file mode 100644 index 00000000..908c6f7e --- /dev/null +++ b/Tests/Runtime/Scripts/Export/MaterialExportTests.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 43b15ecc8a67143a9a11dd6b2ae3fb5c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Runtime/Scripts/LoggerTest.cs b/Tests/Runtime/Scripts/LoggerTest.cs index 0c3941f7..b903970f 100644 --- a/Tests/Runtime/Scripts/LoggerTest.cs +++ b/Tests/Runtime/Scripts/LoggerTest.cs @@ -123,6 +123,11 @@ public static void TestLogItemEquals() Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode()); } + internal static void AssertLogger(CollectingLogger logger) + { + AssertLogCodes(logger.Items, null); + } + internal static void AssertLogger(CollectingLogger logger, IEnumerable expectedLogCodes) { AssertLogCodes(logger.Items, expectedLogCodes); @@ -130,42 +135,52 @@ internal static void AssertLogger(CollectingLogger logger, IEnumerable internal static void AssertLogCodes(IEnumerable logItems, IEnumerable expectedLogCodes) { - var expectedLogCodeFound = new Dictionary(); - foreach (var logCode in expectedLogCodes) + Dictionary expectedLogCodeFound = null; + if (expectedLogCodes != null) { - expectedLogCodeFound[logCode] = false; + expectedLogCodeFound = new Dictionary(); + foreach (var logCode in expectedLogCodes) + { + expectedLogCodeFound[logCode] = false; + } } - foreach (var item in logItems) + if (logItems != null) { - switch (item.Type) + foreach (var item in logItems) { - case LogType.Assert: - case LogType.Error: - case LogType.Exception: - if (expectedLogCodeFound.Keys.Contains(item.Code)) - { - expectedLogCodeFound[item.Code] = true; - // Informal log - Debug.LogFormat(LogType.Log, LogOption.NoStacktrace, null, item.ToString()); - } - else - { + switch (item.Type) + { + case LogType.Assert: + case LogType.Error: + case LogType.Exception: + if (expectedLogCodeFound?.Keys.Contains(item.Code) == true) + { + expectedLogCodeFound[item.Code] = true; + // Informal log + Debug.LogFormat(LogType.Log, LogOption.NoStacktrace, null, item.ToString()); + } + else + { + item.Log(); + throw new AssertionException($"Unhandled {item.Type} message {item} ({item.Code})."); + } + break; + case LogType.Warning: + case LogType.Log: + default: item.Log(); - throw new AssertionException($"Unhandled {item.Type} message {item} ({item.Code})."); - } - break; - case LogType.Warning: - case LogType.Log: - default: - item.Log(); - break; + break; + } } } - foreach (var b in expectedLogCodeFound.Where(b => !b.Value)) + if (expectedLogCodeFound != null) { - throw new AssertionException($"Missing expected log message {b.Key}."); + foreach (var b in expectedLogCodeFound.Where(b => !b.Value)) + { + throw new AssertionException($"Missing expected log message {b.Key}."); + } } } diff --git a/Tests/Runtime/Scripts/glTFast.Tests.asmdef b/Tests/Runtime/Scripts/glTFast.Tests.asmdef index 6589af2b..52fc8710 100644 --- a/Tests/Runtime/Scripts/glTFast.Tests.asmdef +++ b/Tests/Runtime/Scripts/glTFast.Tests.asmdef @@ -60,7 +60,27 @@ "name": "com.unity.test-framework.performance", "expression": "3", "define": "UNITY_PERFORMANCE_TESTS" + }, + { + "name": "com.unity.modules.imageconversion", + "expression": "", + "define": "UNITY_IMAGECONVERSION" + }, + { + "name": "com.unity.shadergraph", + "expression": "", + "define": "UNITY_SHADER_GRAPH" + }, + { + "name": "com.unity.render-pipelines.universal", + "expression": "", + "define": "USING_URP" + }, + { + "name": "com.unity.render-pipelines.universal", + "expression": "12", + "define": "USING_URP_12_OR_NEWER" } ], "noEngineReferences": false -} \ No newline at end of file +} From d8fb525f1520230e81b7880d2c1819cea1fff6b7 Mon Sep 17 00:00:00 2001 From: Andreas Atteneder Date: Tue, 7 May 2024 15:02:11 +0200 Subject: [PATCH 07/18] doc: Export sample code (#136) * chore: Added missing license header to samples. * feat: Added export sample code. * doc: Replaced export sample code embedded within markdown with references to actual scripts. * doc: Unified style of "Note" blocks * doc: Added many links to the scripting API. --- CHANGELOG.md | 1 + Documentation~/ExportRuntime.md | 122 ++---------------- .../Documentation/Manual/CustomGltfImport.cs | 3 + Samples/Documentation/Manual/ExportSamples.cs | 97 ++++++++++++++ .../Manual/ExportSamples.cs.meta | 11 ++ Samples/Documentation/Manual/ExtraData.cs | 3 + Samples/Documentation/Manual/SimpleExport.cs | 38 ++++++ .../Documentation/Manual/SimpleExport.cs.meta | 11 ++ .../Unity.Cloud.Gltfast.Documentation.asmdef | 1 + 9 files changed, 177 insertions(+), 110 deletions(-) create mode 100644 Samples/Documentation/Manual/ExportSamples.cs create mode 100644 Samples/Documentation/Manual/ExportSamples.cs.meta create mode 100644 Samples/Documentation/Manual/SimpleExport.cs create mode 100644 Samples/Documentation/Manual/SimpleExport.cs.meta diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f044bc8..e7bf6e9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - (Export) Support for exporting glTFast shader based materials. This reduces data loss on import-export round trips considerably. - Dependency on [Unity Collections package][Collections]. - Added Apple Privacy Manifest documentation. +- Export sample code. ### Changed - Faster buffer conversion jobs due to batching via [`IJobParallelForBatch`](https://docs.unity3d.com/Packages/com.unity.collections@2.4/api/Unity.Jobs.IJobParallelForBatch.html). diff --git a/Documentation~/ExportRuntime.md b/Documentation~/ExportRuntime.md index 057b582e..6e618095 100644 --- a/Documentation~/ExportRuntime.md +++ b/Documentation~/ExportRuntime.md @@ -10,132 +10,33 @@ The easiest way to include them is to add `glTFExport.shadervariants` to the lis ## Export via Script -> Note: The `GLTFast.Export` namespace can only be used if you reference both `glTFast` and `glTFast.Export` Assemblies in your [Assembly Definition][asmdef]. +> **NOTE:** The `GLTFast.Export` namespace can only be used if you reference both `glTFast` and `glTFast.Export` Assemblies in your [Assembly Definition][asmdef]. Here's a step-by-step guide to export a GameObject hierarchy/scene from script -- Create an instance of `GLTFast.Export.GameObjectExport` -- Add content via `AddScene` +- Create an instance of [GameObjectExport](xref:GLTFast.Export.GameObjectExport) +- Add content via [AddScene](xref:GLTFast.Export.GameObjectExport.AddScene*) - Two options for the final export - - Call `SaveToFileAndDispose` to export a glTF to a file(s) - - Call `SaveToStreamAndDispose` to export to a `System.IO.Stream` + - Call [SaveToFileAndDispose](xref:GLTFast.Export.GameObjectExport.SaveToFileAndDispose*) to export a glTF to a file(s) + - Call [SaveToStreamAndDispose](xref:GLTFast.Export.GameObjectExport.SaveToStreamAndDispose*) to export to a [Stream][Stream] glTF export might create more than one file. For example the binary buffer is usually a separate `.bin` file and textures might be separate files as well. -```c# -using UnityEngine; -using GLTFast.Export; +[!code-cs [simple-export](../Samples/Documentation/Manual/SimpleExport.cs#SimpleExport)] -public class TestExport : MonoBehaviour { +After calling [SaveToFileAndDispose](xref:GLTFast.Export.GameObjectExport.SaveToFileAndDispose*) the GameObjectExport instance becomes invalid. Do not re-use it. - [SerializeField] - string path; +Further, the export can be customized by passing [ExportSettings](xref:GLTFast.Export.ExportSettings), [GameObjectExportSettings](xref:GLTFast.Export.GameObjectExportSettings) and injectables to [GameObjectExport](xref:GLTFast.Export.GameObjectExport)'s constructor: - async void SimpleExport() { +[!code-cs [advanced-export](../Samples/Documentation/Manual/ExportSamples.cs#AdvancedExport)] - // Example of gathering GameObjects to be exported (recursively) - var rootLevelNodes = GameObject.FindGameObjectsWithTag("ExportMe"); - - // GameObjectExport lets you create glTFs from GameObject hierarchies - var export = new GameObjectExport(); - - // Add a scene - export.AddScene(rootLevelNodes); - - // Async glTF export - bool success = await export.SaveToFileAndDispose(path); - - if(!success) { - Debug.LogError("Something went wrong exporting a glTF"); - } - } -} -``` - -After calling `SaveToFileAndDispose` the GameObjectExport instance becomes invalid. Do not re-use it. - -Further, the export can be customized by passing `ExportSettings`, `GameObjectExportSettings` and injectables to the `GameObjectExport`'s -constructor: - -```c# -using GLTFast; -using UnityEngine; -using GLTFast.Export; -using GLTFast.Logging; - -public class TestExport : MonoBehaviour { - - [SerializeField] - string path; - - async void AdvancedExport() { - - // CollectingLogger lets you programmatically go through - // errors and warnings the export raised - var logger = new CollectingLogger(); - - // ExportSettings and GameObjectExportSettings allow you to configure the export - // Check their respective source for details - - // ExportSettings provides generic export settings - var exportSettings = new ExportSettings { - Format = GltfFormat.Binary, - FileConflictResolution = FileConflictResolution.Overwrite, - // Export everything except cameras or animation - ComponentMask = ~(ComponentType.Camera | ComponentType.Animation), - // Boost light intensities - LightIntensityFactor = 100f, - }; - - // GameObjectExportSettings provides settings specific to a GameObject/Component based hierarchy - var gameObjectExportSettings = new GameObjectExportSettings { - // Include inactive GameObjects in export - OnlyActiveInHierarchy = false, - // Also export disabled components - DisabledComponents = true, - // Only export GameObjects on certain layers - LayerMask = LayerMask.GetMask("Default", "MyCustomLayer"), - }; - - // GameObjectExport lets you create glTFs from GameObject hierarchies - var export = new GameObjectExport( exportSettings, gameObjectExportSettings, logger: logger); - - // Example of gathering GameObjects to be exported (recursively) - var rootLevelNodes = GameObject.FindGameObjectsWithTag("ExportMe"); - - // Add a scene - export.AddScene(rootLevelNodes, "My new glTF scene"); - - // Async glTF export - var success = await export.SaveToFileAndDispose(path); - - if(!success) { - Debug.LogError("Something went wrong exporting a glTF"); - // Log all exporter messages - logger.LogAll(); - } - } -} -``` - -> Exporting to a `Stream` currently only works for self-contained glTF-Binary files (where the binary buffer and all textures are included in the `.glb` file). Trying other export settings will fail. +> **NOTE:** Exporting to a [Stream][Stream] currently only works for self-contained glTF-Binary files (where the binary buffer and all textures are included in the `.glb` file). Trying other export settings will fail. ### Draco Compression *Unity glTFast* supports applying [Google Draco™ 3D Data compression][Draco] to meshes. This requires the [Draco for Unity][DracoForUnity] package to be installed. -```csharp -// ExportSettings provides generic export settings -var exportSettings = new ExportSettings { - ... - // Enable Draco compression - Compression = Compression.Draco, - // Tweak the Draco compression settings - DracoSettings = new DracoExportSettings { - positionQuantization = 12 - } -}; -``` +[!code-cs [draco-export](../Samples/Documentation/Manual/ExportSamples.cs#ExportSettingsDraco)] ## Trademarks @@ -151,3 +52,4 @@ var exportSettings = new ExportSettings { [GoogleLLC]: https://about.google/ [khronos]: https://www.khronos.org [unity]: https://unity.com +[Stream]: https://learn.microsoft.com/en-us/dotnet/api/system.io.stream diff --git a/Samples/Documentation/Manual/CustomGltfImport.cs b/Samples/Documentation/Manual/CustomGltfImport.cs index 5ce6da08..23ea5556 100644 --- a/Samples/Documentation/Manual/CustomGltfImport.cs +++ b/Samples/Documentation/Manual/CustomGltfImport.cs @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 Unity Technologies and the glTFast authors +// SPDX-License-Identifier: Apache-2.0 + #if NEWTONSOFT_JSON namespace Samples.Documentation.Manual { diff --git a/Samples/Documentation/Manual/ExportSamples.cs b/Samples/Documentation/Manual/ExportSamples.cs new file mode 100644 index 00000000..6d84df46 --- /dev/null +++ b/Samples/Documentation/Manual/ExportSamples.cs @@ -0,0 +1,97 @@ +// SPDX-FileCopyrightText: 2024 Unity Technologies and the glTFast authors +// SPDX-License-Identifier: Apache-2.0 + +using UnityEngine.Serialization; + +namespace Samples.Documentation.Manual +{ + using UnityEngine; + using GLTFast; + using GLTFast.Export; + using GLTFast.Logging; + + public class ExportSamples : MonoBehaviour + { + + [FormerlySerializedAs("path")] + [SerializeField] + string destinationFilePath; + + async void AdvancedExport() + { + #region AdvancedExport + + // CollectingLogger lets you programmatically go through + // errors and warnings the export raised + var logger = new CollectingLogger(); + + // ExportSettings and GameObjectExportSettings allow you to configure the export + // Check their respective source for details + + // ExportSettings provides generic export settings + var exportSettings = new ExportSettings + { + Format = GltfFormat.Binary, + FileConflictResolution = FileConflictResolution.Overwrite, + + // Export everything except cameras or animation + ComponentMask = ~(ComponentType.Camera | ComponentType.Animation), + + // Boost light intensities + LightIntensityFactor = 100f, + }; + + // GameObjectExportSettings provides settings specific to a GameObject/Component based hierarchy + var gameObjectExportSettings = new GameObjectExportSettings + { + // Include inactive GameObjects in export + OnlyActiveInHierarchy = false, + + // Also export disabled components + DisabledComponents = true, + + // Only export GameObjects on certain layers + LayerMask = LayerMask.GetMask("Default", "MyCustomLayer"), + }; + + // GameObjectExport lets you create glTFs from GameObject hierarchies + var export = new GameObjectExport(exportSettings, gameObjectExportSettings, logger: logger); + + // Example of gathering GameObjects to be exported (recursively) + var rootLevelNodes = GameObject.FindGameObjectsWithTag("ExportMe"); + + // Add a scene + export.AddScene(rootLevelNodes, "My new glTF scene"); + + // Async glTF export + var success = await export.SaveToFileAndDispose(destinationFilePath); + + if (!success) + { + Debug.LogError("Something went wrong exporting a glTF"); + + // Log all exporter messages + logger.LogAll(); + } + + #endregion + } + + void ExportSettingsDraco() + { + #region ExportSettingsDraco + // ExportSettings provides generic export settings + var exportSettings = new ExportSettings + { + // Enable Draco compression + Compression = Compression.Draco, + // Optional: Tweak the Draco compression settings + DracoSettings = new DracoExportSettings + { + positionQuantization = 12 + } + }; + #endregion + } + } +} diff --git a/Samples/Documentation/Manual/ExportSamples.cs.meta b/Samples/Documentation/Manual/ExportSamples.cs.meta new file mode 100644 index 00000000..c6132ce1 --- /dev/null +++ b/Samples/Documentation/Manual/ExportSamples.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3bc95897a165b435a9df9b8dabd3f67b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Samples/Documentation/Manual/ExtraData.cs b/Samples/Documentation/Manual/ExtraData.cs index 43028ddd..ac42ca84 100644 --- a/Samples/Documentation/Manual/ExtraData.cs +++ b/Samples/Documentation/Manual/ExtraData.cs @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 Unity Technologies and the glTFast authors +// SPDX-License-Identifier: Apache-2.0 + namespace Samples.Documentation.Manual { diff --git a/Samples/Documentation/Manual/SimpleExport.cs b/Samples/Documentation/Manual/SimpleExport.cs new file mode 100644 index 00000000..ee27b58c --- /dev/null +++ b/Samples/Documentation/Manual/SimpleExport.cs @@ -0,0 +1,38 @@ +// SPDX-FileCopyrightText: 2024 Unity Technologies and the glTFast authors +// SPDX-License-Identifier: Apache-2.0 + +namespace Samples.Documentation.Manual +{ + #region SimpleExport + using UnityEngine; + using GLTFast.Export; + + public class SimpleExport : MonoBehaviour + { + + [SerializeField] + string destinationFilePath; + + async void Start() + { + + // Example of gathering GameObjects to be exported (recursively) + var rootLevelNodes = GameObject.FindGameObjectsWithTag("ExportMe"); + + // GameObjectExport lets you create glTF files from GameObject hierarchies + var export = new GameObjectExport(); + + // Add a scene + export.AddScene(rootLevelNodes); + + // Async glTF export + var success = await export.SaveToFileAndDispose(destinationFilePath); + + if (!success) + { + Debug.LogError("Something went wrong exporting a glTF"); + } + } + } + #endregion +} diff --git a/Samples/Documentation/Manual/SimpleExport.cs.meta b/Samples/Documentation/Manual/SimpleExport.cs.meta new file mode 100644 index 00000000..908acf62 --- /dev/null +++ b/Samples/Documentation/Manual/SimpleExport.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0515018949e5443cfa8e0ac0ea8b3f6d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Samples/Documentation/Unity.Cloud.Gltfast.Documentation.asmdef b/Samples/Documentation/Unity.Cloud.Gltfast.Documentation.asmdef index 378bf6cb..0eaff2e5 100644 --- a/Samples/Documentation/Unity.Cloud.Gltfast.Documentation.asmdef +++ b/Samples/Documentation/Unity.Cloud.Gltfast.Documentation.asmdef @@ -3,6 +3,7 @@ "rootNamespace": "", "references": [ "glTFast", + "glTFast.Export", "glTFast.Newtonsoft" ], "includePlatforms": [], From 4568b75e9900c0d910cbb79796dcaca079a10be7 Mon Sep 17 00:00:00 2001 From: Andreas Atteneder Date: Tue, 7 May 2024 19:57:52 +0200 Subject: [PATCH 08/18] feat(export): Don't export unused vertex attributes. (#134) * feat: Vertex attributes are discarded if they are not used/referenced. * chore: Updated export references. * chore: Added missing license header to samples. * feat: Added export sample code. * doc: Added code sample for `ExportSettings.PreservedVertexAttributes`. * doc: Added docs about vertex attribute discarding. * fix: Exclude samples and test classes from public API and docs generation. * feat(test): Test all VertexAttribute conversions. --- CHANGELOG.md | 4 + Documentation~/ExportRuntime.md | 14 + Documentation~/filter.yml | 6 + Runtime/Scripts/Export/ExportJobs.cs | 46 +++- Runtime/Scripts/Export/ExportSettings.cs | 6 + Runtime/Scripts/Export/GameObjectExport.cs | 4 +- Runtime/Scripts/Export/GltfWriter.cs | 245 ++++++++++++++++-- Runtime/Scripts/Export/IGltfWritable.cs | 12 + .../Scripts/Export/VertexAttributeUsage.cs | 87 +++++++ .../Export/VertexAttributeUsage.cs.meta | 3 + Runtime/Scripts/Logging/LogMessages.cs | 5 + Samples/Documentation/Manual/ExportSamples.cs | 6 +- Samples/Documentation/Manual/ExtraData.cs | 2 +- Samples/Documentation/Manual/SimpleExport.cs | 2 +- Tests/Resources/ExportTargets/Bounds.gltf.txt | 2 +- .../ExportTargets/BoxVertexColors.gltf.txt | 2 +- .../ExportTargets/ClearcoatFactor.gltf.txt | 2 +- .../ExportTargets/ClearcoatTexture.gltf.txt | 2 +- .../HDRP/BoxVertexColors.gltf.txt | 2 +- .../HierarchyComponentsDisabled.gltf.txt | 2 +- .../HierarchyEditorOnlyTag.gltf.txt | 2 +- .../HierarchyObjectsInactive.gltf.txt | 2 +- .../ExportTargets/NoMaterial.gltf.txt | 2 +- .../URP/ClearcoatFactor.gltf.txt | 2 +- .../URP/ClearcoatTexture.gltf.txt | 2 +- Tests/Runtime/Scripts/Export/ExportTests.cs | 2 +- .../Scripts/Export/GltfWritableMock.cs | 5 + .../Runtime/Scripts/Export/GltfWriterTests.cs | 2 +- .../SceneRootObjectTestCaseAttribute.cs | 2 +- .../Export/VertexAttributeUsageTests.cs | 33 +++ .../Export/VertexAttributeUsageTests.cs.meta | 11 + Tests/Runtime/Scripts/JobTests.cs | 20 +- 32 files changed, 474 insertions(+), 65 deletions(-) create mode 100644 Runtime/Scripts/Export/VertexAttributeUsage.cs create mode 100644 Runtime/Scripts/Export/VertexAttributeUsage.cs.meta create mode 100644 Tests/Runtime/Scripts/Export/VertexAttributeUsageTests.cs create mode 100644 Tests/Runtime/Scripts/Export/VertexAttributeUsageTests.cs.meta diff --git a/CHANGELOG.md b/CHANGELOG.md index e7bf6e9e..527dfd7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Faster buffer conversion jobs due to batching via [`IJobParallelForBatch`](https://docs.unity3d.com/Packages/com.unity.collections@2.4/api/Unity.Jobs.IJobParallelForBatch.html). +- (Export) Vertex attributes are discarded if they are not used/referenced. + +### Fixed +- (Export) Discrepancy in color due to export of unused vertex colors. ### Removed - Soft dependency on deprecated [Unity Jobs package][JobsPkg]. diff --git a/Documentation~/ExportRuntime.md b/Documentation~/ExportRuntime.md index 6e618095..deef4709 100644 --- a/Documentation~/ExportRuntime.md +++ b/Documentation~/ExportRuntime.md @@ -32,6 +32,20 @@ Further, the export can be customized by passing [ExportSettings](xref:GLTFast.E > **NOTE:** Exporting to a [Stream][Stream] currently only works for self-contained glTF-Binary files (where the binary buffer and all textures are included in the `.glb` file). Trying other export settings will fail. +### Vertex Attribute Discarding + +In certain cases glTFast discards mesh vertex attributes that are not used or required. This not only reduces the resulting glTF's file size, but in case of vertex colors, is necessary to preserve visual consistency. + +This behavior might be undesirable, for example in authoring workflows where the resulting glTF will be further edited. In that case vertex attribute discarding can be disabled on a per-attribute basis by setting [ExportSettings' PreservedVertexAttributes](xref:GLTFast.Export.ExportSettings.PreservedVertexAttributes) mask. + +Examples of vertex attribute discarding: + +- Vertex colors, when the assigned material(s) do not use them. +- Normals and tangents, when the assigned material is unlit and does not require them for shading. +- When no material was assigned, a default fallback material will be assumed. This does not require tangents nor texture coordinates, hence those are discarded. + +> **NOTE:** Not all cases of potential discarding are covered at the moment (e.g. unused texture coordinates when no textures are assigned). + ### Draco Compression *Unity glTFast* supports applying [Google Draco™ 3D Data compression][Draco] to meshes. This requires the [Draco for Unity][DracoForUnity] package to be installed. diff --git a/Documentation~/filter.yml b/Documentation~/filter.yml index 65ab908b..07beaff6 100644 --- a/Documentation~/filter.yml +++ b/Documentation~/filter.yml @@ -3,3 +3,9 @@ apiRules: hasAttribute: uid: System.ObsoleteAttribute type: Type + - exclude: + uidRegex: ^GLTFast\.Tests\..*$ + type: Namespace + - exclude: + uidRegex: ^Samples\..*$ + type: Namespace diff --git a/Runtime/Scripts/Export/ExportJobs.cs b/Runtime/Scripts/Export/ExportJobs.cs index 861f3ffb..28d99263 100644 --- a/Runtime/Scripts/Export/ExportJobs.cs +++ b/Runtime/Scripts/Export/ExportJobs.cs @@ -1,6 +1,7 @@ // SPDX-FileCopyrightText: 2023 Unity Technologies and the glTFast authors // SPDX-License-Identifier: Apache-2.0 +using GLTFast.Jobs; using Unity.Burst; using Unity.Collections; using Unity.Collections.LowLevel.Unsafe; @@ -60,7 +61,8 @@ public void Execute(int i) public unsafe struct ConvertPositionFloatJob : IJobParallelFor { - public uint byteStride; + public uint inputByteStride; + public uint outputByteStride; [ReadOnly] [NativeDisableUnsafePtrRestriction] @@ -72,8 +74,8 @@ public unsafe struct ConvertPositionFloatJob : IJobParallelFor public void Execute(int i) { - var inPtr = (float3*)(input + i * byteStride); - var outPtr = (float3*)(output + i * byteStride); + var inPtr = (float3*)(input + i * inputByteStride); + var outPtr = (float3*)(output + i * outputByteStride); var tmp = *inPtr; tmp.x *= -1; @@ -85,7 +87,8 @@ public void Execute(int i) public unsafe struct ConvertTangentFloatJob : IJobParallelFor { - public uint byteStride; + public uint inputByteStride; + public uint outputByteStride; [ReadOnly] [NativeDisableUnsafePtrRestriction] @@ -97,8 +100,8 @@ public unsafe struct ConvertTangentFloatJob : IJobParallelFor public void Execute(int i) { - var inPtr = (float4*)(input + i * byteStride); - var outPtr = (float4*)(output + i * byteStride); + var inPtr = (float4*)(input + i * inputByteStride); + var outPtr = (float4*)(output + i * outputByteStride); var tmp = *inPtr; tmp.z *= -1; @@ -109,7 +112,8 @@ public void Execute(int i) [BurstCompile] public unsafe struct ConvertTexCoordFloatJob : IJobParallelFor { - public uint byteStride; + public uint inputByteStride; + public uint outputByteStride; [ReadOnly] [NativeDisableUnsafePtrRestriction] @@ -121,13 +125,37 @@ public unsafe struct ConvertTexCoordFloatJob : IJobParallelFor public void Execute(int i) { - var inPtr = (float2*)(input + i * byteStride); - var outPtr = (float2*)(output + i * byteStride); + var inPtr = (float2*)(input + i * inputByteStride); + var outPtr = (float2*)(output + i * outputByteStride); var tmp = *inPtr; tmp.y = 1 - tmp.y; *outPtr = tmp; } } + + [BurstCompile] + public unsafe struct ConvertGenericJob : IJobParallelFor + { + public uint inputByteStride; + public uint outputByteStride; + + public uint byteLength; + + [ReadOnly] + [NativeDisableUnsafePtrRestriction] + public byte* input; + + [WriteOnly] + [NativeDisableUnsafePtrRestriction] + public byte* output; + + public void Execute(int i) + { + var inPtr = input + i * inputByteStride; + var outPtr = output + i * outputByteStride; + UnsafeUtility.MemCpy(outPtr, inPtr, byteLength); + } + } } } diff --git a/Runtime/Scripts/Export/ExportSettings.cs b/Runtime/Scripts/Export/ExportSettings.cs index 19dce23f..4081f2f0 100644 --- a/Runtime/Scripts/Export/ExportSettings.cs +++ b/Runtime/Scripts/Export/ExportSettings.cs @@ -114,5 +114,11 @@ public class ExportSettings /// This can be a requirement for certain asset pipelines or automated tests. /// public bool Deterministic { get; set; } + + /// + /// Controls which vertex attributes are preserved during export, regardless whether they are used/referenced + /// or not. By default, unused attributes are discarded. + /// + public VertexAttributeUsage PreservedVertexAttributes { get; set; } = VertexAttributeUsage.None; } } diff --git a/Runtime/Scripts/Export/GameObjectExport.cs b/Runtime/Scripts/Export/GameObjectExport.cs index 7d2ab3d4..0817eb62 100644 --- a/Runtime/Scripts/Export/GameObjectExport.cs +++ b/Runtime/Scripts/Export/GameObjectExport.cs @@ -184,6 +184,7 @@ void AddNodeComponents(GameObject gameObject, List tempMaterials, int { tempMaterials.Clear(); Mesh mesh = null; + var skinning = false; if (gameObject.TryGetComponent(out MeshFilter meshFilter)) { if (gameObject.TryGetComponent(out Renderer renderer)) @@ -203,6 +204,7 @@ void AddNodeComponents(GameObject gameObject, List tempMaterials, int mesh = smr.sharedMesh; smr.GetSharedMaterials(tempMaterials); } + skinning = true; } var materialIds = new int[tempMaterials.Count]; @@ -221,7 +223,7 @@ void AddNodeComponents(GameObject gameObject, List tempMaterials, int if (mesh != null) { - m_Writer.AddMeshToNode(nodeId, mesh, materialIds); + m_Writer.AddMeshToNode(nodeId, mesh, materialIds, skinning); } if (gameObject.TryGetComponent(out Camera camera)) diff --git a/Runtime/Scripts/Export/GltfWriter.cs b/Runtime/Scripts/Export/GltfWriter.cs index b6a1d2e6..fb572ae5 100755 --- a/Runtime/Scripts/Export/GltfWriter.cs +++ b/Runtime/Scripts/Export/GltfWriter.cs @@ -58,6 +58,7 @@ struct AttributeData public int stream; public int offset; public int accessorId; + public int size; } const int k_MAXStreamCount = 4; @@ -90,6 +91,7 @@ struct AttributeData List m_SamplerKeys; List m_UnityMaterials; List m_UnityMeshes; + List m_MeshVertexAttributeUsage; Dictionary m_NodeMaterials; Stream m_BufferStream; @@ -134,19 +136,58 @@ public uint AddNode( } /// + [Obsolete("Use overload with skinning parameter.")] public void AddMeshToNode(int nodeId, UnityEngine.Mesh uMesh, int[] materialIds) + { + AddMeshToNode(nodeId, uMesh, materialIds, true); + } + + /// + public void AddMeshToNode(int nodeId, UnityEngine.Mesh uMesh, int[] materialIds, bool skinning) { if ((m_Settings.ComponentMask & ComponentType.Mesh) == 0) return; CertifyNotDisposed(); var node = m_Nodes[nodeId]; + // Always export positions. + var attributeUsage = VertexAttributeUsage.Position; + var noMaterialAssigned = false; + if (materialIds != null && materialIds.Length > 0) { - m_NodeMaterials = m_NodeMaterials ?? new Dictionary(); + m_NodeMaterials ??= new Dictionary(); m_NodeMaterials[nodeId] = materialIds; + + foreach (var materialId in materialIds) + { + if (materialId < 0) + { + noMaterialAssigned = true; + } + else + { + var usage = GetVertexAttributeUsage(m_UnityMaterials[materialId].shader); + if (!skinning) + { + usage &= ~VertexAttributeUsage.Skinning; + } + attributeUsage |= usage; + } + } + } + else + { + noMaterialAssigned = true; + } + + if (noMaterialAssigned) + { + // No material. + // This means the default material will be assigned, which requires positions, normals and colors. + attributeUsage |= VertexAttributeUsage.Normal | VertexAttributeUsage.Color; } - node.mesh = AddMesh(uMesh); + node.mesh = AddMesh(uMesh, attributeUsage); } /// @@ -836,9 +877,11 @@ async Task BakeMesh(int meshId, UnityEngine.Mesh.MeshData meshData) var mesh = m_Meshes[meshId]; var uMesh = m_UnityMeshes[meshId]; + var vertexAttributeUsage = m_Settings.PreservedVertexAttributes | m_MeshVertexAttributeUsage[meshId]; var vertexAttributes = uMesh.GetVertexAttributes(); - var strides = new int[k_MAXStreamCount]; + var inputStrides = new int[k_MAXStreamCount]; + var outputStrides = new int[k_MAXStreamCount]; var alignments = new int[k_MAXStreamCount]; var attributes = new Attributes(); @@ -854,17 +897,29 @@ async Task BakeMesh(int meshId, UnityEngine.Mesh.MeshData meshData) continue; } + var excludeAttribute = (attribute.attribute.ToVertexAttributeUsage() & vertexAttributeUsage) == VertexAttributeUsage.None; + + var attributeSize = GetAttributeSize(attribute.format); + var attrData = new AttributeData { - offset = strides[attribute.stream], - stream = attribute.stream + offset = inputStrides[attribute.stream], + stream = attribute.stream, + size = attribute.dimension * attributeSize }; - var attributeSize = GetAttributeSize(attribute.format); - var size = attribute.dimension * attributeSize; - strides[attribute.stream] += size; + inputStrides[attribute.stream] += attrData.size; alignments[attribute.stream] = math.max(alignments[attribute.stream], attributeSize); + if (excludeAttribute) + { + continue; + } + else + { + outputStrides[attribute.stream] += attrData.size; + } + // Adhere data alignment rules Assert.IsTrue(attrData.offset % 4 == 0); @@ -942,9 +997,9 @@ async Task BakeMesh(int meshId, UnityEngine.Mesh.MeshData meshData) } var streamCount = 1; - for (var stream = 0; stream < strides.Length; stream++) + for (var stream = 0; stream < outputStrides.Length; stream++) { - var stride = strides[stream]; + var stride = outputStrides[stream]; if (stride <= 0) continue; streamCount = stream + 1; } @@ -1120,7 +1175,7 @@ async Task BakeMesh(int meshId, UnityEngine.Mesh.MeshData meshData) for (var stream = 0; stream < streamCount; stream++) { inputStreams[stream] = meshData.GetVertexData(stream); - outputStreams[stream] = new NativeArray(inputStreams[stream], Allocator.TempJob); + outputStreams[stream] = new NativeArray(outputStrides[stream] * vertexCount, Allocator.TempJob); } foreach (var pair in attrDataDict) @@ -1133,7 +1188,8 @@ async Task BakeMesh(int meshId, UnityEngine.Mesh.MeshData meshData) case VertexAttribute.Normal: await ConvertPositionAttribute( attrData, - (uint)strides[attrData.stream], + (uint)inputStrides[attrData.stream], + (uint)outputStrides[attrData.stream], vertexCount, inputStreams[attrData.stream], outputStreams[attrData.stream] @@ -1142,7 +1198,8 @@ await ConvertPositionAttribute( case VertexAttribute.Tangent: await ConvertTangentAttribute( attrData, - (uint)strides[attrData.stream], + (uint)inputStrides[attrData.stream], + (uint)outputStrides[attrData.stream], vertexCount, inputStreams[attrData.stream], outputStreams[attrData.stream] @@ -1158,12 +1215,26 @@ await ConvertTangentAttribute( case VertexAttribute.TexCoord7: await ConvertTexCoordAttribute( attrData, - (uint)strides[attrData.stream], + (uint)inputStrides[attrData.stream], + (uint)outputStrides[attrData.stream], vertexCount, inputStreams[attrData.stream], outputStreams[attrData.stream] ); break; + case VertexAttribute.Color: + case VertexAttribute.BlendWeight: + case VertexAttribute.BlendIndices: + default: + await ConvertGenericAttribute( + attrData, + (uint)inputStrides[attrData.stream], + (uint)outputStrides[attrData.stream], + vertexCount, + inputStreams[attrData.stream], + outputStreams[attrData.stream] + ); + break; } } @@ -1172,7 +1243,7 @@ await ConvertTexCoordAttribute( { bufferViewIds[stream] = WriteBufferViewToBuffer( outputStreams[stream], - strides[stream], + outputStrides[stream], alignments[stream] ); inputStreams[stream].Dispose(); @@ -1450,13 +1521,21 @@ bool GetUniqueFileName(ref string filename) static async Task ConvertPositionAttribute( AttributeData attrData, - uint byteStride, + uint inputByteStride, + uint outputByteStride, int vertexCount, NativeArray inputStream, NativeArray outputStream ) { - var job = CreateConvertPositionAttributeJob(attrData, byteStride, vertexCount, inputStream, outputStream); + var job = CreateConvertPositionAttributeJob( + attrData, + inputByteStride, + outputByteStride, + vertexCount, + inputStream, + outputStream + ); while (!job.IsCompleted) { await Task.Yield(); @@ -1466,7 +1545,8 @@ NativeArray outputStream static unsafe JobHandle CreateConvertPositionAttributeJob( AttributeData attrData, - uint byteStride, + uint inputByteStride, + uint outputByteStride, int vertexCount, NativeArray inputStream, NativeArray outputStream @@ -1475,7 +1555,8 @@ NativeArray outputStream var job = new ExportJobs.ConvertPositionFloatJob { input = (byte*)inputStream.GetUnsafeReadOnlyPtr() + attrData.offset, - byteStride = byteStride, + inputByteStride = inputByteStride, + outputByteStride = outputByteStride, output = (byte*)outputStream.GetUnsafePtr() + attrData.offset }.Schedule(vertexCount, k_DefaultInnerLoopBatchCount); return job; @@ -1483,13 +1564,21 @@ NativeArray outputStream static async Task ConvertTangentAttribute( AttributeData attrData, - uint byteStride, + uint inputByteStride, + uint outputByteStride, int vertexCount, NativeArray inputStream, NativeArray outputStream ) { - var job = CreateConvertTangentAttributeJob(attrData, byteStride, vertexCount, inputStream, outputStream); + var job = CreateConvertTangentAttributeJob( + attrData, + inputByteStride, + outputByteStride, + vertexCount, + inputStream, + outputStream + ); while (!job.IsCompleted) { await Task.Yield(); @@ -1499,7 +1588,8 @@ NativeArray outputStream static unsafe JobHandle CreateConvertTangentAttributeJob( AttributeData attrData, - uint byteStride, + uint inputByteStride, + uint outputByteStride, int vertexCount, NativeArray inputStream, NativeArray outputStream @@ -1508,7 +1598,8 @@ NativeArray outputStream var job = new ExportJobs.ConvertTangentFloatJob { input = (byte*)inputStream.GetUnsafeReadOnlyPtr() + attrData.offset, - byteStride = byteStride, + inputByteStride = inputByteStride, + outputByteStride = outputByteStride, output = (byte*)outputStream.GetUnsafePtr() + attrData.offset }.Schedule(vertexCount, k_DefaultInnerLoopBatchCount); return job; @@ -1516,13 +1607,43 @@ NativeArray outputStream static async Task ConvertTexCoordAttribute( AttributeData attrData, - uint byteStride, + uint inputByteStride, + uint outputByteStride, int vertexCount, NativeArray inputStream, NativeArray outputStream ) { - var job = CreateConvertTexCoordAttributeJob(attrData, byteStride, vertexCount, inputStream, outputStream); + var job = CreateConvertTexCoordAttributeJob( + attrData, + inputByteStride, + outputByteStride, + vertexCount, + inputStream, + outputStream); + while (!job.IsCompleted) + { + await Task.Yield(); + } + job.Complete(); + } + + static async Task ConvertGenericAttribute( + AttributeData attrData, + uint inputByteStride, + uint outputByteStride, + int vertexCount, + NativeArray inputStream, + NativeArray outputStream + ) + { + var job = CreateConvertGenericAttributeJob( + attrData, + inputByteStride, + outputByteStride, + vertexCount, + inputStream, + outputStream); while (!job.IsCompleted) { await Task.Yield(); @@ -1532,7 +1653,8 @@ NativeArray outputStream static unsafe JobHandle CreateConvertTexCoordAttributeJob( AttributeData attrData, - uint byteStride, + uint inputByteStride, + uint outputByteStride, int vertexCount, NativeArray inputStream, NativeArray outputStream @@ -1541,7 +1663,28 @@ NativeArray outputStream var job = new ExportJobs.ConvertTexCoordFloatJob { input = (byte*)inputStream.GetUnsafeReadOnlyPtr() + attrData.offset, - byteStride = byteStride, + inputByteStride = inputByteStride, + outputByteStride = outputByteStride, + output = (byte*)outputStream.GetUnsafePtr() + attrData.offset + }.Schedule(vertexCount, k_DefaultInnerLoopBatchCount); + return job; + } + + static unsafe JobHandle CreateConvertGenericAttributeJob( + AttributeData attrData, + uint inputByteStride, + uint outputByteStride, + int vertexCount, + NativeArray inputStream, + NativeArray outputStream + ) + { + var job = new ExportJobs.ConvertGenericJob + { + inputByteStride = inputByteStride, + outputByteStride = outputByteStride, + byteLength = (uint)attrData.size, + input = (byte*)inputStream.GetUnsafeReadOnlyPtr() + attrData.offset, output = (byte*)outputStream.GetUnsafePtr() + attrData.offset }.Schedule(vertexCount, k_DefaultInnerLoopBatchCount); return job; @@ -1619,7 +1762,7 @@ static Node CreateNode( return node; } - int AddMesh(UnityEngine.Mesh uMesh) + int AddMesh(UnityEngine.Mesh uMesh, VertexAttributeUsage attributeUsage) { int meshId; @@ -1636,6 +1779,7 @@ int AddMesh(UnityEngine.Mesh uMesh) meshId = m_UnityMeshes.IndexOf(uMesh); if (meshId >= 0) { + SetVertexAttributeUsage(meshId, attributeUsage); return meshId; } } @@ -1646,8 +1790,10 @@ int AddMesh(UnityEngine.Mesh uMesh) }; m_Meshes = m_Meshes ?? new List(); m_UnityMeshes = m_UnityMeshes ?? new List(); + m_MeshVertexAttributeUsage ??= new List(); m_Meshes.Add(mesh); m_UnityMeshes.Add(uMesh); + m_MeshVertexAttributeUsage.Add(attributeUsage); meshId = m_Meshes.Count - 1; return meshId; } @@ -1739,6 +1885,16 @@ int WriteBufferViewToBuffer(NativeArray bufferViewData, int? byteStride = return bufferViewId; } + void SetVertexAttributeUsage(int meshId, VertexAttributeUsage attributeUsage) + { + var existingUsage = m_MeshVertexAttributeUsage[meshId]; + if (((existingUsage ^ attributeUsage) & VertexAttributeUsage.Color) == VertexAttributeUsage.Color) + { + m_Logger.Warning(LogCode.InconsistentVertexColorUsage, meshId.ToString()); + } + m_MeshVertexAttributeUsage[meshId] = attributeUsage | existingUsage; + } + void Dispose() { m_Settings = null; @@ -1751,6 +1907,7 @@ void Dispose() m_SamplerKeys = null; m_UnityMaterials = null; m_UnityMeshes = null; + m_MeshVertexAttributeUsage = null; m_NodeMaterials = null; m_BufferStream?.Close(); m_BufferStream = null; @@ -1801,5 +1958,37 @@ static unsafe int GetAttributeSize(VertexAttributeFormat format) throw new ArgumentOutOfRangeException(nameof(format), format, null); } } + + static VertexAttributeUsage GetVertexAttributeUsage(Shader shader) + { + var shaderName = shader.name; + if (shaderName.EndsWith("unlit", StringComparison.InvariantCultureIgnoreCase)) + { + return VertexAttributeUsage.Position + // Only two UV channels + | VertexAttributeUsage.TwoTexCoords + | VertexAttributeUsage.Color + | VertexAttributeUsage.Skinning; + } + if (shaderName.StartsWith("Shader Graphs/glTF-", StringComparison.InvariantCulture) + || shaderName.StartsWith("glTF/", StringComparison.InvariantCulture) + || shaderName.StartsWith("Particles/Standard", StringComparison.InvariantCulture) + ) + { + return VertexAttributeUsage.Position + | VertexAttributeUsage.Normal + | VertexAttributeUsage.Tangent + // Only two UV channels + | VertexAttributeUsage.TwoTexCoords + | VertexAttributeUsage.Color + | VertexAttributeUsage.Skinning; + } + // Note: No vertex colors. Most shaders don't make use of them, so discard them by default. + return VertexAttributeUsage.Position + | VertexAttributeUsage.Normal + | VertexAttributeUsage.Tangent + | VertexAttributeUsage.AllTexCoords + | VertexAttributeUsage.Skinning; + } } } diff --git a/Runtime/Scripts/Export/IGltfWritable.cs b/Runtime/Scripts/Export/IGltfWritable.cs index 8e0eada4..7353ea8a 100644 --- a/Runtime/Scripts/Export/IGltfWritable.cs +++ b/Runtime/Scripts/Export/IGltfWritable.cs @@ -1,6 +1,7 @@ // SPDX-FileCopyrightText: 2023 Unity Technologies and the glTFast authors // SPDX-License-Identifier: Apache-2.0 +using System; using System.IO; using System.Threading.Tasks; using Unity.Mathematics; @@ -40,8 +41,19 @@ uint AddNode( /// Unity mesh to be assigned and exported /// glTF materials IDs to be assigned /// (multiple in case of sub-meshes) + [Obsolete("Use overload with skinning parameter.")] void AddMeshToNode(int nodeId, Mesh uMesh, int[] materialIds); + /// + /// Assigns a mesh to a previously added node + /// + /// Index of the node to add the mesh to + /// Unity mesh to be assigned and exported + /// glTF materials IDs to be assigned + /// (multiple in case of sub-meshes) + /// Skinning has been applied (e.g. ). + void AddMeshToNode(int nodeId, Mesh uMesh, int[] materialIds, bool skinning); + /// /// Assigns a camera to a previously added node /// diff --git a/Runtime/Scripts/Export/VertexAttributeUsage.cs b/Runtime/Scripts/Export/VertexAttributeUsage.cs new file mode 100644 index 00000000..695fc2b2 --- /dev/null +++ b/Runtime/Scripts/Export/VertexAttributeUsage.cs @@ -0,0 +1,87 @@ +// SPDX-FileCopyrightText: 2024 Unity Technologies and the glTFast authors +// SPDX-License-Identifier: Apache-2.0 + +using System; +using UnityEngine.Rendering; + +namespace GLTFast.Export +{ + /// + /// Vertex attribute mask. + /// + [Flags] + public enum VertexAttributeUsage + { + /// No attribute. + None = 0, + /// + Position = 1, + /// + Normal = 1 << 1, + /// + Tangent = 1 << 2, + /// + Color = 1 << 3, + /// + TexCoord0 = 1 << 4, + /// + TexCoord1 = 1 << 5, + /// + TexCoord2 = 1 << 6, + /// + TexCoord3 = 1 << 7, + /// + TexCoord4 = 1 << 8, + /// + TexCoord5 = 1 << 9, + /// + TexCoord6 = 1 << 10, + /// + TexCoord7 = 1 << 11, + /// + BlendWeight = 1 << 12, + /// + BlendIndices = 1 << 13, + /// The first two texture coordinate channels. + TwoTexCoords = TexCoord0 | TexCoord1, + /// All eight texture coordinate channels. + AllTexCoords = TexCoord0 | TexCoord1 | TexCoord2 | TexCoord3 | TexCoord4 | TexCoord5 | TexCoord6 | TexCoord7, + /// Blend indices and weights, required for skinning/morph targets. + Skinning = BlendWeight | BlendIndices, + } + + /// + /// Extension methods for . + /// + public static class VertexAttributeUsageExtension + { + /// + /// Converts a to a mask with corresponding + /// flag enabled. + /// + /// Vertex attribute. + /// Vertex attribute mask with corresponding flag enabled. + /// + public static VertexAttributeUsage ToVertexAttributeUsage(this VertexAttribute attr) + { + return attr switch + { + VertexAttribute.Position => VertexAttributeUsage.Position, + VertexAttribute.Normal => VertexAttributeUsage.Normal, + VertexAttribute.Tangent => VertexAttributeUsage.Tangent, + VertexAttribute.Color => VertexAttributeUsage.Color, + VertexAttribute.TexCoord0 => VertexAttributeUsage.TexCoord0, + VertexAttribute.TexCoord1 => VertexAttributeUsage.TexCoord1, + VertexAttribute.TexCoord2 => VertexAttributeUsage.TexCoord2, + VertexAttribute.TexCoord3 => VertexAttributeUsage.TexCoord3, + VertexAttribute.TexCoord4 => VertexAttributeUsage.TexCoord4, + VertexAttribute.TexCoord5 => VertexAttributeUsage.TexCoord5, + VertexAttribute.TexCoord6 => VertexAttributeUsage.TexCoord6, + VertexAttribute.TexCoord7 => VertexAttributeUsage.TexCoord7, + VertexAttribute.BlendWeight => VertexAttributeUsage.BlendWeight, + VertexAttribute.BlendIndices => VertexAttributeUsage.BlendIndices, + _ => throw new ArgumentOutOfRangeException(nameof(attr), attr, null) + }; + } + } +} diff --git a/Runtime/Scripts/Export/VertexAttributeUsage.cs.meta b/Runtime/Scripts/Export/VertexAttributeUsage.cs.meta new file mode 100644 index 00000000..41375718 --- /dev/null +++ b/Runtime/Scripts/Export/VertexAttributeUsage.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 3979632072da4c0289e70956d2835208 +timeCreated: 1714644620 \ No newline at end of file diff --git a/Runtime/Scripts/Logging/LogMessages.cs b/Runtime/Scripts/Logging/LogMessages.cs index 71207291..96cc568e 100644 --- a/Runtime/Scripts/Logging/LogMessages.cs +++ b/Runtime/Scripts/Logging/LogMessages.cs @@ -238,6 +238,10 @@ public enum LogCode : uint /// Fallback to uncompressed meshes/bufferViews is not supported. /// UncompressedFallbackNotSupported, + /// + /// Inconsistent use of vertex color attribute. + /// + InconsistentVertexColorUsage, } /// @@ -278,6 +282,7 @@ This may result in low performance and high memory usage. Try optimizing the glT { LogCode.ImageConversionNotEnabled, $"Jpeg/PNG textures failed because required built-in packages \"Image Conversion\"/\"Unity Web Request Texture\" are not enabled. {k_LinkProjectSetupTextureSupport}" }, { LogCode.ImageFormatUnknown, "Unknown image format (image {0};uri:{1})" }, { LogCode.ImageMultipleSamplers, "Have to create copy of image {0} due to different samplers. This is harmless, but requires more memory." }, + { LogCode.InconsistentVertexColorUsage, "Potential visual discrepancy due to inconsistent vertex colors usage on mesh {0}" }, { LogCode.IndexFormatInvalid, "Invalid index format {0}" }, { LogCode.JsonParsingFailed, "Parsing JSON failed" }, { LogCode.MaterialTransmissionApprox, "Chance of incorrect materials! glTF transmission is approximated when using built-in render pipeline!" }, diff --git a/Samples/Documentation/Manual/ExportSamples.cs b/Samples/Documentation/Manual/ExportSamples.cs index 6d84df46..bf2c9566 100644 --- a/Samples/Documentation/Manual/ExportSamples.cs +++ b/Samples/Documentation/Manual/ExportSamples.cs @@ -10,7 +10,7 @@ namespace Samples.Documentation.Manual using GLTFast.Export; using GLTFast.Logging; - public class ExportSamples : MonoBehaviour + class ExportSamples : MonoBehaviour { [FormerlySerializedAs("path")] @@ -39,6 +39,10 @@ async void AdvancedExport() // Boost light intensities LightIntensityFactor = 100f, + + // Ensure mesh vertex attributes colors and texture coordinate (channels 1 through 8) are always + // exported, even if they are not used/referenced. + PreservedVertexAttributes = VertexAttributeUsage.AllTexCoords | VertexAttributeUsage.Color, }; // GameObjectExportSettings provides settings specific to a GameObject/Component based hierarchy diff --git a/Samples/Documentation/Manual/ExtraData.cs b/Samples/Documentation/Manual/ExtraData.cs index ac42ca84..0f0a3496 100644 --- a/Samples/Documentation/Manual/ExtraData.cs +++ b/Samples/Documentation/Manual/ExtraData.cs @@ -7,7 +7,7 @@ namespace Samples.Documentation.Manual #region ExtraData using UnityEngine; - public class ExtraData : MonoBehaviour + class ExtraData : MonoBehaviour { public string someExtraKey; } diff --git a/Samples/Documentation/Manual/SimpleExport.cs b/Samples/Documentation/Manual/SimpleExport.cs index ee27b58c..3ee9c5ab 100644 --- a/Samples/Documentation/Manual/SimpleExport.cs +++ b/Samples/Documentation/Manual/SimpleExport.cs @@ -7,7 +7,7 @@ namespace Samples.Documentation.Manual using UnityEngine; using GLTFast.Export; - public class SimpleExport : MonoBehaviour + class SimpleExport : MonoBehaviour { [SerializeField] diff --git a/Tests/Resources/ExportTargets/Bounds.gltf.txt b/Tests/Resources/ExportTargets/Bounds.gltf.txt index f5ab6c4b..a0ed3640 100644 --- a/Tests/Resources/ExportTargets/Bounds.gltf.txt +++ b/Tests/Resources/ExportTargets/Bounds.gltf.txt @@ -1 +1 @@ -{"asset":{"version":"2.0","generator":"Unity 2021.3.12f1 glTFast 4.8.5"},"nodes":[{"name":"AsymBoundsCube","mesh":0},{"name":"Bounds","children":[0],"translation":[-6,0,0]}],"buffers":[{"uri":"Bounds.bin","byteLength":912}],"bufferViews":[{"buffer":0,"byteLength":144},{"buffer":0,"byteLength":576,"byteOffset":144,"byteStride":24},{"buffer":0,"byteLength":192,"byteOffset":720,"byteStride":8}],"accessors":[{"bufferView":1,"componentType":5126,"count":24,"type":"VEC3","max":[0.099999994,0.6,0.400000036],"min":[-0.3,-0.5,-0.199999988]},{"bufferView":1,"componentType":5126,"count":24,"type":"VEC3","byteOffset":12},{"bufferView":2,"componentType":5126,"count":24,"type":"VEC2"},{"bufferView":0,"componentType":5125,"count":36,"type":"SCALAR"}],"meshes":[{"name":"AsymBoundsCube","primitives":[{"attributes":{"POSITION":0,"NORMAL":1,"TEXCOORD_0":2},"indices":3}]}],"scene":0,"scenes":[{"name":"Bounds","nodes":[1]}]} \ No newline at end of file +{"asset":{"version":"2.0","generator":"Unity 2020.3.48f1 glTFast 6.4.0"},"nodes":[{"name":"AsymBoundsCube","mesh":0},{"name":"Bounds","children":[0],"translation":[-6,0,0]}],"buffers":[{"uri":"Bounds.bin","byteLength":720}],"bufferViews":[{"buffer":0,"byteLength":144},{"buffer":0,"byteLength":576,"byteOffset":144,"byteStride":24}],"accessors":[{"bufferView":1,"componentType":5126,"count":24,"type":"VEC3","max":[0.099999994,0.6,0.400000036],"min":[-0.3,-0.5,-0.199999988]},{"bufferView":1,"componentType":5126,"count":24,"type":"VEC3","byteOffset":12},{"bufferView":0,"componentType":5125,"count":36,"type":"SCALAR"}],"meshes":[{"name":"AsymBoundsCube","primitives":[{"attributes":{"POSITION":0,"NORMAL":1},"indices":2}]}],"scene":0,"scenes":[{"name":"Bounds","nodes":[1]}]} \ No newline at end of file diff --git a/Tests/Resources/ExportTargets/BoxVertexColors.gltf.txt b/Tests/Resources/ExportTargets/BoxVertexColors.gltf.txt index ebfed4c6..431170ef 100644 --- a/Tests/Resources/ExportTargets/BoxVertexColors.gltf.txt +++ b/Tests/Resources/ExportTargets/BoxVertexColors.gltf.txt @@ -1 +1 @@ -{"asset":{"version":"2.0","generator":"Unity 2021.3.12f1 glTFast 4.8.5"},"nodes":[{"name":"Cube","mesh":0},{"name":"Mesh"},{"name":"Texture Group"},{"name":"RootNode","children":[0,1,2]},{"name":"BoxVertexColors","children":[3],"translation":[-35,0,0]}],"extensionsRequired":["KHR_materials_unlit"],"extensionsUsed":["KHR_materials_unlit"],"buffers":[{"uri":"BoxVertexColors.bin","byteLength":1296}],"bufferViews":[{"buffer":0,"byteLength":144},{"buffer":0,"byteLength":576,"byteOffset":144,"byteStride":24},{"buffer":0,"byteLength":384,"byteOffset":720,"byteStride":16},{"buffer":0,"byteLength":192,"byteOffset":1104,"byteStride":8}],"accessors":[{"bufferView":1,"componentType":5126,"count":24,"type":"VEC3","max":[0.5,0.5,0.5],"min":[-0.5,-0.5,-0.5]},{"bufferView":1,"componentType":5126,"count":24,"type":"VEC3","byteOffset":12},{"bufferView":2,"componentType":5126,"count":24,"type":"VEC4"},{"bufferView":3,"componentType":5126,"count":24,"type":"VEC2"},{"bufferView":0,"componentType":5125,"count":36,"type":"SCALAR"}],"materials":[{"name":"VertexColorsUnlit","pbrMetallicRoughness":{"metallicFactor":0},"extensions":{"KHR_materials_unlit":{}}}],"meshes":[{"name":"Cube","primitives":[{"attributes":{"POSITION":0,"NORMAL":1,"TEXCOORD_0":3,"COLOR_0":2},"indices":4,"material":0}]}],"scene":0,"scenes":[{"name":"BoxVertexColors","nodes":[4]}]} \ No newline at end of file +{"asset":{"version":"2.0","generator":"Unity 2022.3.27f1 glTFast 6.4.0"},"nodes":[{"name":"Cube","mesh":0},{"name":"Mesh"},{"name":"Texture Group"},{"name":"RootNode","children":[0,1,2]},{"name":"BoxVertexColors","children":[3],"translation":[-35,0,0]}],"extensionsRequired":["KHR_materials_unlit"],"extensionsUsed":["KHR_materials_unlit"],"buffers":[{"uri":"BoxVertexColors.bin","byteLength":1008}],"bufferViews":[{"buffer":0,"byteLength":144},{"buffer":0,"byteLength":288,"byteOffset":144,"byteStride":12},{"buffer":0,"byteLength":384,"byteOffset":432,"byteStride":16},{"buffer":0,"byteLength":192,"byteOffset":816,"byteStride":8}],"accessors":[{"bufferView":1,"componentType":5126,"count":24,"type":"VEC3","max":[0.5,0.5,0.5],"min":[-0.5,-0.5,-0.5]},{"bufferView":2,"componentType":5126,"count":24,"type":"VEC4"},{"bufferView":3,"componentType":5126,"count":24,"type":"VEC2"},{"bufferView":0,"componentType":5125,"count":36,"type":"SCALAR"}],"materials":[{"name":"VertexColorsUnlit","pbrMetallicRoughness":{"metallicFactor":0},"extensions":{"KHR_materials_unlit":{}}}],"meshes":[{"name":"Cube","primitives":[{"attributes":{"POSITION":0,"TEXCOORD_0":2,"COLOR_0":1},"indices":3,"material":0}]}],"scene":0,"scenes":[{"name":"BoxVertexColors","nodes":[4]}]} \ No newline at end of file diff --git a/Tests/Resources/ExportTargets/ClearcoatFactor.gltf.txt b/Tests/Resources/ExportTargets/ClearcoatFactor.gltf.txt index a5a94ecd..d058927e 100644 --- a/Tests/Resources/ExportTargets/ClearcoatFactor.gltf.txt +++ b/Tests/Resources/ExportTargets/ClearcoatFactor.gltf.txt @@ -1 +1 @@ -{"asset":{"version":"2.0","generator":"Unity 2022.3.0f1 glTFast 5.1.0"},"nodes":[{"name":"Plane","mesh":0,"translation":[0,0,1]},{"name":"Sphere","mesh":1},{"name":"sphere","children":[1],"rotation":[0,0.7071068,0,0.7071068]},{"name":"ClearcoatFactor","children":[0,2],"translation":[-39,0,0]}],"buffers":[{"uri":"ClearcoatFactor.bin","byteLength":24728}],"bufferViews":[{"buffer":0,"byteLength":24},{"buffer":0,"byteLength":96,"byteOffset":24,"byteStride":24},{"buffer":0,"byteLength":32,"byteOffset":120,"byteStride":8},{"buffer":0,"byteLength":9216,"byteOffset":152},{"buffer":0,"byteLength":11520,"byteOffset":9368,"byteStride":24},{"buffer":0,"byteLength":3840,"byteOffset":20888,"byteStride":8}],"accessors":[{"bufferView":1,"componentType":5126,"count":4,"type":"VEC3","max":[0.5,0,0.5],"min":[-0.5,0,-0.5]},{"bufferView":1,"componentType":5126,"count":4,"type":"VEC3","byteOffset":12},{"bufferView":2,"componentType":5126,"count":4,"type":"VEC2"},{"bufferView":0,"componentType":5125,"count":6,"type":"SCALAR"},{"bufferView":4,"componentType":5126,"count":480,"type":"VEC3","max":[0.5,0.5,0.5],"min":[-0.5,-0.5,-0.5]},{"bufferView":4,"componentType":5126,"count":480,"type":"VEC3","byteOffset":12},{"bufferView":5,"componentType":5126,"count":480,"type":"VEC2"},{"bufferView":3,"componentType":5125,"count":2304,"type":"SCALAR"}],"meshes":[{"name":"Plane","primitives":[{"attributes":{"POSITION":0,"NORMAL":1,"TEXCOORD_0":2},"indices":3}]},{"name":"Sphere","primitives":[{"attributes":{"POSITION":4,"NORMAL":5,"TEXCOORD_0":6},"indices":7}]}],"scene":0,"scenes":[{"name":"ClearcoatFactor","nodes":[3]}]} \ No newline at end of file +{"asset":{"version":"2.0","generator":"Unity 2020.3.48f1 glTFast 6.4.0"},"nodes":[{"name":"Plane","mesh":0,"translation":[0,0,1]},{"name":"Sphere","mesh":1},{"name":"sphere","children":[1],"rotation":[0,0.7071068,0,0.7071068]},{"name":"ClearcoatFactor","children":[0,2],"translation":[-39,0,0]}],"buffers":[{"uri":"ClearcoatFactor.bin","byteLength":20856}],"bufferViews":[{"buffer":0,"byteLength":24},{"buffer":0,"byteLength":96,"byteOffset":24,"byteStride":24},{"buffer":0,"byteLength":9216,"byteOffset":120},{"buffer":0,"byteLength":11520,"byteOffset":9336,"byteStride":24}],"accessors":[{"bufferView":1,"componentType":5126,"count":4,"type":"VEC3","max":[0.5,0,0.5],"min":[-0.5,0,-0.5]},{"bufferView":1,"componentType":5126,"count":4,"type":"VEC3","byteOffset":12},{"bufferView":0,"componentType":5125,"count":6,"type":"SCALAR"},{"bufferView":3,"componentType":5126,"count":480,"type":"VEC3","max":[0.5,0.5,0.5],"min":[-0.5,-0.5,-0.5]},{"bufferView":3,"componentType":5126,"count":480,"type":"VEC3","byteOffset":12},{"bufferView":2,"componentType":5125,"count":2304,"type":"SCALAR"}],"meshes":[{"name":"Plane","primitives":[{"attributes":{"POSITION":0,"NORMAL":1},"indices":2}]},{"name":"Sphere","primitives":[{"attributes":{"POSITION":3,"NORMAL":4},"indices":5}]}],"scene":0,"scenes":[{"name":"ClearcoatFactor","nodes":[3]}]} \ No newline at end of file diff --git a/Tests/Resources/ExportTargets/ClearcoatTexture.gltf.txt b/Tests/Resources/ExportTargets/ClearcoatTexture.gltf.txt index c8520a81..aef7f1b4 100644 --- a/Tests/Resources/ExportTargets/ClearcoatTexture.gltf.txt +++ b/Tests/Resources/ExportTargets/ClearcoatTexture.gltf.txt @@ -1 +1 @@ -{"asset":{"version":"2.0","generator":"Unity 2022.3.0f1 glTFast 5.1.0"},"nodes":[{"name":"Plane","mesh":0,"translation":[0,0,1]},{"name":"Sphere","mesh":1},{"name":"sphere","children":[1],"rotation":[0,0.7071068,0,0.7071068]},{"name":"ClearcoatTexture","children":[0,2],"translation":[-40,0,0]}],"buffers":[{"uri":"ClearcoatTexture.bin","byteLength":24728}],"bufferViews":[{"buffer":0,"byteLength":24},{"buffer":0,"byteLength":96,"byteOffset":24,"byteStride":24},{"buffer":0,"byteLength":32,"byteOffset":120,"byteStride":8},{"buffer":0,"byteLength":9216,"byteOffset":152},{"buffer":0,"byteLength":11520,"byteOffset":9368,"byteStride":24},{"buffer":0,"byteLength":3840,"byteOffset":20888,"byteStride":8}],"accessors":[{"bufferView":1,"componentType":5126,"count":4,"type":"VEC3","max":[0.5,0,0.5],"min":[-0.5,0,-0.5]},{"bufferView":1,"componentType":5126,"count":4,"type":"VEC3","byteOffset":12},{"bufferView":2,"componentType":5126,"count":4,"type":"VEC2"},{"bufferView":0,"componentType":5125,"count":6,"type":"SCALAR"},{"bufferView":4,"componentType":5126,"count":480,"type":"VEC3","max":[0.5,0.5,0.5],"min":[-0.5,-0.5,-0.5]},{"bufferView":4,"componentType":5126,"count":480,"type":"VEC3","byteOffset":12},{"bufferView":5,"componentType":5126,"count":480,"type":"VEC2"},{"bufferView":3,"componentType":5125,"count":2304,"type":"SCALAR"}],"meshes":[{"name":"Plane","primitives":[{"attributes":{"POSITION":0,"NORMAL":1,"TEXCOORD_0":2},"indices":3}]},{"name":"Sphere","primitives":[{"attributes":{"POSITION":4,"NORMAL":5,"TEXCOORD_0":6},"indices":7}]}],"scene":0,"scenes":[{"name":"ClearcoatTexture","nodes":[3]}]} \ No newline at end of file +{"asset":{"version":"2.0","generator":"Unity 2020.3.48f1 glTFast 6.4.0"},"nodes":[{"name":"Plane","mesh":0,"translation":[0,0,1]},{"name":"Sphere","mesh":1},{"name":"sphere","children":[1],"rotation":[0,0.7071068,0,0.7071068]},{"name":"ClearcoatTexture","children":[0,2],"translation":[-40,0,0]}],"buffers":[{"uri":"ClearcoatTexture.bin","byteLength":20856}],"bufferViews":[{"buffer":0,"byteLength":24},{"buffer":0,"byteLength":96,"byteOffset":24,"byteStride":24},{"buffer":0,"byteLength":9216,"byteOffset":120},{"buffer":0,"byteLength":11520,"byteOffset":9336,"byteStride":24}],"accessors":[{"bufferView":1,"componentType":5126,"count":4,"type":"VEC3","max":[0.5,0,0.5],"min":[-0.5,0,-0.5]},{"bufferView":1,"componentType":5126,"count":4,"type":"VEC3","byteOffset":12},{"bufferView":0,"componentType":5125,"count":6,"type":"SCALAR"},{"bufferView":3,"componentType":5126,"count":480,"type":"VEC3","max":[0.5,0.5,0.5],"min":[-0.5,-0.5,-0.5]},{"bufferView":3,"componentType":5126,"count":480,"type":"VEC3","byteOffset":12},{"bufferView":2,"componentType":5125,"count":2304,"type":"SCALAR"}],"meshes":[{"name":"Plane","primitives":[{"attributes":{"POSITION":0,"NORMAL":1},"indices":2}]},{"name":"Sphere","primitives":[{"attributes":{"POSITION":3,"NORMAL":4},"indices":5}]}],"scene":0,"scenes":[{"name":"ClearcoatTexture","nodes":[3]}]} \ No newline at end of file diff --git a/Tests/Resources/ExportTargets/HDRP/BoxVertexColors.gltf.txt b/Tests/Resources/ExportTargets/HDRP/BoxVertexColors.gltf.txt index 61c30dda..f9be45ae 100644 --- a/Tests/Resources/ExportTargets/HDRP/BoxVertexColors.gltf.txt +++ b/Tests/Resources/ExportTargets/HDRP/BoxVertexColors.gltf.txt @@ -1 +1 @@ -{"asset":{"version":"2.0","generator":"Unity 2020.3.41f1 glTFast 4.8.5"},"nodes":[{"name":"Cube","mesh":0},{"name":"Mesh"},{"name":"Texture Group"},{"name":"RootNode","children":[0,1,2]},{"name":"BoxVertexColors","children":[3],"translation":[-35,0,0]}],"buffers":[{"uri":"BoxVertexColors.bin","byteLength":1296}],"bufferViews":[{"buffer":0,"byteLength":144},{"buffer":0,"byteLength":576,"byteOffset":144,"byteStride":24},{"buffer":0,"byteLength":384,"byteOffset":720,"byteStride":16},{"buffer":0,"byteLength":192,"byteOffset":1104,"byteStride":8}],"accessors":[{"bufferView":1,"componentType":5126,"count":24,"type":"VEC3","max":[0.5,0.5,0.5],"min":[-0.5,-0.5,-0.5]},{"bufferView":1,"componentType":5126,"count":24,"type":"VEC3","byteOffset":12},{"bufferView":2,"componentType":5126,"count":24,"type":"VEC4"},{"bufferView":3,"componentType":5126,"count":24,"type":"VEC2"},{"bufferView":0,"componentType":5125,"count":36,"type":"SCALAR"}],"meshes":[{"name":"Cube","primitives":[{"attributes":{"POSITION":0,"NORMAL":1,"TEXCOORD_0":3,"COLOR_0":2},"indices":4}]}],"scene":0,"scenes":[{"name":"BoxVertexColors","nodes":[4]}]} \ No newline at end of file +{"asset":{"version":"2.0","generator":"Unity 2022.3.27f1 glTFast 6.4.0"},"nodes":[{"name":"Cube","mesh":0},{"name":"Mesh"},{"name":"Texture Group"},{"name":"RootNode","children":[0,1,2]},{"name":"BoxVertexColors","children":[3],"translation":[-35,0,0]}],"buffers":[{"uri":"BoxVertexColors.bin","byteLength":1104}],"bufferViews":[{"buffer":0,"byteLength":144},{"buffer":0,"byteLength":576,"byteOffset":144,"byteStride":24},{"buffer":0,"byteLength":384,"byteOffset":720,"byteStride":16}],"accessors":[{"bufferView":1,"componentType":5126,"count":24,"type":"VEC3","max":[0.5,0.5,0.5],"min":[-0.5,-0.5,-0.5]},{"bufferView":1,"componentType":5126,"count":24,"type":"VEC3","byteOffset":12},{"bufferView":2,"componentType":5126,"count":24,"type":"VEC4"},{"bufferView":0,"componentType":5125,"count":36,"type":"SCALAR"}],"meshes":[{"name":"Cube","primitives":[{"attributes":{"POSITION":0,"NORMAL":1,"COLOR_0":2},"indices":3}]}],"scene":0,"scenes":[{"name":"BoxVertexColors","nodes":[4]}]} \ No newline at end of file diff --git a/Tests/Resources/ExportTargets/HierarchyComponentsDisabled.gltf.txt b/Tests/Resources/ExportTargets/HierarchyComponentsDisabled.gltf.txt index 873862f9..fd581044 100644 --- a/Tests/Resources/ExportTargets/HierarchyComponentsDisabled.gltf.txt +++ b/Tests/Resources/ExportTargets/HierarchyComponentsDisabled.gltf.txt @@ -1 +1 @@ -{"asset":{"version":"2.0","generator":"Unity 2021.3.13f1 glTFast 5.0.0-exp.1"},"nodes":[{"name":"A1","mesh":0,"translation":[0.249999985,0.75,-0.25],"scale":[0.5,0.5,0.5]},{"name":"A2","mesh":0,"translation":[-0.25,0.75,-0.25],"scale":[0.5,0.5,0.5]},{"name":"A3","mesh":0,"translation":[0.249999985,0.75,0.23],"scale":[0.5,0.5,0.5]},{"name":"A4","mesh":0,"translation":[-0.25,0.75,0.23],"scale":[0.5,0.5,0.5]},{"name":"A","children":[0,1,2,3],"mesh":0,"translation":[0.3,0.7,-0.3000002],"scale":[0.4,0.4,0.4]},{"name":"B1","mesh":0,"translation":[0.249999985,0.75,-0.25],"scale":[0.5,0.5,0.5]},{"name":"B2","mesh":0,"translation":[-0.25,0.75,-0.25],"scale":[0.5,0.5,0.5]},{"name":"B3","mesh":0,"translation":[0.249999985,0.75,0.23],"scale":[0.5,0.5,0.5]},{"name":"B4","mesh":0,"translation":[-0.25,0.75,0.23],"scale":[0.5,0.5,0.5]},{"name":"B","children":[5,6,7,8],"translation":[-0.3,0.7,-0.3],"scale":[0.4,0.4,0.4]},{"name":"C1","mesh":0,"translation":[0.249999985,0.75,-0.25],"scale":[0.5,0.5,0.5]},{"name":"C2","translation":[-0.25,0.75,-0.25],"scale":[0.5,0.5,0.5]},{"name":"C3","translation":[0.249999985,0.75,0.23],"scale":[0.5,0.5,0.5]},{"name":"C4","mesh":0,"translation":[-0.25,0.75,0.23],"scale":[0.5,0.5,0.5]},{"name":"C","children":[10,11,12,13],"mesh":0,"translation":[0.3,0.7,0.3],"scale":[0.4,0.4,0.4]},{"name":"D1","translation":[0.249999985,0.75,-0.25],"scale":[0.5,0.5,0.5]},{"name":"D2","mesh":0,"translation":[-0.25,0.75,-0.25],"scale":[0.5,0.5,0.5]},{"name":"D3","mesh":0,"translation":[0.249999985,0.75,0.23],"scale":[0.5,0.5,0.5]},{"name":"D4","translation":[-0.25,0.75,0.23],"scale":[0.5,0.5,0.5]},{"name":"D","children":[15,16,17,18],"translation":[-0.3,0.7,0.3],"scale":[0.4,0.4,0.4]},{"name":"Root","children":[4,9,14,19],"mesh":0,"translation":[0,0,16]},{"name":"HierarchyComponentsDisabled","children":[20],"translation":[-1,0,0]}],"buffers":[{"uri":"HierarchyComponentsDisabled.bin","byteLength":1416}],"bufferViews":[{"buffer":0,"byteLength":72},{"buffer":0,"byteLength":1344,"byteOffset":72,"byteStride":56}],"accessors":[{"bufferView":1,"componentType":5126,"count":24,"type":"VEC3","max":[0.5,0.5,0.5],"min":[-0.5,-0.5,-0.5]},{"bufferView":1,"componentType":5126,"count":24,"type":"VEC3","byteOffset":12},{"bufferView":1,"componentType":5126,"count":24,"type":"VEC4","byteOffset":24},{"bufferView":1,"componentType":5126,"count":24,"type":"VEC2","byteOffset":40},{"bufferView":1,"componentType":5126,"count":24,"type":"VEC2","byteOffset":48},{"bufferView":0,"componentType":5123,"count":36,"type":"SCALAR"}],"meshes":[{"name":"Cube","primitives":[{"attributes":{"POSITION":0,"NORMAL":1,"TANGENT":2,"TEXCOORD_0":3,"TEXCOORD_1":4},"indices":5}]}],"scene":0,"scenes":[{"name":"HierarchyComponentsDisabled","nodes":[21]}]} \ No newline at end of file +{"asset":{"version":"2.0","generator":"Unity 2020.3.48f1 glTFast 6.4.0"},"nodes":[{"name":"A1","mesh":0,"translation":[0.249999985,0.75,-0.25],"scale":[0.5,0.5,0.5]},{"name":"A2","mesh":0,"translation":[-0.25,0.75,-0.25],"scale":[0.5,0.5,0.5]},{"name":"A3","mesh":0,"translation":[0.249999985,0.75,0.23],"scale":[0.5,0.5,0.5]},{"name":"A4","mesh":0,"translation":[-0.25,0.75,0.23],"scale":[0.5,0.5,0.5]},{"name":"A","children":[0,1,2,3],"mesh":0,"translation":[0.3,0.7,-0.3000002],"scale":[0.4,0.4,0.4]},{"name":"B1","mesh":0,"translation":[0.249999985,0.75,-0.25],"scale":[0.5,0.5,0.5]},{"name":"B2","mesh":0,"translation":[-0.25,0.75,-0.25],"scale":[0.5,0.5,0.5]},{"name":"B3","mesh":0,"translation":[0.249999985,0.75,0.23],"scale":[0.5,0.5,0.5]},{"name":"B4","mesh":0,"translation":[-0.25,0.75,0.23],"scale":[0.5,0.5,0.5]},{"name":"B","children":[5,6,7,8],"translation":[-0.3,0.7,-0.3],"scale":[0.4,0.4,0.4]},{"name":"C1","mesh":0,"translation":[0.249999985,0.75,-0.25],"scale":[0.5,0.5,0.5]},{"name":"C2","translation":[-0.25,0.75,-0.25],"scale":[0.5,0.5,0.5]},{"name":"C3","translation":[0.249999985,0.75,0.23],"scale":[0.5,0.5,0.5]},{"name":"C4","mesh":0,"translation":[-0.25,0.75,0.23],"scale":[0.5,0.5,0.5]},{"name":"C","children":[10,11,12,13],"mesh":0,"translation":[0.3,0.7,0.3],"scale":[0.4,0.4,0.4]},{"name":"D1","translation":[0.249999985,0.75,-0.25],"scale":[0.5,0.5,0.5]},{"name":"D2","mesh":0,"translation":[-0.25,0.75,-0.25],"scale":[0.5,0.5,0.5]},{"name":"D3","mesh":0,"translation":[0.249999985,0.75,0.23],"scale":[0.5,0.5,0.5]},{"name":"D4","translation":[-0.25,0.75,0.23],"scale":[0.5,0.5,0.5]},{"name":"D","children":[15,16,17,18],"translation":[-0.3,0.7,0.3],"scale":[0.4,0.4,0.4]},{"name":"Root","children":[4,9,14,19],"mesh":0,"translation":[0,0,16]},{"name":"HierarchyComponentsDisabled","children":[20],"translation":[-1,0,0]}],"buffers":[{"uri":"HierarchyComponentsDisabled.bin","byteLength":648}],"bufferViews":[{"buffer":0,"byteLength":72},{"buffer":0,"byteLength":576,"byteOffset":72,"byteStride":24}],"accessors":[{"bufferView":1,"componentType":5126,"count":24,"type":"VEC3","max":[0.5,0.5,0.5],"min":[-0.5,-0.5,-0.5]},{"bufferView":1,"componentType":5126,"count":24,"type":"VEC3","byteOffset":12},{"bufferView":0,"componentType":5123,"count":36,"type":"SCALAR"}],"meshes":[{"name":"Cube","primitives":[{"attributes":{"POSITION":0,"NORMAL":1},"indices":2}]}],"scene":0,"scenes":[{"name":"HierarchyComponentsDisabled","nodes":[21]}]} \ No newline at end of file diff --git a/Tests/Resources/ExportTargets/HierarchyEditorOnlyTag.gltf.txt b/Tests/Resources/ExportTargets/HierarchyEditorOnlyTag.gltf.txt index 234d56af..e17ecc91 100644 --- a/Tests/Resources/ExportTargets/HierarchyEditorOnlyTag.gltf.txt +++ b/Tests/Resources/ExportTargets/HierarchyEditorOnlyTag.gltf.txt @@ -1 +1 @@ -{"asset":{"version":"2.0","generator":"Unity 2021.3.13f1 glTFast 5.0.0-exp.1"},"nodes":[{"name":"A1","mesh":0,"translation":[0.249999985,0.75,-0.25],"scale":[0.5,0.5,0.5]},{"name":"A2","mesh":0,"translation":[-0.25,0.75,-0.25],"scale":[0.5,0.5,0.5]},{"name":"A3","mesh":0,"translation":[0.249999985,0.75,0.23],"scale":[0.5,0.5,0.5]},{"name":"A4","mesh":0,"translation":[-0.25,0.75,0.23],"scale":[0.5,0.5,0.5]},{"name":"A","children":[0,1,2,3],"mesh":0,"translation":[0.3,0.7,-0.3000002],"scale":[0.4,0.4,0.4]},{"name":"C1","mesh":0,"translation":[0.249999985,0.75,-0.25],"scale":[0.5,0.5,0.5]},{"name":"C4","mesh":0,"translation":[-0.25,0.75,0.23],"scale":[0.5,0.5,0.5]},{"name":"C","children":[5,6],"mesh":0,"translation":[0.3,0.7,0.3],"scale":[0.4,0.4,0.4]},{"name":"D2","mesh":0,"translation":[-0.25,0.75,-0.25],"scale":[0.5,0.5,0.5]},{"name":"D3","mesh":0,"translation":[0.249999985,0.75,0.23],"scale":[0.5,0.5,0.5]},{"name":"D","children":[8,9],"mesh":0,"translation":[-0.3,0.7,0.3],"scale":[0.4,0.4,0.4]},{"name":"Root","children":[4,7,10],"mesh":0,"translation":[0,0,16]},{"name":"HierarchyEditorOnlyTag","children":[11],"translation":[-2,0,0]}],"buffers":[{"uri":"HierarchyEditorOnlyTag.bin","byteLength":1416}],"bufferViews":[{"buffer":0,"byteLength":72},{"buffer":0,"byteLength":1344,"byteOffset":72,"byteStride":56}],"accessors":[{"bufferView":1,"componentType":5126,"count":24,"type":"VEC3","max":[0.5,0.5,0.5],"min":[-0.5,-0.5,-0.5]},{"bufferView":1,"componentType":5126,"count":24,"type":"VEC3","byteOffset":12},{"bufferView":1,"componentType":5126,"count":24,"type":"VEC4","byteOffset":24},{"bufferView":1,"componentType":5126,"count":24,"type":"VEC2","byteOffset":40},{"bufferView":1,"componentType":5126,"count":24,"type":"VEC2","byteOffset":48},{"bufferView":0,"componentType":5123,"count":36,"type":"SCALAR"}],"meshes":[{"name":"Cube","primitives":[{"attributes":{"POSITION":0,"NORMAL":1,"TANGENT":2,"TEXCOORD_0":3,"TEXCOORD_1":4},"indices":5}]}],"scene":0,"scenes":[{"name":"HierarchyEditorOnlyTag","nodes":[12]}]} \ No newline at end of file +{"asset":{"version":"2.0","generator":"Unity 2020.3.48f1 glTFast 6.4.0"},"nodes":[{"name":"A1","mesh":0,"translation":[0.249999985,0.75,-0.25],"scale":[0.5,0.5,0.5]},{"name":"A2","mesh":0,"translation":[-0.25,0.75,-0.25],"scale":[0.5,0.5,0.5]},{"name":"A3","mesh":0,"translation":[0.249999985,0.75,0.23],"scale":[0.5,0.5,0.5]},{"name":"A4","mesh":0,"translation":[-0.25,0.75,0.23],"scale":[0.5,0.5,0.5]},{"name":"A","children":[0,1,2,3],"mesh":0,"translation":[0.3,0.7,-0.3000002],"scale":[0.4,0.4,0.4]},{"name":"C1","mesh":0,"translation":[0.249999985,0.75,-0.25],"scale":[0.5,0.5,0.5]},{"name":"C4","mesh":0,"translation":[-0.25,0.75,0.23],"scale":[0.5,0.5,0.5]},{"name":"C","children":[5,6],"mesh":0,"translation":[0.3,0.7,0.3],"scale":[0.4,0.4,0.4]},{"name":"D2","mesh":0,"translation":[-0.25,0.75,-0.25],"scale":[0.5,0.5,0.5]},{"name":"D3","mesh":0,"translation":[0.249999985,0.75,0.23],"scale":[0.5,0.5,0.5]},{"name":"D","children":[8,9],"mesh":0,"translation":[-0.3,0.7,0.3],"scale":[0.4,0.4,0.4]},{"name":"Root","children":[4,7,10],"mesh":0,"translation":[0,0,16]},{"name":"HierarchyEditorOnlyTag","children":[11],"translation":[-2,0,0]}],"buffers":[{"uri":"HierarchyEditorOnlyTag.bin","byteLength":648}],"bufferViews":[{"buffer":0,"byteLength":72},{"buffer":0,"byteLength":576,"byteOffset":72,"byteStride":24}],"accessors":[{"bufferView":1,"componentType":5126,"count":24,"type":"VEC3","max":[0.5,0.5,0.5],"min":[-0.5,-0.5,-0.5]},{"bufferView":1,"componentType":5126,"count":24,"type":"VEC3","byteOffset":12},{"bufferView":0,"componentType":5123,"count":36,"type":"SCALAR"}],"meshes":[{"name":"Cube","primitives":[{"attributes":{"POSITION":0,"NORMAL":1},"indices":2}]}],"scene":0,"scenes":[{"name":"HierarchyEditorOnlyTag","nodes":[12]}]} \ No newline at end of file diff --git a/Tests/Resources/ExportTargets/HierarchyObjectsInactive.gltf.txt b/Tests/Resources/ExportTargets/HierarchyObjectsInactive.gltf.txt index 815b8951..c803ecac 100644 --- a/Tests/Resources/ExportTargets/HierarchyObjectsInactive.gltf.txt +++ b/Tests/Resources/ExportTargets/HierarchyObjectsInactive.gltf.txt @@ -1 +1 @@ -{"asset":{"version":"2.0","generator":"Unity 2021.3.13f1 glTFast 5.0.0-exp.1"},"nodes":[{"name":"A1","mesh":0,"translation":[0.249999985,0.75,-0.25],"scale":[0.5,0.5,0.5]},{"name":"A2","mesh":0,"translation":[-0.25,0.75,-0.25],"scale":[0.5,0.5,0.5]},{"name":"A3","mesh":0,"translation":[0.249999985,0.75,0.23],"scale":[0.5,0.5,0.5]},{"name":"A4","mesh":0,"translation":[-0.25,0.75,0.23],"scale":[0.5,0.5,0.5]},{"name":"A","children":[0,1,2,3],"mesh":0,"translation":[0.3,0.7,-0.3000002],"scale":[0.4,0.4,0.4]},{"name":"C1","mesh":0,"translation":[0.249999985,0.75,-0.25],"scale":[0.5,0.5,0.5]},{"name":"C4","mesh":0,"translation":[-0.25,0.75,0.23],"scale":[0.5,0.5,0.5]},{"name":"C","children":[5,6],"mesh":0,"translation":[0.3,0.7,0.3],"scale":[0.4,0.4,0.4]},{"name":"D2","mesh":0,"translation":[-0.25,0.75,-0.25],"scale":[0.5,0.5,0.5]},{"name":"D3","mesh":0,"translation":[0.249999985,0.75,0.23],"scale":[0.5,0.5,0.5]},{"name":"D","children":[8,9],"mesh":0,"translation":[-0.3,0.7,0.3],"scale":[0.4,0.4,0.4]},{"name":"Root","children":[4,7,10],"mesh":0,"translation":[0,0,16]},{"name":"HierarchyObjectsInactive","children":[11]}],"buffers":[{"uri":"HierarchyObjectsInactive.bin","byteLength":1416}],"bufferViews":[{"buffer":0,"byteLength":72},{"buffer":0,"byteLength":1344,"byteOffset":72,"byteStride":56}],"accessors":[{"bufferView":1,"componentType":5126,"count":24,"type":"VEC3","max":[0.5,0.5,0.5],"min":[-0.5,-0.5,-0.5]},{"bufferView":1,"componentType":5126,"count":24,"type":"VEC3","byteOffset":12},{"bufferView":1,"componentType":5126,"count":24,"type":"VEC4","byteOffset":24},{"bufferView":1,"componentType":5126,"count":24,"type":"VEC2","byteOffset":40},{"bufferView":1,"componentType":5126,"count":24,"type":"VEC2","byteOffset":48},{"bufferView":0,"componentType":5123,"count":36,"type":"SCALAR"}],"meshes":[{"name":"Cube","primitives":[{"attributes":{"POSITION":0,"NORMAL":1,"TANGENT":2,"TEXCOORD_0":3,"TEXCOORD_1":4},"indices":5}]}],"scene":0,"scenes":[{"name":"HierarchyObjectsInactive","nodes":[12]}]} \ No newline at end of file +{"asset":{"version":"2.0","generator":"Unity 2020.3.48f1 glTFast 6.4.0"},"nodes":[{"name":"A1","mesh":0,"translation":[0.249999985,0.75,-0.25],"scale":[0.5,0.5,0.5]},{"name":"A2","mesh":0,"translation":[-0.25,0.75,-0.25],"scale":[0.5,0.5,0.5]},{"name":"A3","mesh":0,"translation":[0.249999985,0.75,0.23],"scale":[0.5,0.5,0.5]},{"name":"A4","mesh":0,"translation":[-0.25,0.75,0.23],"scale":[0.5,0.5,0.5]},{"name":"A","children":[0,1,2,3],"mesh":0,"translation":[0.3,0.7,-0.3000002],"scale":[0.4,0.4,0.4]},{"name":"C1","mesh":0,"translation":[0.249999985,0.75,-0.25],"scale":[0.5,0.5,0.5]},{"name":"C4","mesh":0,"translation":[-0.25,0.75,0.23],"scale":[0.5,0.5,0.5]},{"name":"C","children":[5,6],"mesh":0,"translation":[0.3,0.7,0.3],"scale":[0.4,0.4,0.4]},{"name":"D2","mesh":0,"translation":[-0.25,0.75,-0.25],"scale":[0.5,0.5,0.5]},{"name":"D3","mesh":0,"translation":[0.249999985,0.75,0.23],"scale":[0.5,0.5,0.5]},{"name":"D","children":[8,9],"mesh":0,"translation":[-0.3,0.7,0.3],"scale":[0.4,0.4,0.4]},{"name":"Root","children":[4,7,10],"mesh":0,"translation":[0,0,16]},{"name":"HierarchyObjectsInactive","children":[11]}],"buffers":[{"uri":"HierarchyObjectsInactive.bin","byteLength":648}],"bufferViews":[{"buffer":0,"byteLength":72},{"buffer":0,"byteLength":576,"byteOffset":72,"byteStride":24}],"accessors":[{"bufferView":1,"componentType":5126,"count":24,"type":"VEC3","max":[0.5,0.5,0.5],"min":[-0.5,-0.5,-0.5]},{"bufferView":1,"componentType":5126,"count":24,"type":"VEC3","byteOffset":12},{"bufferView":0,"componentType":5123,"count":36,"type":"SCALAR"}],"meshes":[{"name":"Cube","primitives":[{"attributes":{"POSITION":0,"NORMAL":1},"indices":2}]}],"scene":0,"scenes":[{"name":"HierarchyObjectsInactive","nodes":[12]}]} \ No newline at end of file diff --git a/Tests/Resources/ExportTargets/NoMaterial.gltf.txt b/Tests/Resources/ExportTargets/NoMaterial.gltf.txt index 5061e37d..252128ef 100644 --- a/Tests/Resources/ExportTargets/NoMaterial.gltf.txt +++ b/Tests/Resources/ExportTargets/NoMaterial.gltf.txt @@ -1 +1 @@ -{"asset":{"version":"2.0","generator":"Unity 2021.3.12f1 glTFast 4.8.5"},"nodes":[{"name":"Cube","mesh":0},{"name":"NoMaterial","children":[0],"translation":[-2,0,0]}],"buffers":[{"uri":"NoMaterial.bin","byteLength":1416}],"bufferViews":[{"buffer":0,"byteLength":72},{"buffer":0,"byteLength":1344,"byteOffset":72,"byteStride":56}],"accessors":[{"bufferView":1,"componentType":5126,"count":24,"type":"VEC3","max":[0.5,0.5,0.5],"min":[-0.5,-0.5,-0.5]},{"bufferView":1,"componentType":5126,"count":24,"type":"VEC3","byteOffset":12},{"bufferView":1,"componentType":5126,"count":24,"type":"VEC4","byteOffset":24},{"bufferView":1,"componentType":5126,"count":24,"type":"VEC2","byteOffset":40},{"bufferView":1,"componentType":5126,"count":24,"type":"VEC2","byteOffset":48},{"bufferView":0,"componentType":5123,"count":36,"type":"SCALAR"}],"meshes":[{"name":"Cube","primitives":[{"attributes":{"POSITION":0,"NORMAL":1,"TANGENT":2,"TEXCOORD_0":3,"TEXCOORD_1":4},"indices":5}]}],"scene":0,"scenes":[{"name":"NoMaterial","nodes":[1]}]} \ No newline at end of file +{"asset":{"version":"2.0","generator":"Unity 2020.3.48f1 glTFast 6.4.0"},"nodes":[{"name":"Cube","mesh":0},{"name":"NoMaterial","children":[0],"translation":[-2,0,0]}],"buffers":[{"uri":"NoMaterial.bin","byteLength":648}],"bufferViews":[{"buffer":0,"byteLength":72},{"buffer":0,"byteLength":576,"byteOffset":72,"byteStride":24}],"accessors":[{"bufferView":1,"componentType":5126,"count":24,"type":"VEC3","max":[0.5,0.5,0.5],"min":[-0.5,-0.5,-0.5]},{"bufferView":1,"componentType":5126,"count":24,"type":"VEC3","byteOffset":12},{"bufferView":0,"componentType":5123,"count":36,"type":"SCALAR"}],"meshes":[{"name":"Cube","primitives":[{"attributes":{"POSITION":0,"NORMAL":1},"indices":2}]}],"scene":0,"scenes":[{"name":"NoMaterial","nodes":[1]}]} \ No newline at end of file diff --git a/Tests/Resources/ExportTargets/URP/ClearcoatFactor.gltf.txt b/Tests/Resources/ExportTargets/URP/ClearcoatFactor.gltf.txt index a5a94ecd..1b1fb0fa 100644 --- a/Tests/Resources/ExportTargets/URP/ClearcoatFactor.gltf.txt +++ b/Tests/Resources/ExportTargets/URP/ClearcoatFactor.gltf.txt @@ -1 +1 @@ -{"asset":{"version":"2.0","generator":"Unity 2022.3.0f1 glTFast 5.1.0"},"nodes":[{"name":"Plane","mesh":0,"translation":[0,0,1]},{"name":"Sphere","mesh":1},{"name":"sphere","children":[1],"rotation":[0,0.7071068,0,0.7071068]},{"name":"ClearcoatFactor","children":[0,2],"translation":[-39,0,0]}],"buffers":[{"uri":"ClearcoatFactor.bin","byteLength":24728}],"bufferViews":[{"buffer":0,"byteLength":24},{"buffer":0,"byteLength":96,"byteOffset":24,"byteStride":24},{"buffer":0,"byteLength":32,"byteOffset":120,"byteStride":8},{"buffer":0,"byteLength":9216,"byteOffset":152},{"buffer":0,"byteLength":11520,"byteOffset":9368,"byteStride":24},{"buffer":0,"byteLength":3840,"byteOffset":20888,"byteStride":8}],"accessors":[{"bufferView":1,"componentType":5126,"count":4,"type":"VEC3","max":[0.5,0,0.5],"min":[-0.5,0,-0.5]},{"bufferView":1,"componentType":5126,"count":4,"type":"VEC3","byteOffset":12},{"bufferView":2,"componentType":5126,"count":4,"type":"VEC2"},{"bufferView":0,"componentType":5125,"count":6,"type":"SCALAR"},{"bufferView":4,"componentType":5126,"count":480,"type":"VEC3","max":[0.5,0.5,0.5],"min":[-0.5,-0.5,-0.5]},{"bufferView":4,"componentType":5126,"count":480,"type":"VEC3","byteOffset":12},{"bufferView":5,"componentType":5126,"count":480,"type":"VEC2"},{"bufferView":3,"componentType":5125,"count":2304,"type":"SCALAR"}],"meshes":[{"name":"Plane","primitives":[{"attributes":{"POSITION":0,"NORMAL":1,"TEXCOORD_0":2},"indices":3}]},{"name":"Sphere","primitives":[{"attributes":{"POSITION":4,"NORMAL":5,"TEXCOORD_0":6},"indices":7}]}],"scene":0,"scenes":[{"name":"ClearcoatFactor","nodes":[3]}]} \ No newline at end of file +{"asset":{"version":"2.0","generator":"Unity 2022.3.27f1 glTFast 6.4.0"},"nodes":[{"name":"Plane","mesh":0,"translation":[0,0,1]},{"name":"Sphere","mesh":1},{"name":"sphere","children":[1],"rotation":[0,0.7071068,0,0.7071068]},{"name":"ClearcoatFactor","children":[0,2],"translation":[-39,0,0]}],"buffers":[{"uri":"ClearcoatFactor.bin","byteLength":20856}],"bufferViews":[{"buffer":0,"byteLength":24},{"buffer":0,"byteLength":96,"byteOffset":24,"byteStride":24},{"buffer":0,"byteLength":9216,"byteOffset":120},{"buffer":0,"byteLength":11520,"byteOffset":9336,"byteStride":24}],"accessors":[{"bufferView":1,"componentType":5126,"count":4,"type":"VEC3","max":[0.5,0,0.5],"min":[-0.5,0,-0.5]},{"bufferView":1,"componentType":5126,"count":4,"type":"VEC3","byteOffset":12},{"bufferView":0,"componentType":5125,"count":6,"type":"SCALAR"},{"bufferView":3,"componentType":5126,"count":480,"type":"VEC3","max":[0.5,0.5,0.5],"min":[-0.5,-0.5,-0.5]},{"bufferView":3,"componentType":5126,"count":480,"type":"VEC3","byteOffset":12},{"bufferView":2,"componentType":5125,"count":2304,"type":"SCALAR"}],"meshes":[{"name":"Plane","primitives":[{"attributes":{"POSITION":0,"NORMAL":1},"indices":2}]},{"name":"Sphere","primitives":[{"attributes":{"POSITION":3,"NORMAL":4},"indices":5}]}],"scene":0,"scenes":[{"name":"ClearcoatFactor","nodes":[3]}]} \ No newline at end of file diff --git a/Tests/Resources/ExportTargets/URP/ClearcoatTexture.gltf.txt b/Tests/Resources/ExportTargets/URP/ClearcoatTexture.gltf.txt index c8520a81..6bdccf8f 100644 --- a/Tests/Resources/ExportTargets/URP/ClearcoatTexture.gltf.txt +++ b/Tests/Resources/ExportTargets/URP/ClearcoatTexture.gltf.txt @@ -1 +1 @@ -{"asset":{"version":"2.0","generator":"Unity 2022.3.0f1 glTFast 5.1.0"},"nodes":[{"name":"Plane","mesh":0,"translation":[0,0,1]},{"name":"Sphere","mesh":1},{"name":"sphere","children":[1],"rotation":[0,0.7071068,0,0.7071068]},{"name":"ClearcoatTexture","children":[0,2],"translation":[-40,0,0]}],"buffers":[{"uri":"ClearcoatTexture.bin","byteLength":24728}],"bufferViews":[{"buffer":0,"byteLength":24},{"buffer":0,"byteLength":96,"byteOffset":24,"byteStride":24},{"buffer":0,"byteLength":32,"byteOffset":120,"byteStride":8},{"buffer":0,"byteLength":9216,"byteOffset":152},{"buffer":0,"byteLength":11520,"byteOffset":9368,"byteStride":24},{"buffer":0,"byteLength":3840,"byteOffset":20888,"byteStride":8}],"accessors":[{"bufferView":1,"componentType":5126,"count":4,"type":"VEC3","max":[0.5,0,0.5],"min":[-0.5,0,-0.5]},{"bufferView":1,"componentType":5126,"count":4,"type":"VEC3","byteOffset":12},{"bufferView":2,"componentType":5126,"count":4,"type":"VEC2"},{"bufferView":0,"componentType":5125,"count":6,"type":"SCALAR"},{"bufferView":4,"componentType":5126,"count":480,"type":"VEC3","max":[0.5,0.5,0.5],"min":[-0.5,-0.5,-0.5]},{"bufferView":4,"componentType":5126,"count":480,"type":"VEC3","byteOffset":12},{"bufferView":5,"componentType":5126,"count":480,"type":"VEC2"},{"bufferView":3,"componentType":5125,"count":2304,"type":"SCALAR"}],"meshes":[{"name":"Plane","primitives":[{"attributes":{"POSITION":0,"NORMAL":1,"TEXCOORD_0":2},"indices":3}]},{"name":"Sphere","primitives":[{"attributes":{"POSITION":4,"NORMAL":5,"TEXCOORD_0":6},"indices":7}]}],"scene":0,"scenes":[{"name":"ClearcoatTexture","nodes":[3]}]} \ No newline at end of file +{"asset":{"version":"2.0","generator":"Unity 2022.3.27f1 glTFast 6.4.0"},"nodes":[{"name":"Plane","mesh":0,"translation":[0,0,1]},{"name":"Sphere","mesh":1},{"name":"sphere","children":[1],"rotation":[0,0.7071068,0,0.7071068]},{"name":"ClearcoatTexture","children":[0,2],"translation":[-40,0,0]}],"buffers":[{"uri":"ClearcoatTexture.bin","byteLength":20856}],"bufferViews":[{"buffer":0,"byteLength":24},{"buffer":0,"byteLength":96,"byteOffset":24,"byteStride":24},{"buffer":0,"byteLength":9216,"byteOffset":120},{"buffer":0,"byteLength":11520,"byteOffset":9336,"byteStride":24}],"accessors":[{"bufferView":1,"componentType":5126,"count":4,"type":"VEC3","max":[0.5,0,0.5],"min":[-0.5,0,-0.5]},{"bufferView":1,"componentType":5126,"count":4,"type":"VEC3","byteOffset":12},{"bufferView":0,"componentType":5125,"count":6,"type":"SCALAR"},{"bufferView":3,"componentType":5126,"count":480,"type":"VEC3","max":[0.5,0.5,0.5],"min":[-0.5,-0.5,-0.5]},{"bufferView":3,"componentType":5126,"count":480,"type":"VEC3","byteOffset":12},{"bufferView":2,"componentType":5125,"count":2304,"type":"SCALAR"}],"meshes":[{"name":"Plane","primitives":[{"attributes":{"POSITION":0,"NORMAL":1},"indices":2}]},{"name":"Sphere","primitives":[{"attributes":{"POSITION":3,"NORMAL":4},"indices":5}]}],"scene":0,"scenes":[{"name":"ClearcoatTexture","nodes":[3]}]} \ No newline at end of file diff --git a/Tests/Runtime/Scripts/Export/ExportTests.cs b/Tests/Runtime/Scripts/Export/ExportTests.cs index 1d1e3889..71dba871 100644 --- a/Tests/Runtime/Scripts/Export/ExportTests.cs +++ b/Tests/Runtime/Scripts/Export/ExportTests.cs @@ -856,7 +856,7 @@ static async Task ExportSceneAll(bool binary, bool toStream = false) success = await export.SaveToFileAndDispose(path); } Assert.IsTrue(success); - AssertLogger(logger); + LoggerTest.AssertLogger(logger, new LogCode[] { }); #if GLTF_VALIDATOR && UNITY_EDITOR ValidateGltf(path, new [] { MessageCode.ACCESSOR_ELEMENT_OUT_OF_MAX_BOUND, diff --git a/Tests/Runtime/Scripts/Export/GltfWritableMock.cs b/Tests/Runtime/Scripts/Export/GltfWritableMock.cs index 0816b8c6..8eebf605 100644 --- a/Tests/Runtime/Scripts/Export/GltfWritableMock.cs +++ b/Tests/Runtime/Scripts/Export/GltfWritableMock.cs @@ -39,6 +39,11 @@ public uint AddNode(float3? translation = null, quaternion? rotation = null, flo } public void AddMeshToNode(int nodeId, Mesh uMesh, int[] materialIds) + { + AddMeshToNode(nodeId, uMesh, materialIds, true); + } + + public void AddMeshToNode(int nodeId, Mesh uMesh, int[] materialIds, bool skinning) { throw new NotImplementedException(); } diff --git a/Tests/Runtime/Scripts/Export/GltfWriterTests.cs b/Tests/Runtime/Scripts/Export/GltfWriterTests.cs index 18d07367..d712b0b1 100644 --- a/Tests/Runtime/Scripts/Export/GltfWriterTests.cs +++ b/Tests/Runtime/Scripts/Export/GltfWriterTests.cs @@ -113,7 +113,7 @@ static async Task DracoUncompressedFallback(ICodeLogger logger) var node = writer.AddNode(); var tmpGameObject = GameObject.CreatePrimitive(PrimitiveType.Plane); - writer.AddMeshToNode((int)node, tmpGameObject.GetComponent().sharedMesh, null); + writer.AddMeshToNode((int)node, tmpGameObject.GetComponent().sharedMesh, null, false); await writer.SaveToStreamAndDispose(new MemoryStream()); diff --git a/Tests/Runtime/Scripts/Export/SceneRootObjectTestCaseAttribute.cs b/Tests/Runtime/Scripts/Export/SceneRootObjectTestCaseAttribute.cs index 821c3fcb..5db50905 100644 --- a/Tests/Runtime/Scripts/Export/SceneRootObjectTestCaseAttribute.cs +++ b/Tests/Runtime/Scripts/Export/SceneRootObjectTestCaseAttribute.cs @@ -13,7 +13,7 @@ namespace GLTFast.Tests.Export { - public class SceneRootObjectTestCaseAttribute : UnityEngine.TestTools.UnityTestAttribute, ITestBuilder + class SceneRootObjectTestCaseAttribute : UnityEngine.TestTools.UnityTestAttribute, ITestBuilder { string m_Suffix; diff --git a/Tests/Runtime/Scripts/Export/VertexAttributeUsageTests.cs b/Tests/Runtime/Scripts/Export/VertexAttributeUsageTests.cs new file mode 100644 index 00000000..bcfda43b --- /dev/null +++ b/Tests/Runtime/Scripts/Export/VertexAttributeUsageTests.cs @@ -0,0 +1,33 @@ +// SPDX-FileCopyrightText: 2024 Unity Technologies and the glTFast authors +// SPDX-License-Identifier: Apache-2.0 + +using System; +using GLTFast.Export; +using NUnit.Framework; +using UnityEngine; +using UnityEngine.Rendering; + +namespace GLTFast.Tests.Export +{ + class VertexAttributeUsageTests + { + [Test] + public void ToVertexAttributeUsage() + { + Assert.AreEqual(VertexAttributeUsage.Position, VertexAttribute.Position.ToVertexAttributeUsage()); + Assert.AreEqual(VertexAttributeUsage.Normal, VertexAttribute.Normal.ToVertexAttributeUsage()); + Assert.AreEqual(VertexAttributeUsage.Tangent, VertexAttribute.Tangent.ToVertexAttributeUsage()); + Assert.AreEqual(VertexAttributeUsage.Color, VertexAttribute.Color.ToVertexAttributeUsage()); + Assert.AreEqual(VertexAttributeUsage.TexCoord0, VertexAttribute.TexCoord0.ToVertexAttributeUsage()); + Assert.AreEqual(VertexAttributeUsage.TexCoord1, VertexAttribute.TexCoord1.ToVertexAttributeUsage()); + Assert.AreEqual(VertexAttributeUsage.TexCoord2, VertexAttribute.TexCoord2.ToVertexAttributeUsage()); + Assert.AreEqual(VertexAttributeUsage.TexCoord3, VertexAttribute.TexCoord3.ToVertexAttributeUsage()); + Assert.AreEqual(VertexAttributeUsage.TexCoord4, VertexAttribute.TexCoord4.ToVertexAttributeUsage()); + Assert.AreEqual(VertexAttributeUsage.TexCoord5, VertexAttribute.TexCoord5.ToVertexAttributeUsage()); + Assert.AreEqual(VertexAttributeUsage.TexCoord6, VertexAttribute.TexCoord6.ToVertexAttributeUsage()); + Assert.AreEqual(VertexAttributeUsage.TexCoord7, VertexAttribute.TexCoord7.ToVertexAttributeUsage()); + Assert.AreEqual(VertexAttributeUsage.BlendWeight, VertexAttribute.BlendWeight.ToVertexAttributeUsage()); + Assert.AreEqual(VertexAttributeUsage.BlendIndices, VertexAttribute.BlendIndices.ToVertexAttributeUsage()); + } + } +} diff --git a/Tests/Runtime/Scripts/Export/VertexAttributeUsageTests.cs.meta b/Tests/Runtime/Scripts/Export/VertexAttributeUsageTests.cs.meta new file mode 100644 index 00000000..92ba0937 --- /dev/null +++ b/Tests/Runtime/Scripts/Export/VertexAttributeUsageTests.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 13737a9256abd43fba5aa7d746855091 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Runtime/Scripts/JobTests.cs b/Tests/Runtime/Scripts/JobTests.cs index 456f6169..b7041c9a 100644 --- a/Tests/Runtime/Scripts/JobTests.cs +++ b/Tests/Runtime/Scripts/JobTests.cs @@ -15,7 +15,7 @@ namespace GLTFast.Tests.Jobs { [TestFixture] - public class Vector3Jobs + class Vector3Jobs { const int k_Length = 10; @@ -274,7 +274,7 @@ public unsafe void ConvertNormalsInt8ToFloatInterleavedNormalizedJob() } [TestFixture] - public class PositionSparseJobs + class PositionSparseJobs { const int k_Length = 10; @@ -337,7 +337,7 @@ public unsafe void ConvertPositionsSparseJob() } [TestFixture] - public class UVJobs + class UVJobs { const int k_UVLength = 10; float2 m_NormalizedReference = new float2(.5f, 0f); @@ -590,7 +590,7 @@ public unsafe void ConvertUVsFloatToFloatInterleavedJob() } [TestFixture] - public class Vector4Jobs + class Vector4Jobs { const int k_RotationLength = 10; float4 m_NormalizedReference = new float4(0.844623f, -0.191342f, -0.46194f, 0.191342f); @@ -811,7 +811,7 @@ public unsafe void ConvertTangentsInt8ToFloatInterleavedNormalizedJob() } [TestFixture] - public class ColorJobs + class ColorJobs { const int k_ColorLength = 10; Color m_ReferenceRGB = new Color(.13f, .42f, .95f, 1f); @@ -950,7 +950,7 @@ public unsafe void ConvertColorsRGBAUInt8ToRGBAFloatJob() } [TestFixture] - public class BoneIndexJobs + class BoneIndexJobs { const int k_BoneIndexLength = 10; uint4 m_Reference = new uint4(2, 3, 4, 5); @@ -1020,7 +1020,7 @@ public unsafe void ConvertBoneJointsUInt16ToUInt32Job() } [TestFixture] - public class SortJointsJobs + class SortJointsJobs { const int k_BoneIndexLength = 24; @@ -1112,7 +1112,7 @@ public static System.Collections.Generic.IEnumerable AllFour() } [TestFixture] - public class MatrixJobs + class MatrixJobs { const int k_MatrixLength = 10; static readonly Matrix4x4 k_Reference = new Matrix4x4( @@ -1159,7 +1159,7 @@ public unsafe void ConvertMatricesJob() } [TestFixture] - public class IndexJobs + class IndexJobs { const int k_IndexLength = 12; // multiple of 3! NativeArray m_InputUInt8; @@ -1319,7 +1319,7 @@ public unsafe void ConvertIndicesUInt32ToInt32FlippedJob() } [TestFixture] - public class ScalarJobs + class ScalarJobs { const int k_ScalarLength = 10; NativeArray m_InputInt8; From f7567d69365eecb82e8c2476026c67e41d3d6f87 Mon Sep 17 00:00:00 2001 From: Andreas Atteneder Date: Tue, 7 May 2024 23:57:39 +0200 Subject: [PATCH 09/18] fix: Corrected copyright text in some SPDX headers. (#137) --- CHANGELOG.md | 7 ++++--- Tests/Editor/PreprocessBuild.cs | 2 +- .../Scripts/Export/SceneRootObjectTestCaseAttribute.cs | 2 +- Tests/Runtime/Scripts/Import/GltfTestCaseAttribute.cs | 2 +- Tests/Runtime/Scripts/Import/GltfTestCaseFilter.cs | 2 +- Tests/Runtime/Scripts/Import/LoadGltfTestCaseSet.cs | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 527dfd7b..4e7ec175 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,18 +14,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Faster buffer conversion jobs due to batching via [`IJobParallelForBatch`](https://docs.unity3d.com/Packages/com.unity.collections@2.4/api/Unity.Jobs.IJobParallelForBatch.html). +- (Export) Material exporter implementation is chosen based on used shader by default. - (Export) Vertex attributes are discarded if they are not used/referenced. ### Fixed - (Export) Discrepancy in color due to export of unused vertex colors. +### Fixed +- Incorrect copyright text in some SPDX headers. + ### Removed - Soft dependency on deprecated [Unity Jobs package][JobsPkg]. - Legacy code for Unity versions older than the minimum required 2020 LTS. -### Changed -- Material exporter implementation is chosen based on used shader by default. - ## [6.4.0] - 2024-04-17 ### Added diff --git a/Tests/Editor/PreprocessBuild.cs b/Tests/Editor/PreprocessBuild.cs index 1c7308bc..f1ef76f4 100644 --- a/Tests/Editor/PreprocessBuild.cs +++ b/Tests/Editor/PreprocessBuild.cs @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2023 Unity Technologies and the Draco for Unity authors +// SPDX-FileCopyrightText: 2023 Unity Technologies and the glTFast authors // SPDX-License-Identifier: Apache-2.0 using System; diff --git a/Tests/Runtime/Scripts/Export/SceneRootObjectTestCaseAttribute.cs b/Tests/Runtime/Scripts/Export/SceneRootObjectTestCaseAttribute.cs index 5db50905..a9842c68 100644 --- a/Tests/Runtime/Scripts/Export/SceneRootObjectTestCaseAttribute.cs +++ b/Tests/Runtime/Scripts/Export/SceneRootObjectTestCaseAttribute.cs @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2024 Unity Technologies and the Draco for Unity authors +// SPDX-FileCopyrightText: 2024 Unity Technologies and the glTFast authors // SPDX-License-Identifier: Apache-2.0 using System; diff --git a/Tests/Runtime/Scripts/Import/GltfTestCaseAttribute.cs b/Tests/Runtime/Scripts/Import/GltfTestCaseAttribute.cs index 684eaac4..5edfb89e 100644 --- a/Tests/Runtime/Scripts/Import/GltfTestCaseAttribute.cs +++ b/Tests/Runtime/Scripts/Import/GltfTestCaseAttribute.cs @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2023 Unity Technologies and the Draco for Unity authors +// SPDX-FileCopyrightText: 2023 Unity Technologies and the glTFast authors // SPDX-License-Identifier: Apache-2.0 using System; diff --git a/Tests/Runtime/Scripts/Import/GltfTestCaseFilter.cs b/Tests/Runtime/Scripts/Import/GltfTestCaseFilter.cs index 88ca80c9..a489e1ee 100644 --- a/Tests/Runtime/Scripts/Import/GltfTestCaseFilter.cs +++ b/Tests/Runtime/Scripts/Import/GltfTestCaseFilter.cs @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2024 Unity Technologies and the Draco for Unity authors +// SPDX-FileCopyrightText: 2024 Unity Technologies and the glTFast authors // SPDX-License-Identifier: Apache-2.0 using System; diff --git a/Tests/Runtime/Scripts/Import/LoadGltfTestCaseSet.cs b/Tests/Runtime/Scripts/Import/LoadGltfTestCaseSet.cs index 32a1b1bb..130844e4 100644 --- a/Tests/Runtime/Scripts/Import/LoadGltfTestCaseSet.cs +++ b/Tests/Runtime/Scripts/Import/LoadGltfTestCaseSet.cs @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2024 Unity Technologies and the Draco for Unity authors +// SPDX-FileCopyrightText: 2024 Unity Technologies and the glTFast authors // SPDX-License-Identifier: Apache-2.0 #if !(UNITY_ANDROID || UNITY_WEBGL) || UNITY_EDITOR From a71e6a5e6dff1256a6f773b02513edf9be6e2fba Mon Sep 17 00:00:00 2001 From: Andreas Atteneder Date: Wed, 8 May 2024 09:07:11 +0200 Subject: [PATCH 10/18] fix: Added missing XML documentation comments. (#138) --- CHANGELOG.md | 1 + Runtime/Scripts/Export/KhrLightsPunctual.cs | 8 ++++++++ Runtime/Scripts/Logging/CollectingLogger.cs | 2 ++ 3 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e7ec175..7c53e773 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Dependency on [Unity Collections package][Collections]. - Added Apple Privacy Manifest documentation. - Export sample code. +- XML documentation comments. ### Changed - Faster buffer conversion jobs due to batching via [`IJobParallelForBatch`](https://docs.unity3d.com/Packages/com.unity.collections@2.4/api/Unity.Jobs.IJobParallelForBatch.html). diff --git a/Runtime/Scripts/Export/KhrLightsPunctual.cs b/Runtime/Scripts/Export/KhrLightsPunctual.cs index 60cf916f..90c22196 100644 --- a/Runtime/Scripts/Export/KhrLightsPunctual.cs +++ b/Runtime/Scripts/Export/KhrLightsPunctual.cs @@ -10,8 +10,16 @@ namespace GLTFast.Export { + /// + /// Provides conversion from Unity light components to glTF lights. + /// public static class KhrLightsPunctual { + /// + /// Converts a Unity light component to a glTF light. + /// + /// Unity light component. + /// glTF light. public static LightPunctual ConvertToLight(Light uLight) { var light = new LightPunctual diff --git a/Runtime/Scripts/Logging/CollectingLogger.cs b/Runtime/Scripts/Logging/CollectingLogger.cs index c391650c..d0227773 100644 --- a/Runtime/Scripts/Logging/CollectingLogger.cs +++ b/Runtime/Scripts/Logging/CollectingLogger.cs @@ -174,6 +174,7 @@ public override string ToString() return LogMessages.GetFullMessage(Code, Messages); } + /// public override int GetHashCode() { #if NET_STANDARD @@ -203,6 +204,7 @@ public override int GetHashCode() #endif } + /// public override bool Equals(object obj) { //Check for null and compare run-time types. From c2c0d18137216c67ef296f150ab5263bdaea170f Mon Sep 17 00:00:00 2001 From: Andreas Atteneder Date: Wed, 8 May 2024 09:40:55 +0200 Subject: [PATCH 11/18] fix: Changed test case naming scheme for easier identification. (#139) --- Tests/Runtime/Scripts/Import/GltfTestCaseAttribute.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/Runtime/Scripts/Import/GltfTestCaseAttribute.cs b/Tests/Runtime/Scripts/Import/GltfTestCaseAttribute.cs index 5edfb89e..5dfd50d5 100644 --- a/Tests/Runtime/Scripts/Import/GltfTestCaseAttribute.cs +++ b/Tests/Runtime/Scripts/Import/GltfTestCaseAttribute.cs @@ -78,7 +78,7 @@ IEnumerable ITestBuilder.BuildFrom(IMethodInfo method, Test suite) nameCounts[origName] = 1; } - data.SetName(testCase.relativeUri); + data.SetName($"{method.Name}.{name}"); data.ExpectedResult = new UnityEngine.Object(); data.HasExpectedResult = true; From dcfccea9e77f570d055e6072e0d2b5d7cc5904b7 Mon Sep 17 00:00:00 2001 From: Andreas Atteneder Date: Wed, 8 May 2024 14:55:42 +0200 Subject: [PATCH 12/18] feat: `float4x4.Decompose` overload that outputs rotation as type `quaternion`. (#140) * doc: Fixed duplicate headline. * feat: `float4x4.Decompose` overload that outputs rotation as type `quaternion`. * Deprecated `float4x4.Decompose` overload that outputs rotation as type `float4` (quaternion values). --- CHANGELOG.md | 6 +- Runtime/Scripts/Mathematics.cs | 26 ++++-- Tests/Runtime/Scripts/MatrixExtensionTest.cs | 86 +++++++++++++++----- 3 files changed, 88 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c53e773..327d70f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added Apple Privacy Manifest documentation. - Export sample code. - XML documentation comments. +- `float4x4.Decompose` overload that outputs rotation as type `quaternion`. ### Changed - Faster buffer conversion jobs due to batching via [`IJobParallelForBatch`](https://docs.unity3d.com/Packages/com.unity.collections@2.4/api/Unity.Jobs.IJobParallelForBatch.html). @@ -20,10 +21,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - (Export) Discrepancy in color due to export of unused vertex colors. - -### Fixed - Incorrect copyright text in some SPDX headers. +### Deprecated +- `float4x4.Decompose` overload that outputs rotation as type `float4` (quaternion values). + ### Removed - Soft dependency on deprecated [Unity Jobs package][JobsPkg]. - Legacy code for Unity versions older than the minimum required 2020 LTS. diff --git a/Runtime/Scripts/Mathematics.cs b/Runtime/Scripts/Mathematics.cs index c2a1f965..f318aee2 100644 --- a/Runtime/Scripts/Mathematics.cs +++ b/Runtime/Scripts/Mathematics.cs @@ -1,6 +1,7 @@ // SPDX-FileCopyrightText: 2023 Unity Technologies and the glTFast authors // SPDX-License-Identifier: Apache-2.0 +using System; using UnityEngine; using static Unity.Mathematics.math; @@ -35,8 +36,8 @@ out Vector3 scale m.m10, m.m11, m.m12, m.m20, m.m21, m.m22 ); - mRotScale.Decompose(out float4 mRotation, out float3 mScale); - rotation = new Quaternion(mRotation.x, mRotation.y, mRotation.z, mRotation.w); + mRotScale.Decompose(out var mRotation, out var mScale); + rotation = mRotation; scale = new Vector3(mScale.x, mScale.y, mScale.z); } @@ -51,7 +52,7 @@ out Vector3 scale public static void Decompose( this float4x4 m, out float3 translation, - out float4 rotation, + out quaternion rotation, out float3 scale ) { @@ -70,7 +71,7 @@ out float3 scale /// Input matrix /// Rotation quaternion values /// Scale - static void Decompose(this float3x3 m, out float4 rotation, out float3 scale) + static void Decompose(this float3x3 m, out quaternion rotation, out float3 scale) { var lenC0 = length(m.c0); var lenC1 = length(m.c1); @@ -96,7 +97,7 @@ static void Decompose(this float3x3 m, out float4 rotation, out float3 scale) rotationMatrix.c1 = math.normalize(rotationMatrix.c1); rotationMatrix.c2 = math.normalize(rotationMatrix.c2); - rotation = new quaternion(rotationMatrix).value; + rotation = new quaternion(rotationMatrix); } static bool IsNegative(this float3x3 m) @@ -113,9 +114,22 @@ static bool IsNegative(this float3x3 m) /// Length/magnitude of input vector public static float Normalize(float2 input, out float2 output) { - float len = math.length(input); + var len = math.length(input); output = input / len; return len; } + + /// + [Obsolete("Use Decompose overload with rotation parameter of type quaternion.")] + public static void Decompose( + this float4x4 m, + out float3 translation, + out float4 rotation, + out float3 scale + ) + { + m.Decompose(out translation, out quaternion rotationQuaternion, out scale); + rotation = rotationQuaternion.value; + } } } diff --git a/Tests/Runtime/Scripts/MatrixExtensionTest.cs b/Tests/Runtime/Scripts/MatrixExtensionTest.cs index f1746e3c..dc5d3a83 100644 --- a/Tests/Runtime/Scripts/MatrixExtensionTest.cs +++ b/Tests/Runtime/Scripts/MatrixExtensionTest.cs @@ -11,12 +11,20 @@ namespace GLTFast.Tests { class MatrixExtensionTest { + static Vector3EqualityComparer s_Vector3Comparer; + static QuaternionEqualityComparer s_QuaternionComparer; - [Test] - public void MatrixDecomposeTest() + static Matrix4x4 s_UnityMatrix; + static float4x4 s_Matrix; + + [OneTimeSetUp] + public void OneTimeSetUp() { + s_Vector3Comparer = new Vector3EqualityComparer(10e-6f); + s_QuaternionComparer = new QuaternionEqualityComparer(10e-6f); + // Corner case matrix (90°/0°/45° rotation with -1/-1/-1 scale) - var m = new Matrix4x4( + s_UnityMatrix = new Matrix4x4( new Vector4( -0.7071067811865474f, 0f, @@ -43,43 +51,77 @@ public void MatrixDecomposeTest() ) ); - var m2 = new float4x4( - m.m00, m.m01, m.m02, m.m03, - m.m10, m.m11, m.m12, m.m13, - m.m20, m.m21, m.m22, m.m23, - m.m30, m.m31, m.m32, m.m33 + s_Matrix = new float4x4( + s_UnityMatrix.m00, s_UnityMatrix.m01, s_UnityMatrix.m02, s_UnityMatrix.m03, + s_UnityMatrix.m10, s_UnityMatrix.m11, s_UnityMatrix.m12, s_UnityMatrix.m13, + s_UnityMatrix.m20, s_UnityMatrix.m21, s_UnityMatrix.m22, s_UnityMatrix.m23, + s_UnityMatrix.m30, s_UnityMatrix.m31, s_UnityMatrix.m32, s_UnityMatrix.m33 ); + } + [Test] + public void MatrixDecomposeTest() + { Profiler.BeginSample("Matrix4x4.DecomposeUnity"); - if (m.ValidTRS()) + if (s_UnityMatrix.ValidTRS()) { // ReSharper disable UnusedVariable - var t1 = new Vector3(m.m03, m.m13, m.m23); - var r1 = m.rotation; - var s1 = m.lossyScale; + var t1 = new Vector3(s_UnityMatrix.m03, s_UnityMatrix.m13, s_UnityMatrix.m23); + var r1 = s_UnityMatrix.rotation; + var s1 = s_UnityMatrix.lossyScale; // ReSharper restore UnusedVariable } Profiler.EndSample(); Profiler.BeginSample("Matrix4x4.DecomposeCustom"); - m.Decompose(out var t, out var r, out var s); + s_UnityMatrix.Decompose(out var t, out var r, out var s); Profiler.EndSample(); - var comparer3 = new Vector3EqualityComparer(10e-6f); - var comparer4 = new QuaternionEqualityComparer(10e-6f); + Assert.That(t, Is.EqualTo(new Vector3(0, 0, 0)).Using(s_Vector3Comparer)); + Assert.That(r, Is.EqualTo( + new Quaternion(0.65328151f, -0.270598054f, 0.270598054f, 0.65328151f)) + .Using(s_QuaternionComparer) + ); + Assert.That(s, Is.EqualTo(new Vector3(-.99999994f, -.99999994f, -1)).Using(s_Vector3Comparer)); - Assert.That(t, Is.EqualTo(new Vector3(0, 0, 0)).Using(comparer3)); - Assert.That(r, Is.EqualTo(new Quaternion(0.65328151f, -0.270598054f, 0.270598054f, 0.65328151f)).Using(comparer4)); - Assert.That(s, Is.EqualTo(new Vector3(-.99999994f, -.99999994f, -1)).Using(comparer3)); + Profiler.BeginSample("float4x4.Decompose"); + s_Matrix.Decompose(out var t3, out quaternion r3, out var s3); + Profiler.EndSample(); + Assert.That((Vector3)t3, Is.EqualTo(new Vector3(0, 0, 0)).Using(s_Vector3Comparer)); + Assert.That( + (Quaternion)r3, + Is.EqualTo(new Quaternion(0.65328151f, -0.270598054f, 0.270598054f, 0.65328151f)) + .Using(s_QuaternionComparer) + ); + Assert.That( + (Vector3)s3, + Is.EqualTo(new Vector3(-.99999994f, -.99999994f, -1)) + .Using(s_Vector3Comparer) + ); + } + + [Test] + public void MatrixDecomposeObsoleteTest() + { Profiler.BeginSample("float4x4.Decompose"); - m2.Decompose(out var t3, out var r3, out var s3); +#pragma warning disable CS0618 // Type or member is obsolete + s_Matrix.Decompose(out var translation, out float4 rotationValues, out var scale); +#pragma warning restore CS0618 // Type or member is obsolete Profiler.EndSample(); - Assert.That((Vector3)t3, Is.EqualTo(new Vector3(0, 0, 0)).Using(comparer3)); - Assert.That((Quaternion)new quaternion(r3), Is.EqualTo(new Quaternion(0.65328151f, -0.270598054f, 0.270598054f, 0.65328151f)).Using(comparer4)); - Assert.That((Vector3)s3, Is.EqualTo(new Vector3(-.99999994f, -.99999994f, -1)).Using(comparer3)); + Assert.That((Vector3)translation, Is.EqualTo(new Vector3(0, 0, 0)).Using(s_Vector3Comparer)); + Assert.That( + (Quaternion)new quaternion(rotationValues), + Is.EqualTo(new Quaternion(0.65328151f, -0.270598054f, 0.270598054f, 0.65328151f)) + .Using(s_QuaternionComparer) + ); + Assert.That( + (Vector3)scale, + Is.EqualTo(new Vector3(-.99999994f, -.99999994f, -1)) + .Using(s_Vector3Comparer) + ); } // [Test] From a4dcae0aeded69144e7f76c90925a8eb61b708f9 Mon Sep 17 00:00:00 2001 From: Andreas Atteneder Date: Mon, 13 May 2024 13:37:49 +0200 Subject: [PATCH 13/18] feat: Export with custom scene origin (#141) * feat: AddScene overload that accepts a scene origin transformation matrix. --- CHANGELOG.md | 2 + Runtime/Scripts/Export/GameObjectExport.cs | 73 +++++++++--- .../Scripts/Export/SceneOriginTests.cs | 105 ++++++++++++++++++ .../Scripts/Export/SceneOriginTests.cs.meta | 11 ++ 4 files changed, 175 insertions(+), 16 deletions(-) create mode 100644 Tests/Runtime/Scripts/Export/SceneOriginTests.cs create mode 100644 Tests/Runtime/Scripts/Export/SceneOriginTests.cs.meta diff --git a/CHANGELOG.md b/CHANGELOG.md index 327d70f4..d3a6896d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - (Export) Support for exporting glTFast shader based materials. This reduces data loss on import-export round trips considerably. +- (Export) Support for setting a custom scene origin via transform matrix. - Dependency on [Unity Collections package][Collections]. - Added Apple Privacy Manifest documentation. - Export sample code. @@ -18,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Faster buffer conversion jobs due to batching via [`IJobParallelForBatch`](https://docs.unity3d.com/Packages/com.unity.collections@2.4/api/Unity.Jobs.IJobParallelForBatch.html). - (Export) Material exporter implementation is chosen based on used shader by default. - (Export) Vertex attributes are discarded if they are not used/referenced. +- (Export) Root level nodes' positions are based on their GameObject's world positions (and not their local position anymore). ### Fixed - (Export) Discrepancy in color due to export of unused vertex colors. diff --git a/Runtime/Scripts/Export/GameObjectExport.cs b/Runtime/Scripts/Export/GameObjectExport.cs index 0817eb62..72ee2e40 100644 --- a/Runtime/Scripts/Export/GameObjectExport.cs +++ b/Runtime/Scripts/Export/GameObjectExport.cs @@ -6,6 +6,7 @@ using System.IO; using System.Threading; using System.Threading.Tasks; +using Unity.Mathematics; using UnityEngine; namespace GLTFast.Export @@ -46,25 +47,39 @@ public GameObjectExport( } /// - /// Adds a scene to the glTF. - /// If the conversion to glTF was not flawless (i.e. parts of the scene - /// were not converted 100% correctly) you still might be able to - /// export a glTF. You may use the - /// to analyze what exactly went wrong. + /// Adds a scene to the glTF which consists of a collection of GameObjects. /// - /// Root level GameObjects (will get added recursively) + /// GameObjects to be added (recursively) as root level nodes. /// Name of the scene - /// True if the scene was added flawlessly, false otherwise + /// True, if the scene was added flawlessly. False, otherwise public bool AddScene(GameObject[] gameObjects, string name = null) + { + return AddScene(gameObjects, float4x4.identity, name); + } + + /// + /// Creates a glTF scene from a collection of GameObjects. The GameObjects will be converted into glTF nodes. + /// The nodes' positions within the glTF scene will be their GameObjects' world position transformed by the + /// matrix, essentially allowing you to set an arbitrary scene center. + /// + /// Root level GameObjects (will get added recursively) + /// Inverse scene origin matrix. This transform will be applied to all nodes. + /// Name of the scene + /// True if the scene was added successfully, false otherwise + public bool AddScene(ICollection gameObjects, float4x4 origin, string name) { CertifyNotDisposed(); - var rootNodes = new List(gameObjects.Length); + var rootNodes = new List(gameObjects.Count); var tempMaterials = new List(); var success = true; - for (var index = 0; index < gameObjects.Length; index++) + foreach (var gameObject in gameObjects) { - var gameObject = gameObjects[index]; - success &= AddGameObject(gameObject, tempMaterials, out var nodeId); + success &= AddGameObject( + gameObject, + origin, + tempMaterials, + out var nodeId + ); if (nodeId >= 0) { rootNodes.Add((uint)nodeId); @@ -123,7 +138,11 @@ void CertifyNotDisposed() throw new InvalidOperationException("GameObjectExport was already disposed"); } } - bool AddGameObject(GameObject gameObject, List tempMaterials, out int nodeId) + bool AddGameObject( + GameObject gameObject, + float4x4? sceneOrigin, + List tempMaterials, + out int nodeId) { if (m_Settings.OnlyActiveInHierarchy && !gameObject.activeInHierarchy || gameObject.CompareTag("EditorOnly")) @@ -141,7 +160,12 @@ bool AddGameObject(GameObject gameObject, List tempMaterials, out int for (var i = 0; i < childCount; i++) { var child = gameObject.transform.GetChild(i); - success &= AddGameObject(child.gameObject, tempMaterials, out var childNodeId); + success &= AddGameObject( + child.gameObject, + null, + tempMaterials, + out var childNodeId + ); if (childNodeId >= 0) { childList.Add((uint)childNodeId); @@ -159,10 +183,27 @@ bool AddGameObject(GameObject gameObject, List tempMaterials, out int if (onIncludedLayer || children != null) { + float3 translation; + quaternion rotation; + float3 scale; + + if (sceneOrigin.HasValue) + { + // root level node - calculate transform based on scene origin + var trans = math.mul(sceneOrigin.Value, transform.localToWorldMatrix); + trans.Decompose(out translation, out rotation, out scale); + } + else + { + // nested node - use local transform + translation = transform.localPosition; + rotation = transform.localRotation; + scale = transform.localScale; + } nodeId = (int)m_Writer.AddNode( - transform.localPosition, - transform.localRotation, - transform.localScale, + translation, + rotation, + scale, children, gameObject.name ); diff --git a/Tests/Runtime/Scripts/Export/SceneOriginTests.cs b/Tests/Runtime/Scripts/Export/SceneOriginTests.cs new file mode 100644 index 00000000..f4dabd1e --- /dev/null +++ b/Tests/Runtime/Scripts/Export/SceneOriginTests.cs @@ -0,0 +1,105 @@ +// SPDX-FileCopyrightText: 2024 Unity Technologies and the glTFast authors +// SPDX-License-Identifier: Apache-2.0 + +using System.Collections; +using System.IO; +using System.Threading.Tasks; +using GLTFast.Export; +using GLTFast.Logging; +using GLTFast.Schema; +using NUnit.Framework; +using Unity.Mathematics; +using UnityEngine; +using UnityEngine.TestTools; +using UnityEngine.TestTools.Utils; + +namespace GLTFast.Tests.Export +{ + class SceneOriginTests + { + static Vector3EqualityComparer s_Vector3Comparer; + static QuaternionEqualityComparer s_QuaternionComparer; + + [OneTimeSetUp] + public void OneTimeSetUp() + { + s_Vector3Comparer = new Vector3EqualityComparer(10e-6f); + s_QuaternionComparer = new QuaternionEqualityComparer(10e-6f); + } + + [UnityTest] + public IEnumerator SceneOrigin() + { + var task = ExportScene( + new float3(42, 0, 0), + new float3(0, 13, 0) + ); + yield return AsyncWrapper.WaitForTask(task); + var node = task.Result; + node.GetTransform(out var position, out _, out _); + Assert.That(position, Is.EqualTo(new Vector3(42, 13, 0)).Using(s_Vector3Comparer)); + } + + [UnityTest] + public IEnumerator SceneOriginRotated() + { + var task = ExportScene( + new float3(42, 0, 0), + new float3(0, 13, 0), + math.inverse(float4x4.TRS( + new float3(0, 0, 7), + quaternion.Euler(0, math.PIHALF, 0), + new float3(.1f)) + ) + ); + yield return AsyncWrapper.WaitForTask(task); + var node = task.Result; + node.GetTransform(out var position, out var rotation, out var scale); + Assert.That(position, Is.EqualTo(new Vector3(70, 130, 420)).Using(s_Vector3Comparer)); + Assert.That( + rotation, + Is.EqualTo(Quaternion.Euler(0, -90, 0)) + .Using(s_QuaternionComparer) + ); + Assert.That( + scale, + Is.EqualTo(new Vector3(10, 10, 10)).Using(s_Vector3Comparer)); + } + + static async Task ExportScene( + float3 parentPosition, + float3 nodePosition, + float4x4? sceneOrigin = null + ) + { + var root = new GameObject("root"); + root.transform.position = parentPosition; + + var node = new GameObject("node"); + node.transform.SetParent(root.transform, false); + node.transform.localPosition = nodePosition; + + var logger = new CollectingLogger(); + var export = new GameObjectExport(logger: logger); + export.AddScene(new[] { node }, sceneOrigin ?? float4x4.identity, "UnityScene"); + + var path = Path.Combine(Application.persistentDataPath, "SceneOrigin.gltf"); + var success = await export.SaveToFileAndDispose(path); + Assert.IsTrue(success); + LoggerTest.AssertLogger(logger); + + var jsonParser = new GltfJsonUtilityParser(); + var gltf = jsonParser.ParseJson( +#if UNITY_2021_3_OR_NEWER + await File.ReadAllTextAsync(path) +#else + File.ReadAllText(path) +#endif + ); + + Assert.IsNotNull(gltf?.Nodes); + Assert.AreEqual(1, gltf.Nodes.Count); + return gltf.Nodes[0]; + } + } +} diff --git a/Tests/Runtime/Scripts/Export/SceneOriginTests.cs.meta b/Tests/Runtime/Scripts/Export/SceneOriginTests.cs.meta new file mode 100644 index 00000000..df69fce3 --- /dev/null +++ b/Tests/Runtime/Scripts/Export/SceneOriginTests.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e5bd2e81dd8d14302b5833f41bd5410f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: From e53664c2e3535eb7724fdf45c4cf45b740d571e0 Mon Sep 17 00:00:00 2001 From: Andreas Atteneder Date: Tue, 14 May 2024 15:07:15 +0200 Subject: [PATCH 14/18] fix: Unified code coverage path and removed sample code from coverage. (#144) * fix(ci): Unified code coverage results path and removed duplicate UTR parameter. * fix(ci): Removed documentation sample code assembly from code coverage. --- .yamato/project-test.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.yamato/project-test.yml b/.yamato/project-test.yml index 7356edfa..0c777720 100644 --- a/.yamato/project-test.yml +++ b/.yamato/project-test.yml @@ -178,10 +178,9 @@ test_{{ test_setup.project_setup }}_{{ platform_id }}_{{ editor }}: --suite=playmode {% if is_coverage_set -%} --enable-code-coverage - --coverage-results-path={{ results_path }} - --coverage-options='generateAdditionalMetrics;generateHtmlReport;assemblyFilters:+glTFast*,+Unity.Cloud.Gltfast*,-glTFast*Tests*;pathReplacePatterns:**/PackageCache/com.unity.cloud.gltfast@*/,;sourcePaths:{{ os.yamato_source_dir }}/Packages/gltfast' - --coverage-results-path={{ os.yamato_source_dir }}/test-results~/CoverageResults - --coverage-upload-options="reportsDir:{{ os.yamato_source_dir }}/test-results~/CoverageResults;reports:*.xml;sourceDir:Packages/gltfast;repo:unity/com.unity.cloud.gltfast.src;changeset:{{ os.git_revision }};name:{{ test_setup.project_setup }}_{{ platform_id }}_{{ editor }};flags:{{ test_setup.project_setup }};verbose" + --coverage-results-path={{ results_path }}/CoverageResults + --coverage-options='generateAdditionalMetrics;generateHtmlReport;assemblyFilters:+glTFast*,-glTFast*Tests*;pathReplacePatterns:**/PackageCache/com.unity.cloud.gltfast@*/,;sourcePaths:{{ os.yamato_source_dir }}/Packages/gltfast' + --coverage-upload-options="reportsDir:{{ results_path }}/CoverageResults;reports:*.xml;sourceDir:Packages/gltfast;repo:unity/com.unity.cloud.gltfast.src;changeset:{{ os.git_revision }};name:{{ test_setup.project_setup }}_{{ platform_id }}_{{ editor }};flags:{{ test_setup.project_setup }};verbose" {% endif -%} {{ job_artifacts }} {% endif -%} From 2253315690e727deb262a5eac2530733fff84bda Mon Sep 17 00:00:00 2001 From: Andreas Atteneder Date: Tue, 14 May 2024 16:15:25 +0200 Subject: [PATCH 15/18] doc: Added documentation and sample code for export with custom scene origin. (#142) --- Documentation~/ExportRuntime.md | 8 +++++ Samples/Documentation/Manual/ExportSamples.cs | 31 +++++++++++++++++++ .../Unity.Cloud.Gltfast.Documentation.asmdef | 1 + 3 files changed, 40 insertions(+) diff --git a/Documentation~/ExportRuntime.md b/Documentation~/ExportRuntime.md index deef4709..956dee8d 100644 --- a/Documentation~/ExportRuntime.md +++ b/Documentation~/ExportRuntime.md @@ -32,6 +32,14 @@ Further, the export can be customized by passing [ExportSettings](xref:GLTFast.E > **NOTE:** Exporting to a [Stream][Stream] currently only works for self-contained glTF-Binary files (where the binary buffer and all textures are included in the `.glb` file). Trying other export settings will fail. +### Scene Origin + +When adding GameObjects to a glTF scene, the resulting glTF root nodes' positions will be their original GameObjects' world position in the Unity scene. That might be undesirable (e.g. if the scene is far off the origin and thus not centered), so [AddScene](xref:GLTFast.Export.GameObjectExport.AddScene(ICollection{UnityEngine.GameObject},Unity.Mathematics.float4x4,System.String)) allows you to provide an inverse scene origin matrix that'll be applied to all root-level nodes. + +Here's an example how to export a GameObject, discarding its transform: + +[!code-cs [local-transform](../Samples/Documentation/Manual/ExportSamples.cs#LocalTransform)] + ### Vertex Attribute Discarding In certain cases glTFast discards mesh vertex attributes that are not used or required. This not only reduces the resulting glTF's file size, but in case of vertex colors, is necessary to preserve visual consistency. diff --git a/Samples/Documentation/Manual/ExportSamples.cs b/Samples/Documentation/Manual/ExportSamples.cs index bf2c9566..4ff59b40 100644 --- a/Samples/Documentation/Manual/ExportSamples.cs +++ b/Samples/Documentation/Manual/ExportSamples.cs @@ -1,6 +1,7 @@ // SPDX-FileCopyrightText: 2024 Unity Technologies and the glTFast authors // SPDX-License-Identifier: Apache-2.0 +using System.Threading.Tasks; using UnityEngine.Serialization; namespace Samples.Documentation.Manual @@ -97,5 +98,35 @@ void ExportSettingsDraco() }; #endregion } + + async void Start() + { + await LocalTransform(); + } + + async Task LocalTransform() + { + #region LocalTransform + var export = new GameObjectExport(); + + // Add a scene + export.AddScene( + // Only the current gameObject as root node. + new[] { gameObject }, + // The worldToLocalMatrix counter-acts any world-space transform, effectively moving the resulting + // root node to the origin. + gameObject.transform.worldToLocalMatrix, + "Node at origin glTF scene" + ); + #endregion + + // Async glTF export + var success = await export.SaveToFileAndDispose(destinationFilePath); + + if (!success) + { + Debug.LogError("Something went wrong exporting a glTF"); + } + } } } diff --git a/Samples/Documentation/Unity.Cloud.Gltfast.Documentation.asmdef b/Samples/Documentation/Unity.Cloud.Gltfast.Documentation.asmdef index 0eaff2e5..6663ef82 100644 --- a/Samples/Documentation/Unity.Cloud.Gltfast.Documentation.asmdef +++ b/Samples/Documentation/Unity.Cloud.Gltfast.Documentation.asmdef @@ -2,6 +2,7 @@ "name": "Unity.Cloud.Gltfast.Documentation", "rootNamespace": "", "references": [ + "Unity.Mathematics", "glTFast", "glTFast.Export", "glTFast.Newtonsoft" From 77ba4b381f9387bd06280827939ea34b9705de9a Mon Sep 17 00:00:00 2001 From: Andreas Atteneder Date: Tue, 14 May 2024 22:17:26 +0200 Subject: [PATCH 16/18] fix(ci): Don't run performance tests. (#145) --- .yamato/package-test.yml | 23 +++++++++++++++++++---- .yamato/package.metafile | 1 + .yamato/project-test.yml | 4 ++++ 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/.yamato/package-test.yml b/.yamato/package-test.yml index e296745a..88025dbb 100644 --- a/.yamato/package-test.yml +++ b/.yamato/package-test.yml @@ -37,13 +37,20 @@ test_{{ platform.name }}_{{ editor }}: {% endfor -%} - npm install {% if platform.name == "win" %}"%UPMCI_PKG%"{% else %}"$UPMCI_PKG"{% endif %} -g --registry {{ registry.npm }} - - | + - > {% if platform.name == "win" -%} set GLTF_TEST_ASSET_DIR={{ os.yamato_source_dir }}\Assets {% else -%} export GLTF_TEST_ASSET_DIR="{{ os.yamato_source_dir }}/Assets" {% endif -%} - upm-ci package test -u {{ editor }} --package-path Packages/gltfast --type package-tests --extra-create-project-arg=-upmNoDefaultPackages + + upm-ci package test + -u {{ editor }} + --package-path Packages/gltfast + --type package-tests + --extra-create-project-arg=-upmNoDefaultPackages + --extra-utr-arg='--category="{{ test_categories }}"' + artifacts: logs: paths: @@ -93,13 +100,21 @@ validate_{{ platform.name }}_{{ editor }}: {% endfor -%} - npm install {% if platform.name == "win" %}"%UPMCI_PKG%"{% else %}"$UPMCI_PKG"{% endif %} -g --registry {{ registry.npm }} - - | + - > {% if platform.name == "win" -%} set GLTF_TEST_ASSET_DIR={{ os.yamato_source_dir }}\Assets {% else -%} export GLTF_TEST_ASSET_DIR="{{ os.yamato_source_dir }}/Assets" {% endif -%} - upm-ci package test -u {{ editor }} --package-path Packages/gltfast --type vetting-tests --platform editmode --extra-create-project-arg=-upmNoDefaultPackages + + upm-ci package test + -u {{ editor }} + --package-path Packages/gltfast + --type vetting-tests + --platform editmode + --extra-create-project-arg=-upmNoDefaultPackages + --extra-utr-arg='--category="{{ test_categories }}"' + artifacts: logs: paths: diff --git a/.yamato/package.metafile b/.yamato/package.metafile index ff13bd94..59c35c6e 100644 --- a/.yamato/package.metafile +++ b/.yamato/package.metafile @@ -171,6 +171,7 @@ registry: artifactory: https://artifactory.prd.cds.internal.unity3d.com/artifactory generic_project_path: Projects/TestProject +test_categories: "!Performance" # Operating system specific variables os_variables: diff --git a/.yamato/project-test.yml b/.yamato/project-test.yml index 0c777720..2c0d9380 100644 --- a/.yamato/project-test.yml +++ b/.yamato/project-test.yml @@ -176,6 +176,7 @@ test_{{ test_setup.project_setup }}_{{ platform_id }}_{{ editor }}: --extra-editor-arg="-enablePackageManagerTraces -upmNoDefaultPackages" --suite=editor --suite=playmode + --category="{{ test_categories }}" {% if is_coverage_set -%} --enable-code-coverage --coverage-results-path={{ results_path }}/CoverageResults @@ -314,6 +315,7 @@ build_and_run_{{ test_setup.project_setup }}_{{ platform_id }}_{{ editor }}: --verbose --extra-editor-arg="-enablePackageManagerTraces -upmNoDefaultPackages" --suite=playmode + --category="{{ test_categories }}" --scripting-backend=Il2Cpp --platform={% if platform.platform -%}{{ platform.platform }}{% else -%}{{ platform_id }}{% endif %} {{ job_artifacts }} @@ -448,6 +450,7 @@ build_{{ test_setup.project_setup }}_{{ platform_id }}_{{ editor }}: --verbose --extra-editor-arg="-enablePackageManagerTraces -upmNoDefaultPackages" --suite=playmode + --category="{{ test_categories }}" --scripting-backend=Il2Cpp --platform={% if platform.platform -%}{{ platform.platform }}{% else -%}{{ platform_id }}{% endif %} --build-only @@ -585,6 +588,7 @@ run_{{ test_setup.project_setup }}_{{ platform_id }}_{{ editor }}: --verbose --extra-editor-arg="-enablePackageManagerTraces -upmNoDefaultPackages" --suite=playmode + --category="{{ test_categories }}" --scripting-backend=Il2Cpp --platform={% if platform.platform -%}{{ platform.platform }}{% else -%}{{ platform_id }}{% endif %} --player-load-path={{ results_path }}/player From b7737dc72d9d9de990871a1563adbe5f74c6ba03 Mon Sep 17 00:00:00 2001 From: Andreas Atteneder Date: Wed, 15 May 2024 08:54:52 +0200 Subject: [PATCH 17/18] feat: HDRP test project setup (#143) * feat: HDRP test project setup * fix(test): Use linear color space when using URP/HDRP * fix: Addition of HDRP test case increased codecov runs to 4 (default, minimalistic, all_defines, hdrp). * fix: Corrected render pipeline asset name. * fix: Updated HDRP asset. --- .github/codecov.yml | 2 +- .yamato/package.metafile | 11 + Tests/Editor/SetupProject.cs | 3 +- Tests/Editor/glTFast.Editor.Tests.asmdef | 5 + .../RenderPipelineAssets/HDRP-Deferred.asset | 491 ++++++++++++++++++ .../HDRP-Deferred.asset.meta | 8 + 6 files changed, 518 insertions(+), 2 deletions(-) create mode 100644 Tests/Runtime/RenderPipelineAssets/HDRP-Deferred.asset create mode 100644 Tests/Runtime/RenderPipelineAssets/HDRP-Deferred.asset.meta diff --git a/.github/codecov.yml b/.github/codecov.yml index 507351be..9d0b09f7 100644 --- a/.github/codecov.yml +++ b/.github/codecov.yml @@ -29,7 +29,7 @@ comment: require_base: false require_head: false # Set this to the number of coverage jobs run in the PR - after_n_builds: 3 + after_n_builds: 4 flag_management: default_rules: diff --git a/.yamato/package.metafile b/.yamato/package.metafile index 59c35c6e..85859c24 100644 --- a/.yamato/package.metafile +++ b/.yamato/package.metafile @@ -46,6 +46,17 @@ test_setups: # default for coverage: windows + current LTS - platform: win editor: 2022 + - project_setup: hdrp + render_pipeline: HDRP-Deferred + editor_versions: [2022,trunk] + platforms: [win] + pr_sets: + - platform: win + editor: 2022 + coverage_sets: + # default for coverage: windows + current LTS + - platform: win + editor: 2022 editor_versions: - 2020 diff --git a/Tests/Editor/SetupProject.cs b/Tests/Editor/SetupProject.cs index 3d52dd65..42902ee5 100644 --- a/Tests/Editor/SetupProject.cs +++ b/Tests/Editor/SetupProject.cs @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: 2024 Unity Technologies and the glTFast authors // SPDX-License-Identifier: Apache-2.0 -#if USING_URP +#if USING_URP || USING_HDRP #define USING_SRP #endif @@ -102,6 +102,7 @@ public static void SetRenderPipeline() var subPath = arg.Substring(prefix.Length); var assetPath = $"{k_RenderPipelineAssetsPath}{subPath}.asset"; #if USING_SRP + PlayerSettings.colorSpace = ColorSpace.Linear; var asset = AssetDatabase.LoadAssetAtPath(assetPath); if (asset == null) { diff --git a/Tests/Editor/glTFast.Editor.Tests.asmdef b/Tests/Editor/glTFast.Editor.Tests.asmdef index 7047199b..ff3df371 100644 --- a/Tests/Editor/glTFast.Editor.Tests.asmdef +++ b/Tests/Editor/glTFast.Editor.Tests.asmdef @@ -28,6 +28,11 @@ "name": "com.unity.render-pipelines.universal", "expression": "", "define": "USING_URP" + }, + { + "name": "com.unity.render-pipelines.high-definition", + "expression": "", + "define": "USING_HDRP" } ], "noEngineReferences": false diff --git a/Tests/Runtime/RenderPipelineAssets/HDRP-Deferred.asset b/Tests/Runtime/RenderPipelineAssets/HDRP-Deferred.asset new file mode 100644 index 00000000..e91fdc5d --- /dev/null +++ b/Tests/Runtime/RenderPipelineAssets/HDRP-Deferred.asset @@ -0,0 +1,491 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0cf1dab834d4ec34195b920ea7bbf9ec, type: 3} + m_Name: HDRP-Deferred + m_EditorClassIdentifier: + m_RenderPipelineSettings: + supportShadowMask: 1 + supportSSR: 0 + supportSSRTransparent: 0 + supportSSAO: 1 + supportSSGI: 0 + supportSubsurfaceScattering: 1 + sssSampleBudget: + m_Values: 140000002800000050000000 + m_SchemaId: + m_Id: With3Levels + supportVolumetrics: 1 + supportVolumetricClouds: 0 + supportLightLayers: 0 + supportWater: 0 + waterSimulationResolution: 128 + waterCPUSimulation: 0 + supportDistortion: 1 + supportTransparentBackface: 1 + supportTransparentDepthPrepass: 1 + supportTransparentDepthPostpass: 1 + colorBufferFormat: 74 + supportCustomPass: 1 + customBufferFormat: 12 + supportedLitShaderMode: 2 + planarReflectionResolution: + m_Values: 000100000004000000080000 + m_SchemaId: + m_Id: With3Levels + cubeReflectionResolution: + m_Values: 000100000002000000040000 + m_SchemaId: + m_Id: With3Levels + supportDecals: 1 + supportDecalLayers: 0 + supportSurfaceGradient: 1 + decalNormalBufferHP: 0 + msaaSampleCount: 1 + supportMotionVectors: 1 + supportRuntimeAOVAPI: 0 + supportDitheringCrossFade: 1 + supportTerrainHole: 0 + lightProbeSystem: 0 + probeVolumeMemoryBudget: 1024 + probeVolumeBlendingMemoryBudget: 128 + supportProbeVolumeStreaming: 0 + probeVolumeSHBands: 1 + supportRayTracing: 0 + supportedRayTracingMode: 3 + lightLoopSettings: + cookieAtlasSize: 2048 + cookieFormat: 74 + cookieAtlasLastValidMip: 0 + cookieTexArraySize: 1 + planarReflectionAtlasSize: 1024 + reflectionProbeCacheSize: 64 + reflectionCubemapSize: 256 + maxEnvLightsOnScreen: 64 + reflectionCacheCompressed: 0 + reflectionProbeFormat: 74 + reflectionProbeTexCacheSize: 1073750016 + reflectionProbeTexLastValidCubeMip: 3 + reflectionProbeTexLastValidPlanarMip: 0 + reflectionProbeDecreaseResToFit: 1 + skyReflectionSize: 256 + skyLightingOverrideLayerMask: + serializedVersion: 2 + m_Bits: 0 + supportFabricConvolution: 0 + maxDirectionalLightsOnScreen: 16 + maxPunctualLightsOnScreen: 512 + maxAreaLightsOnScreen: 64 + maxCubeReflectionOnScreen: 48 + maxPlanarReflectionOnScreen: 16 + maxDecalsOnScreen: 512 + maxLightsPerClusterCell: 8 + maxLocalVolumetricFogSize: 32 + maxLocalVolumetricFogOnScreen: 64 + hdShadowInitParams: + maxShadowRequests: 128 + directionalShadowsDepthBits: 32 + shadowFilteringQuality: 1 + areaShadowFilteringQuality: 0 + punctualLightShadowAtlas: + shadowAtlasResolution: 4096 + shadowAtlasDepthBits: 32 + useDynamicViewportRescale: 1 + areaLightShadowAtlas: + shadowAtlasResolution: 4096 + shadowAtlasDepthBits: 32 + useDynamicViewportRescale: 1 + cachedPunctualLightShadowAtlas: 2048 + cachedAreaLightShadowAtlas: 1024 + allowDirectionalMixedCachedShadows: 0 + shadowResolutionDirectional: + m_Values: 00010000000200000004000000080000 + m_SchemaId: + m_Id: With4Levels + shadowResolutionPunctual: + m_Values: 00010000000200000004000000080000 + m_SchemaId: + m_Id: With4Levels + shadowResolutionArea: + m_Values: 00010000000200000004000000080000 + m_SchemaId: + m_Id: With4Levels + maxDirectionalShadowMapResolution: 2048 + maxPunctualShadowMapResolution: 2048 + maxAreaShadowMapResolution: 2048 + supportScreenSpaceShadows: 0 + maxScreenSpaceShadowSlots: 4 + screenSpaceShadowBufferFormat: 48 + decalSettings: + drawDistance: 1000 + atlasWidth: 4096 + atlasHeight: 4096 + perChannelMask: 0 + postProcessSettings: + m_LutSize: 32 + lutFormat: 48 + bufferFormat: 74 + dynamicResolutionSettings: + enabled: 0 + useMipBias: 0 + enableDLSS: 0 + DLSSPerfQualitySetting: 0 + DLSSInjectionPoint: 0 + DLSSUseOptimalSettings: 1 + DLSSSharpness: 0.5 + fsrOverrideSharpness: 0 + fsrSharpness: 0.92 + maxPercentage: 100 + minPercentage: 100 + dynResType: 1 + upsampleFilter: 1 + forceResolution: 0 + forcedPercentage: 100 + lowResTransparencyMinimumThreshold: 0 + rayTracingHalfResThreshold: 50 + lowresTransparentSettings: + enabled: 1 + checkerboardDepthBuffer: 1 + upsampleType: 1 + xrSettings: + singlePass: 1 + occlusionMesh: 1 + cameraJitter: 0 + allowMotionBlur: 0 + postProcessQualitySettings: + NearBlurSampleCount: 030000000500000008000000 + NearBlurMaxRadius: + - 2 + - 4 + - 7 + FarBlurSampleCount: 04000000070000000e000000 + FarBlurMaxRadius: + - 5 + - 8 + - 13 + DoFResolution: 040000000200000001000000 + DoFHighQualityFiltering: 000101 + DoFPhysicallyBased: 000000 + LimitManualRangeNearBlur: 000000 + MotionBlurSampleCount: 04000000080000000c000000 + BloomRes: 040000000200000002000000 + BloomHighQualityFiltering: 000101 + BloomHighQualityPrefiltering: 000001 + ChromaticAberrationMaxSamples: 03000000060000000c000000 + lightSettings: + useContactShadow: + m_Values: 000001 + m_SchemaId: + m_Id: With3Levels + maximumLODLevel: + m_Values: 000000000000000000000000 + m_SchemaId: + m_Id: With3Levels + lodBias: + m_Values: + - 1 + - 1 + - 1 + m_SchemaId: + m_Id: With3Levels + lightingQualitySettings: + AOStepCount: 040000000600000010000000 + AOFullRes: 000001 + AOMaximumRadiusPixels: 200000002800000050000000 + AOBilateralUpsample: 000101 + AODirectionCount: 010000000200000004000000 + ContactShadowSampleCount: 060000000a00000010000000 + SSRMaxRaySteps: 100000002000000040000000 + SSGIRaySteps: 200000004000000080000000 + SSGIDenoise: 010101 + SSGIHalfResDenoise: 010000 + SSGIDenoiserRadius: + - 0.75 + - 0.5 + - 0.5 + SSGISecondDenoise: 010101 + RTAORayLength: + - 0.5 + - 3 + - 20 + RTAOSampleCount: 010000000200000008000000 + RTAODenoise: 010101 + RTAODenoiserRadius: + - 0.25 + - 0.5 + - 0.65 + RTGIRayLength: + - 50 + - 50 + - 50 + RTGIFullResolution: 000001 + RTGIClampValue: + - 0.5 + - 0.8 + - 1.5 + RTGIRaySteps: 200000003000000040000000 + RTGIDenoise: 010101 + RTGIHalfResDenoise: 010000 + RTGIDenoiserRadius: + - 0.75 + - 0.5 + - 0.25 + RTGISecondDenoise: 010101 + RTRMinSmoothness: + - 0.6 + - 0.4 + - 0 + RTRSmoothnessFadeStart: + - 0.7 + - 0.5 + - 0 + RTRRayLength: + - 50 + - 50 + - 50 + RTRClampValue: + - 0.8 + - 1 + - 1.2 + RTRFullResolution: 000001 + RTRRayMaxIterations: 200000003000000040000000 + RTRDenoise: 010101 + RTRDenoiserRadius: 080000000c00000010000000 + RTRSmoothDenoising: 010000 + Fog_ControlMode: 000000000000000000000000 + Fog_Budget: + - 0.166 + - 0.33 + - 0.666 + Fog_DepthRatio: + - 0.666 + - 0.666 + - 0.5 + m_ObsoleteLightLayerName0: + m_ObsoleteLightLayerName1: + m_ObsoleteLightLayerName2: + m_ObsoleteLightLayerName3: + m_ObsoleteLightLayerName4: + m_ObsoleteLightLayerName5: + m_ObsoleteLightLayerName6: + m_ObsoleteLightLayerName7: + m_ObsoleteDecalLayerName0: + m_ObsoleteDecalLayerName1: + m_ObsoleteDecalLayerName2: + m_ObsoleteDecalLayerName3: + m_ObsoleteDecalLayerName4: + m_ObsoleteDecalLayerName5: + m_ObsoleteDecalLayerName6: + m_ObsoleteDecalLayerName7: + m_ObsoleteSupportRuntimeDebugDisplay: 0 + allowShaderVariantStripping: 1 + enableSRPBatcher: 1 + availableMaterialQualityLevels: -1 + m_DefaultMaterialQualityLevel: 4 + diffusionProfileSettings: {fileID: 0} + virtualTexturingSettings: + streamingCpuCacheSizeInMegaBytes: 256 + streamingGpuCacheSettings: + - format: 0 + sizeInMegaBytes: 128 + m_UseRenderGraph: 1 + m_Version: 22 + m_ObsoleteFrameSettings: + overrides: 0 + enableShadow: 0 + enableContactShadows: 0 + enableShadowMask: 0 + enableSSR: 0 + enableSSAO: 0 + enableSubsurfaceScattering: 0 + enableTransmission: 0 + enableAtmosphericScattering: 0 + enableVolumetrics: 0 + enableReprojectionForVolumetrics: 0 + enableLightLayers: 0 + enableExposureControl: 1 + diffuseGlobalDimmer: 0 + specularGlobalDimmer: 0 + shaderLitMode: 0 + enableDepthPrepassWithDeferredRendering: 0 + enableTransparentPrepass: 0 + enableMotionVectors: 0 + enableObjectMotionVectors: 0 + enableDecals: 0 + enableRoughRefraction: 0 + enableTransparentPostpass: 0 + enableDistortion: 0 + enablePostprocess: 0 + enableOpaqueObjects: 0 + enableTransparentObjects: 0 + enableRealtimePlanarReflection: 0 + enableMSAA: 0 + enableAsyncCompute: 0 + runLightListAsync: 0 + runSSRAsync: 0 + runSSAOAsync: 0 + runContactShadowsAsync: 0 + runVolumeVoxelizationAsync: 0 + lightLoopSettings: + overrides: 0 + enableDeferredTileAndCluster: 0 + enableComputeLightEvaluation: 0 + enableComputeLightVariants: 0 + enableComputeMaterialVariants: 0 + enableFptlForForwardOpaque: 0 + enableBigTilePrepass: 0 + isFptlEnabled: 0 + m_ObsoleteBakedOrCustomReflectionFrameSettings: + overrides: 0 + enableShadow: 0 + enableContactShadows: 0 + enableShadowMask: 0 + enableSSR: 0 + enableSSAO: 0 + enableSubsurfaceScattering: 0 + enableTransmission: 0 + enableAtmosphericScattering: 0 + enableVolumetrics: 0 + enableReprojectionForVolumetrics: 0 + enableLightLayers: 0 + enableExposureControl: 1 + diffuseGlobalDimmer: 0 + specularGlobalDimmer: 0 + shaderLitMode: 0 + enableDepthPrepassWithDeferredRendering: 0 + enableTransparentPrepass: 0 + enableMotionVectors: 0 + enableObjectMotionVectors: 0 + enableDecals: 0 + enableRoughRefraction: 0 + enableTransparentPostpass: 0 + enableDistortion: 0 + enablePostprocess: 0 + enableOpaqueObjects: 0 + enableTransparentObjects: 0 + enableRealtimePlanarReflection: 0 + enableMSAA: 0 + enableAsyncCompute: 0 + runLightListAsync: 0 + runSSRAsync: 0 + runSSAOAsync: 0 + runContactShadowsAsync: 0 + runVolumeVoxelizationAsync: 0 + lightLoopSettings: + overrides: 0 + enableDeferredTileAndCluster: 0 + enableComputeLightEvaluation: 0 + enableComputeLightVariants: 0 + enableComputeMaterialVariants: 0 + enableFptlForForwardOpaque: 0 + enableBigTilePrepass: 0 + isFptlEnabled: 0 + m_ObsoleteRealtimeReflectionFrameSettings: + overrides: 0 + enableShadow: 0 + enableContactShadows: 0 + enableShadowMask: 0 + enableSSR: 0 + enableSSAO: 0 + enableSubsurfaceScattering: 0 + enableTransmission: 0 + enableAtmosphericScattering: 0 + enableVolumetrics: 0 + enableReprojectionForVolumetrics: 0 + enableLightLayers: 0 + enableExposureControl: 1 + diffuseGlobalDimmer: 0 + specularGlobalDimmer: 0 + shaderLitMode: 0 + enableDepthPrepassWithDeferredRendering: 0 + enableTransparentPrepass: 0 + enableMotionVectors: 0 + enableObjectMotionVectors: 0 + enableDecals: 0 + enableRoughRefraction: 0 + enableTransparentPostpass: 0 + enableDistortion: 0 + enablePostprocess: 0 + enableOpaqueObjects: 0 + enableTransparentObjects: 0 + enableRealtimePlanarReflection: 0 + enableMSAA: 0 + enableAsyncCompute: 0 + runLightListAsync: 0 + runSSRAsync: 0 + runSSAOAsync: 0 + runContactShadowsAsync: 0 + runVolumeVoxelizationAsync: 0 + lightLoopSettings: + overrides: 0 + enableDeferredTileAndCluster: 0 + enableComputeLightEvaluation: 0 + enableComputeLightVariants: 0 + enableComputeMaterialVariants: 0 + enableFptlForForwardOpaque: 0 + enableBigTilePrepass: 0 + isFptlEnabled: 0 + m_ObsoleteDefaultVolumeProfile: {fileID: 0} + m_ObsoleteDefaultLookDevProfile: {fileID: 0} + m_ObsoleteFrameSettingsMovedToDefaultSettings: + bitDatas: + data1: 0 + data2: 0 + lodBias: 0 + lodBiasMode: 0 + lodBiasQualityLevel: 0 + maximumLODLevel: 0 + maximumLODLevelMode: 0 + maximumLODLevelQualityLevel: 0 + sssQualityMode: 0 + sssQualityLevel: 0 + sssCustomSampleBudget: 0 + msaaMode: 0 + materialQuality: 0 + m_ObsoleteBakedOrCustomReflectionFrameSettingsMovedToDefaultSettings: + bitDatas: + data1: 0 + data2: 0 + lodBias: 0 + lodBiasMode: 0 + lodBiasQualityLevel: 0 + maximumLODLevel: 0 + maximumLODLevelMode: 0 + maximumLODLevelQualityLevel: 0 + sssQualityMode: 0 + sssQualityLevel: 0 + sssCustomSampleBudget: 0 + msaaMode: 0 + materialQuality: 0 + m_ObsoleteRealtimeReflectionFrameSettingsMovedToDefaultSettings: + bitDatas: + data1: 0 + data2: 0 + lodBias: 0 + lodBiasMode: 0 + lodBiasQualityLevel: 0 + maximumLODLevel: 0 + maximumLODLevelMode: 0 + maximumLODLevelQualityLevel: 0 + sssQualityMode: 0 + sssQualityLevel: 0 + sssCustomSampleBudget: 0 + msaaMode: 0 + materialQuality: 0 + m_ObsoleteRenderPipelineResources: {fileID: 0} + m_ObsoleteRenderPipelineRayTracingResources: {fileID: 0} + m_ObsoleteBeforeTransparentCustomPostProcesses: [] + m_ObsoleteBeforePostProcessCustomPostProcesses: [] + m_ObsoleteAfterPostProcessCustomPostProcesses: [] + m_ObsoleteBeforeTAACustomPostProcesses: [] + m_ObsoleteShaderVariantLogLevel: 0 + m_ObsoleteLensAttenuation: 0 + m_ObsoleteDiffusionProfileSettingsList: [] diff --git a/Tests/Runtime/RenderPipelineAssets/HDRP-Deferred.asset.meta b/Tests/Runtime/RenderPipelineAssets/HDRP-Deferred.asset.meta new file mode 100644 index 00000000..3bb65733 --- /dev/null +++ b/Tests/Runtime/RenderPipelineAssets/HDRP-Deferred.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7bc73b3bd18dc416eb918627099f0407 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: From 1147edf49951568fc6801475f9aac15a155d5bb5 Mon Sep 17 00:00:00 2001 From: Andreas Atteneder Date: Wed, 15 May 2024 15:16:29 +0200 Subject: [PATCH 18/18] Release 6.5.0 --- CHANGELOG.md | 2 +- Runtime/Scripts/Export/Constants.cs | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d3a6896d..951b0f34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased] - +## [6.5.0] - 2024-05-15 ### Added - (Export) Support for exporting glTFast shader based materials. This reduces data loss on import-export round trips considerably. diff --git a/Runtime/Scripts/Export/Constants.cs b/Runtime/Scripts/Export/Constants.cs index 03f38477..d88046a1 100644 --- a/Runtime/Scripts/Export/Constants.cs +++ b/Runtime/Scripts/Export/Constants.cs @@ -7,7 +7,7 @@ namespace GLTFast.Export { static class Constants { - public const string version = "6.4.0"; + public const string version = "6.5.0"; internal const string mimeTypePNG = "image/png"; internal const string mimeTypeJPG = "image/jpeg"; diff --git a/package.json b/package.json index f06f6be0..bd23de41 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.unity.cloud.gltfast", - "version": "6.4.0", + "version": "6.5.0", "displayName": "Unity glTFast", "description": "Use glTFast to import and export glTF 3D files efficiently at runtime or in the Editor", "unity": "2020.3",