From 868d6457273c5fc8ae3685a1f32cadcbfd630268 Mon Sep 17 00:00:00 2001 From: Enrico Speranza Date: Mon, 30 Jul 2018 10:42:02 +0200 Subject: [PATCH] Add UnityGLTFShaderVariants for issue: https://github.com/KhronosGroup/UnityGLTF/issues/206 See: https://github.com/KhronosGroup/UnityGLTF/issues/206 --- .../UnityGLTFShaderVariants.shadervariants | 263 ++++++++++++++++++ ...nityGLTFShaderVariants.shadervariants.meta | 9 + .../Shaders/UnityStandardInput.cginc | 4 +- .../Shaders/UnityStandardShadow.cginc | 4 +- .../ProjectSettings/GraphicsSettings.asset | 37 ++- 5 files changed, 295 insertions(+), 22 deletions(-) create mode 100644 UnityGLTF/Assets/Resources/UnityGLTFShaderVariants.shadervariants create mode 100644 UnityGLTF/Assets/Resources/UnityGLTFShaderVariants.shadervariants.meta diff --git a/UnityGLTF/Assets/Resources/UnityGLTFShaderVariants.shadervariants b/UnityGLTF/Assets/Resources/UnityGLTFShaderVariants.shadervariants new file mode 100644 index 000000000..354bacf2b --- /dev/null +++ b/UnityGLTF/Assets/Resources/UnityGLTFShaderVariants.shadervariants @@ -0,0 +1,263 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!200 &20000000 +ShaderVariantCollection: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: UnityGLTFShaderVariants + m_Shaders: + data: + first: {fileID: 66, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: + passType: 0 + data: + first: {fileID: 45, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: DIRECTIONAL _EMISSION _SPECGLOSSMAP + passType: 4 + - keywords: DIRECTIONAL _SPECGLOSSMAP + passType: 5 + - keywords: SHADOWS_DEPTH _SPECGLOSSMAP + passType: 8 + data: + first: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: DIRECTIONAL + passType: 4 + - keywords: DIRECTIONAL SHADOWS_SCREEN + passType: 4 + - keywords: DIRECTIONAL _EMISSION + passType: 4 + - keywords: DIRECTIONAL _ALPHAPREMULTIPLY_ON + passType: 4 + - keywords: DIRECTIONAL + passType: 5 + - keywords: DIRECTIONAL _ALPHAPREMULTIPLY_ON + passType: 5 + - keywords: SHADOWS_DEPTH + passType: 8 + - keywords: SHADOWS_DEPTH _ALPHAPREMULTIPLY_ON + passType: 8 + data: + first: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: SHADOWS_SPLIT_SPHERES + passType: 0 + data: + first: {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: DIRECTIONAL + passType: 4 + - keywords: DIRECTIONAL + passType: 5 + - keywords: SHADOWS_DEPTH + passType: 8 + data: + first: {fileID: 106, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: _SUNDISK_SIMPLE + passType: 0 + data: + first: {fileID: 9000, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: + passType: 0 + data: + first: {fileID: 9001, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: + passType: 0 + data: + first: {fileID: 9002, guid: 0000000000000000f000000000000000, type: 0} + second: + variants: + - keywords: + passType: 0 + data: + first: {fileID: 4800000, guid: 0ffe2976cdefd434c8fcd886ffa69322, type: 3} + second: + variants: + - keywords: DIRECTIONAL + passType: 4 + - keywords: DIRECTIONAL _EMISSION + passType: 4 + - keywords: DIRECTIONAL _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL _EMISSION _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL _ALPHATEST_ON + passType: 4 + - keywords: DIRECTIONAL _ALPHATEST_ON _EMISSION + passType: 4 + - keywords: DIRECTIONAL _ALPHATEST_ON _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL _ALPHATEST_ON _EMISSION _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL _ALPHABLEND_ON + passType: 4 + - keywords: DIRECTIONAL _ALPHABLEND_ON _EMISSION + passType: 4 + - keywords: DIRECTIONAL _ALPHABLEND_ON _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL _ALPHABLEND_ON _EMISSION _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL _SPECGLOSSMAP + passType: 4 + - keywords: DIRECTIONAL _EMISSION _SPECGLOSSMAP + passType: 4 + - keywords: DIRECTIONAL _NORMALMAP _SPECGLOSSMAP + passType: 4 + - keywords: DIRECTIONAL _EMISSION _NORMALMAP _SPECGLOSSMAP + passType: 4 + - keywords: DIRECTIONAL _ALPHATEST_ON _SPECGLOSSMAP + passType: 4 + - keywords: DIRECTIONAL _ALPHATEST_ON _EMISSION _SPECGLOSSMAP + passType: 4 + - keywords: DIRECTIONAL _ALPHATEST_ON _NORMALMAP _SPECGLOSSMAP + passType: 4 + - keywords: DIRECTIONAL _ALPHATEST_ON _EMISSION _NORMALMAP _SPECGLOSSMAP + passType: 4 + - keywords: DIRECTIONAL _ALPHABLEND_ON _SPECGLOSSMAP + passType: 4 + - keywords: DIRECTIONAL _ALPHABLEND_ON _EMISSION _SPECGLOSSMAP + passType: 4 + - keywords: DIRECTIONAL _ALPHABLEND_ON _NORMALMAP _SPECGLOSSMAP + passType: 4 + - keywords: DIRECTIONAL _ALPHABLEND_ON _EMISSION _NORMALMAP _SPECGLOSSMAP + passType: 4 + - keywords: DIRECTIONAL + passType: 5 + - keywords: DIRECTIONAL _NORMALMAP + passType: 5 + - keywords: DIRECTIONAL _ALPHATEST_ON + passType: 5 + - keywords: DIRECTIONAL _ALPHATEST_ON _NORMALMAP + passType: 5 + - keywords: DIRECTIONAL _ALPHABLEND_ON + passType: 5 + - keywords: DIRECTIONAL _ALPHABLEND_ON _NORMALMAP + passType: 5 + - keywords: DIRECTIONAL _SPECGLOSSMAP + passType: 5 + - keywords: DIRECTIONAL _NORMALMAP _SPECGLOSSMAP + passType: 5 + - keywords: DIRECTIONAL _ALPHATEST_ON _SPECGLOSSMAP + passType: 5 + - keywords: DIRECTIONAL _ALPHATEST_ON _NORMALMAP _SPECGLOSSMAP + passType: 5 + - keywords: DIRECTIONAL _ALPHABLEND_ON _SPECGLOSSMAP + passType: 5 + - keywords: DIRECTIONAL _ALPHABLEND_ON _NORMALMAP _SPECGLOSSMAP + passType: 5 + - keywords: SHADOWS_DEPTH + passType: 8 + - keywords: SHADOWS_DEPTH _ALPHATEST_ON + passType: 8 + - keywords: SHADOWS_DEPTH _ALPHABLEND_ON + passType: 8 + - keywords: SHADOWS_DEPTH _SPECGLOSSMAP + passType: 8 + - keywords: SHADOWS_DEPTH _ALPHATEST_ON _SPECGLOSSMAP + passType: 8 + - keywords: SHADOWS_DEPTH _ALPHABLEND_ON _SPECGLOSSMAP + passType: 8 + data: + first: {fileID: 4800000, guid: 9836e4430eb58204086d7d1440e16a4f, type: 3} + second: + variants: + - keywords: DIRECTIONAL + passType: 4 + - keywords: DIRECTIONAL _EMISSION + passType: 4 + - keywords: DIRECTIONAL _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL _EMISSION _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL _ALPHATEST_ON + passType: 4 + - keywords: DIRECTIONAL _ALPHATEST_ON _EMISSION + passType: 4 + - keywords: DIRECTIONAL _ALPHATEST_ON _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL _ALPHATEST_ON _EMISSION _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL _ALPHABLEND_ON + passType: 4 + - keywords: DIRECTIONAL _ALPHABLEND_ON _EMISSION + passType: 4 + - keywords: DIRECTIONAL _ALPHABLEND_ON _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL _ALPHABLEND_ON _EMISSION _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL _METALLICGLOSSMAP + passType: 4 + - keywords: DIRECTIONAL _EMISSION _METALLICGLOSSMAP + passType: 4 + - keywords: DIRECTIONAL _METALLICGLOSSMAP _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL _EMISSION _METALLICGLOSSMAP _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL SHADOWS_SCREEN _EMISSION _METALLICGLOSSMAP _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL _ALPHATEST_ON _METALLICGLOSSMAP + passType: 4 + - keywords: DIRECTIONAL _ALPHATEST_ON _EMISSION _METALLICGLOSSMAP + passType: 4 + - keywords: DIRECTIONAL _ALPHATEST_ON _METALLICGLOSSMAP _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL _ALPHATEST_ON _EMISSION _METALLICGLOSSMAP _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL _ALPHABLEND_ON _METALLICGLOSSMAP + passType: 4 + - keywords: DIRECTIONAL _ALPHABLEND_ON _EMISSION _METALLICGLOSSMAP + passType: 4 + - keywords: DIRECTIONAL _ALPHABLEND_ON _METALLICGLOSSMAP _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL _ALPHABLEND_ON _EMISSION _METALLICGLOSSMAP _NORMALMAP + passType: 4 + - keywords: DIRECTIONAL + passType: 5 + - keywords: DIRECTIONAL _NORMALMAP + passType: 5 + - keywords: DIRECTIONAL _ALPHATEST_ON + passType: 5 + - keywords: DIRECTIONAL _ALPHATEST_ON _NORMALMAP + passType: 5 + - keywords: DIRECTIONAL _ALPHABLEND_ON + passType: 5 + - keywords: DIRECTIONAL _ALPHABLEND_ON _NORMALMAP + passType: 5 + - keywords: DIRECTIONAL _METALLICGLOSSMAP + passType: 5 + - keywords: DIRECTIONAL _METALLICGLOSSMAP _NORMALMAP + passType: 5 + - keywords: DIRECTIONAL _ALPHATEST_ON _METALLICGLOSSMAP + passType: 5 + - keywords: DIRECTIONAL _ALPHATEST_ON _METALLICGLOSSMAP _NORMALMAP + passType: 5 + - keywords: DIRECTIONAL _ALPHABLEND_ON _METALLICGLOSSMAP + passType: 5 + - keywords: DIRECTIONAL _ALPHABLEND_ON _METALLICGLOSSMAP _NORMALMAP + passType: 5 + - keywords: SHADOWS_DEPTH + passType: 8 + - keywords: SHADOWS_DEPTH _ALPHATEST_ON + passType: 8 + - keywords: SHADOWS_DEPTH _ALPHABLEND_ON + passType: 8 + - keywords: SHADOWS_DEPTH _METALLICGLOSSMAP + passType: 8 + - keywords: SHADOWS_DEPTH _ALPHATEST_ON _METALLICGLOSSMAP + passType: 8 + - keywords: SHADOWS_DEPTH _ALPHABLEND_ON _METALLICGLOSSMAP + passType: 8 diff --git a/UnityGLTF/Assets/Resources/UnityGLTFShaderVariants.shadervariants.meta b/UnityGLTF/Assets/Resources/UnityGLTFShaderVariants.shadervariants.meta new file mode 100644 index 000000000..5630d74ea --- /dev/null +++ b/UnityGLTF/Assets/Resources/UnityGLTFShaderVariants.shadervariants.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: a20add4cf9d674d568184fc2de952874 +timeCreated: 1532937824 +licenseType: Free +NativeFormatImporter: + mainObjectFileID: 20000000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityGLTF/Assets/UnityGLTF/Shaders/UnityStandardInput.cginc b/UnityGLTF/Assets/UnityGLTF/Shaders/UnityStandardInput.cginc index 09f354de0..166b70543 100644 --- a/UnityGLTF/Assets/UnityGLTF/Shaders/UnityStandardInput.cginc +++ b/UnityGLTF/Assets/UnityGLTF/Shaders/UnityStandardInput.cginc @@ -1,3 +1,5 @@ +// Upgrade NOTE: replaced 'UNITY_INSTANCE_ID' with 'UNITY_VERTEX_INPUT_INSTANCE_ID' + // Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt) #ifndef UNITY_STANDARD_INPUT_INCLUDED @@ -68,7 +70,7 @@ struct VertexInput #if defined(UNITY_VERTEX_INPUT_INSTANCE_ID) UNITY_VERTEX_INPUT_INSTANCE_ID #else - UNITY_INSTANCE_ID + UNITY_VERTEX_INPUT_INSTANCE_ID #endif }; diff --git a/UnityGLTF/Assets/UnityGLTF/Shaders/UnityStandardShadow.cginc b/UnityGLTF/Assets/UnityGLTF/Shaders/UnityStandardShadow.cginc index 3c7b89d71..23772cd11 100644 --- a/UnityGLTF/Assets/UnityGLTF/Shaders/UnityStandardShadow.cginc +++ b/UnityGLTF/Assets/UnityGLTF/Shaders/UnityStandardShadow.cginc @@ -1,3 +1,5 @@ +// Upgrade NOTE: replaced 'UNITY_INSTANCE_ID' with 'UNITY_VERTEX_INPUT_INSTANCE_ID' + // Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt) #ifndef UNITY_STANDARD_SHADOW_INCLUDED @@ -87,7 +89,7 @@ struct VertexInput #if defined(UNITY_VERTEX_INPUT_INSTANCE_ID) UNITY_VERTEX_INPUT_INSTANCE_ID #else - UNITY_INSTANCE_ID + UNITY_VERTEX_INPUT_INSTANCE_ID #endif }; diff --git a/UnityGLTF/ProjectSettings/GraphicsSettings.asset b/UnityGLTF/ProjectSettings/GraphicsSettings.asset index 325937ca8..4cdb24546 100644 --- a/UnityGLTF/ProjectSettings/GraphicsSettings.asset +++ b/UnityGLTF/ProjectSettings/GraphicsSettings.asset @@ -3,7 +3,7 @@ --- !u!30 &1 GraphicsSettings: m_ObjectHideFlags: 0 - serializedVersion: 7 + serializedVersion: 12 m_Deferred: m_Mode: 1 m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} @@ -36,33 +36,30 @@ GraphicsSettings: - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 10782, guid: 0000000000000000f000000000000000, type: 0} - m_PreloadedShaders: [] + - {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0} + m_PreloadedShaders: + - {fileID: 20000000, guid: a20add4cf9d674d568184fc2de952874, type: 2} m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} - m_ShaderSettings_Tier1: - useCascadedShadowMaps: 1 - standardShaderQuality: 2 - useReflectionProbeBoxProjection: 1 - useReflectionProbeBlending: 1 - m_ShaderSettings_Tier2: - useCascadedShadowMaps: 1 - standardShaderQuality: 2 - useReflectionProbeBoxProjection: 1 - useReflectionProbeBlending: 1 - m_ShaderSettings_Tier3: - useCascadedShadowMaps: 1 - standardShaderQuality: 2 - useReflectionProbeBoxProjection: 1 - useReflectionProbeBlending: 1 - m_BuildTargetShaderSettings: [] + m_CustomRenderPipeline: {fileID: 0} + m_TransparencySortMode: 0 + m_TransparencySortAxis: {x: 0, y: 0, z: 1} + m_DefaultRenderingPath: 1 + m_DefaultMobileRenderingPath: 1 + m_TierSettings: [] m_LightmapStripping: 0 m_FogStripping: 0 + m_InstancingStripping: 0 m_LightmapKeepPlain: 1 m_LightmapKeepDirCombined: 1 - m_LightmapKeepDirSeparate: 1 m_LightmapKeepDynamicPlain: 1 m_LightmapKeepDynamicDirCombined: 1 - m_LightmapKeepDynamicDirSeparate: 1 + m_LightmapKeepShadowMask: 1 + m_LightmapKeepSubtractive: 1 m_FogKeepLinear: 1 m_FogKeepExp: 1 m_FogKeepExp2: 1 + m_AlbedoSwatchInfos: [] + m_LightsUseLinearIntensity: 0 + m_LightsUseColorTemperature: 0